동적 컴파일기반의 자바스크립트 엔진에서의 동적 타입 처리: TraceMonkey와 V8

Dynamic typing in JavaScript complicates its efficient just-in-time compilation (JITC) since the type of a variable is determined at runtime and it can vary during execution. We evaluate how efficiently dynamic typing is hanlded for two popular JITC-based JavaScript engines: TraceMonkey in the Firefox[2] and V8 in the Chrome[3]. The compilation unit in TraceMonkey is a single execution path called a trace where it generates machine code for a given computation guessing the types of operands. On the other hand, V8 generates code where every computation is handled by calling a generic, pre-compiled function in the V8 engine which computes after analyzing the types of operands. Our evaluation using a small test program shows that TraceMonkey outperform V8 when the types can be easily guessed, but if not, TraceMonkey pays a serious overhead for recompilation, losing to V8.