boa icon indicating copy to clipboard operation
boa copied to clipboard

Create execution context and execution stack

Open jasonwilliams opened this issue 6 years ago • 3 comments

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

jasonwilliams avatar Oct 23 '19 09:10 jasonwilliams

I will take a look at this.

KrisChambers avatar Nov 27 '19 02:11 KrisChambers

👋 I would like to take a stab at this

rumpl avatar Feb 15 '22 20:02 rumpl

@rumpl did you have the chance to look into this?

Razican avatar Mar 27 '22 17:03 Razican

We decided that we don't need to follow the spec because our current implementation is more optimal.

jedel1043 avatar Apr 14 '24 14:04 jedel1043