最近重新看Google Chromium讲Ignition的一个ppt,最后提及JSC是Direct-threaded dispatch,而v8属于Indirect-threaded dispatch。
Contemporary JavaScript Engines
JavaScriptCore (Apple)
● Direct threaded (== bigger code and data, but fast).
● Register Machine.
● Custom assembler generating bytecode handlers in dispatch loop.
SpiderMonkey (Mozilla)
● Indirect threaded.
● Stack Machine.
● Interpreter implemented in C++ as either switch statement or goto table (depending on compiler).
Chakra (Microsoft)
● Register based bytecode and C++ based interpreter.
● Optimizing compiler can run concurrently with bytecode generation.
所谓解释器,根据解释执行的输入,有两种:AST与Bytecode。
但既然谈到虚拟机解释器,自然是有Bytecode的。
那么DTC和ITC又是指什么的?
根据一篇很老的论文,DTC指的是bytecode指令直接对应目标handler的跳转地址。而ITC