-
-
Notifications
You must be signed in to change notification settings - Fork 414
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 execution context and execution stack #186
Labels
enhancement
New feature or request
Hacktoberfest
Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com
help wanted
Extra attention is needed
Comments
I will take a look at this. |
👋 I would like to take a stab at this |
bors bot
pushed a commit
that referenced
this issue
Mar 4, 2022
Building up to #186, this PR extracts an `Intrinsics` struct from `Context`, facilitating a lot the extraction of a `Realm` struct. Also, it adapts the `BuiltIn` trait to be useful for builtins that don't expose a global property on initialization (`Generator`, `TypedArray`, etc.) It changes the following: - Creates an `Intrinsics` struct and refactors `Context` to transfer its intrinsic related fields to `Intrinsics`. - Renames some methods and parameters to better describe their functionality. - Makes `BuiltIn::init` return `Option<JsValue>` to skip global property initialization if the builtin initialization returns `None`
@rumpl did you have the chance to look into this? |
We decided that we don't need to follow the spec because our current implementation is more optimal. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
enhancement
New feature or request
Hacktoberfest
Hacktoberfest 2021 - https://hacktoberfest.digitalocean.com
help wanted
Extra attention is needed
This is a bit of a refactor.
https://tc39.es/ecma262/#sec-execution-contexts
First we need a context struct which holds information about the context.
fields would be https://tc39.es/ecma262/#table-22
Then we need to create a stack structure, this holds execution contexts in a FIFO order, and the top most one is the currently running context
This stack structure would also have methods on it:
8.3.1GetActiveScriptOrModule
8.3.2ResolveBinding
8.3.3GetThisEnvironment
8.3.4ResolveThisBinding
8.3.5GetNewTarget
8.3.6GetGlobalObject
Then the exec.rs would accept a new executionContext and run it
https://github.com/jasonwilliams/boa/blob/master/src/lib/exec.rs#L24-L29
Note
Multiple contexts can point to the same realm, so realm needs to be wrapped in a GC
The text was updated successfully, but these errors were encountered: