Skip to content

Skip $parent/$root setup in the root parser when context variables are disabled - #354

Open
keichi wants to merge 1 commit into
masterfrom
skip-root-context-vars
Open

keichi wants to merge 1 commit into
masterfrom
skip-root-context-vars

Conversation

@keichi

@keichi keichi commented Nov 22, 2026

Copy link
Copy Markdown
Owner

The root parser always emitted vars.$parent = null; vars.$root = vars; and deleted both properties at the end, even when useContextVars() was not called. Deleting a property that was not the last one added makes V8 switch the object to dictionary mode, so the returned root object always ended up with slow properties.

This PR emits that code only when context variables are enabled.

Note: referencing "$root.x" at the top level without useContextVars() used to work by accident. It no longer does, which matches the documented behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant