Starlight-JS / starlight

JS engine in Rust
https://teletype.in/@starlight-js
Mozilla Public License 2.0
509 stars 9 forks source link

Allocate `Realm` on the GC heap and store it in JsGlobal #88

Closed playXE closed 3 years ago

jameslahm commented 3 years ago

I am working on implementing create intrinsics. I think JsGlobal could be stored in the realm. My opinion is that we could store realm and runtime in a context. And each time, runtime will first init, creating internal objects. And then context be created, storing runtime and init realm. Last, context can eval js code. WDYT?

playXE commented 3 years ago

We still should have an access to runtime and realm instance from global object. That's what JavaScriptCore has too

jameslahm commented 3 years ago

That also makes sense. So we also add runtimeRef and realmRef in JsGlobal? WDYT?

playXE commented 3 years ago

So we also add runtimeRef and realmRef in JsGlobal?

Yep