3 ms·
Just to note though: Javascript in fact doesn't require representing objects as hash tables. For example, the V8 javascript engine represents objects as instanc
by Robin_Message 16y ago
Just to note though: Javascript in fact doesn't require representing objects as hash tables. For example, the V8 javascript engine represents objects as instances of classes, more or less exactly how C++ would do it (the build the class definitions automatically in the background.)
You are right on integers though, and other types of memory block in general, they are trickier to fix in a javascript engine. Surely the best IL is LLVM IL though, since it was designed so everything can compile down to it.
- silentbicycle 16y ago> Just to note though: Javascript in fact doesn't require representing objects as hash tables. For example, the V8 javascript engine represents objects as instances of classes, more or less exactly how C++ would do it (the build the class definitions automatically in the background.) That sounds like what Self does, too. See the excellent paper, "An Efficient Implementation of SELF" (http://selflanguage.org/documentation/published/implementation.html http://selflanguage.org/documentation/published/implementati...). The Self bibliography page (http://selflanguage.org/documentation/published/index.html http://selflanguage.org/documentation/published/index.html) has a lot of other content applicable to dynamic languages in general, too.
- wmf 16y agoSelf and V8 are connected through Lars Bak. http://en.wikipedia.org/wiki/Lars_Bak_(computer_programmer) http://en.wikipedia.org/wiki/Lars_Bak_(computer_programmer)
- silentbicycle 16y agoHe worked on Beta / Mjølner, too. Neat!
- jules 16y agoYep, sophisticated implementations try to infer the patterns in which objects occur and then dynamically generate classes for them. However this is not without problems, because if you assign to a new slot then you need to change the object's class, it needs to gracefully degrade to when the objects are used as hash tables, etc. LLVM IL would be excellent for speed. The problem is that it's not memory safe (i.e. it allows reading and writing to arbitrary memory locations). NativeClient at Google is trying to solve that. http://code.google.com/p/nativeclient/ http://code.google.com/p/nativeclient/