zhuzilin / es

A JavaScript interpreter from scratch, supporting ES5 syntax.
GNU Affero General Public License v3.0
27 stars 6 forks source link

Roadmap #1

Open zhuzilin opened 2 years ago

zhuzilin commented 2 years ago

recent:

zhuzilin commented 2 years ago

I'm trying to implement a stack-based virtual machine inside es.

I would use bytecode of SpiderMonkey: https://udn.realityripple.com/docs/Mozilla/Projects/SpiderMonkey/Internals/Bytecodes which is the only stack-based bytecode from a mainstream engine that is "well" documented.

The structure of the stack-based VM could be similar to JVM, as documented in the spec: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-2.html

zhuzilin commented 3 months ago

The main performance bottleneck with the current implementation is that the property visiting is slow (the hashmap visiting costs around 40% of time). To completely solve this, I need to implement both the hidden class and inline caching (which means a good byte code design is also needed), which is too much work......