Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create intrinsics lazily, after we know parsing is successful. fixes #2307 #2314

Closed
wants to merge 1 commit into from

Conversation

jasonwilliams
Copy link
Member

@jasonwilliams jasonwilliams commented Sep 27, 2022

This moves intrinsics from the beginning to after parsing. With this change we can "fail fast" if there's a parsing/syntax error. Currently intrinsics need to be built before parsing the code which is wasteful.

The syntax errors are hardcoded to a JSValue as not to use the environment when we already know what the error type will be.

Before

image

After

image

Fixes: #2307

@jedel1043
Copy link
Member

This will probably benefit fom #2283, since that'll separate error creation from the context :)

bors bot pushed a commit that referenced this pull request Feb 1, 2023
Small (ish?) step towards having proper realm records 

This PR changes the following:

- Moves `Intrinsics` to `Realm`.
- Cleans up the initialization logic of our intrinsics to not depend on `Context`, unblocking things like #2314.
- Adds hooks to initialize the global object and the global this per the corresponding [`InitializeHostDefinedRealm ( )`](https://tc39.es/ecma262/#sec-initializehostdefinedrealm) hook. Though, this is currently broken because the vm uses `GlobalPropertyMap` instead of the `JsObject` API to initialize global properties.
@jedel1043
Copy link
Member

@jasonwilliams Do you have some progress on this? We can probably rebase this since the new error types makes this an easier change.

@jedel1043 jedel1043 added the waiting-on-author Waiting on PR changes from the author label Nov 29, 2023
@jasonwilliams
Copy link
Member Author

Thanks for pinging me on this, I think we can close this as it needs a rethink. If someone creates a new error handler and we parse incorrect syntax, we would need to execute that instead of the default syntaxError which may require us having the realm initiated. So this may not work as I expected when I started this

@jedel1043 jedel1043 removed the waiting-on-author Waiting on PR changes from the author label Nov 29, 2023
@jasonwilliams jasonwilliams deleted the lazy_intrinsics branch July 15, 2024 20:24
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.

[performance] - Opportunity to run parsing before building environment
2 participants