Sharing a JavaScript implementation across realms

Anne van Kesteren annevk at
Tue Jan 13 10:36:45 PST 2015

On Tue, Jan 13, 2015 at 6:14 PM, Mark S. Miller <erights at> wrote:
> My hypothesis is that it *requires* no further changes to JavaScript proper
> beyond ES5 strict mode, ES6 modules, and the inter-realm (aka "global")
> Symbol registry. But some future changes under discussion may help, such as
> extensible value types, if done right.

>From talking to implementers it seems like there are some things we
could still try memory-wise, but it becomes ever more complicated to
do and is not currently a high priority. Which makes me wonder how
much we realistically expect to progress here and if there's something
we could do language-wise that alleviates some of the issues.

SpiderMonkey self-hosted code apparently has access to some mechanisms
that allow lazy loading of the self-hosted code and allows for that
code to be collected again as well. The bytecode generated from the
self-hosted code can apparently be shared cross-realm under certain
circumstances. Though this is limited to realms running on the same
thread, making workers vastly less efficient and if at some point we
start using more threads for the main browser it would become less
efficient overall. But perhaps there are further tricks to share this
across threads as well as realms. These self-hosted tricks are also
currently limited to SpiderMonkey and cannot be used to implement
features outside the JavaScript engine.

(Thanks for the analysis by the way. Curious what others have to say.)


More information about the es-discuss mailing list