Fix bugs and performance issues in JSI interpreter#31
Draft
Fix bugs and performance issues in JSI interpreter#31
Conversation
…t char encoding, and performance fixes Co-authored-by: echosoar <14832743+echosoar@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix performance and implementation bugs
Fix bugs and performance issues in JSI interpreter
Feb 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several correctness bugs and performance issues identified in the interpreter's runtime evaluation and object model.
Bug Fixes
Object literal class type (
context.rs):new_objectwas callingcreate_objectwithClassType::Arrayinstead ofClassType::Object, causing{}literals to be misidentified as arrays (breakingObject.prototype.toStringetc.)Double expression evaluation (
context.rs): Innew_object, computed property names were evaluated twice — once into an unused variablex, then again for the actual name. Side-effecting expressions ran twice.Logical
&&/||return values (context.rs): Both operators were coercing their result toValue::Booleaninstead of returning the actual operand. JS short-circuit semantics require returning the operand value:String.prototype.charAtencoding (string.rs):u16::to_string()returns the decimal integer representation (e.g."65"for'A'), not the character. Fixed withchar::from_u32(code as u32).Performance Fixes
close_scope(context.rs): Loop over child scopes continued after finding the match. Addedbreak.Atomic ID counter (
object.rs):Object::newandforce_copywere doingfetch_add+loadto get the new ID.fetch_addreturns the previous value, so a singlefetch_add(...) + 1suffices.Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.