A Concurrent Trace-based Just-InTime Compiler for Single-threaded JavaScript

JavaScript is emerging as the ubiquitous language of choice for web browser applications. These applications increasingly execute on embedded mobile devices, and thus demand responsiveness (i.e., short pause times for system activities, such as compilation and garbage collection). To deliver responsiveness, web browsers, such as Firefox, have adopted trace-based Just-In-Time (JIT) compilation. A trace-based JIT restricts the scope of compilation to a short hot path of instructions, limiting compilation time and space. Although the JavaScript limits applications to a singlethread, multicore embedded and general-purpose architectures are now widely available. This limitation presents an opportunity to reduce compiler pause times further by exploiting cores that the application is guaranteed not to use. While method-based concurrent JITs have proven useful for multi-threaded languages such as Java, trace-based JIT compilation for JavaScript offers new opportunities for concurrency. This paper presents the design and implementation of a concurrent trace-based JIT that uses novel lock-free synchronization to trace, compile, install, and stitch traces on a separate core such that the interpreter essentially never needs to pause. Our evaluation shows that this design reduces the total, average, and maximum pause time by 89%, 97%, and 93%, respectively compared to the base single-threaded JIT system. Our design also improves throughput by 6% on average and up to 34%, because it delivers optimized application code faster. This design provides a better end-user experience by exploiting multicore hardware to improve responsiveness and throughput.

[1]  L. Peter Deutsch,et al.  Efficient implementation of the smalltalk-80 system , 1984, POPL.

[2]  Stephen J. Fink,et al.  The Jalapeño virtual machine , 2000, IBM Syst. J..

[3]  Urs Hölzle,et al.  Reconciling responsiveness with performance in pure object-oriented languages , 1996, TOPL.

[4]  Cliff Click,et al.  The Java HotSpot Server Compiler , 2001, Java Virtual Machine Research and Technology Symposium.

[5]  Mason Chang,et al.  Making the Compilation “ Pipeline ” Explicit : Dynamic Compilation Using Trace Tree Serialization , 2007 .

[6]  John Giacomoni,et al.  FastForward for efficient pipeline parallelism: a cache-optimized concurrent lock-free queue , 2008, PPoPP.

[7]  Matthew Arnold,et al.  Dynamic compilation: the benefits of early investing , 2007, VEE '07.

[8]  Urs Hölzle,et al.  Optimizing dynamically-dispatched calls with run-time type feedback , 1994, PLDI '94.

[9]  Michael Franz,et al.  HotpathVM: an effective JIT compiler for resource-constrained devices , 2006, VEE '06.

[10]  Vivek Sarkar,et al.  Reducing the overhead of dynamic compilation , 2001, Softw. Pract. Exp..

[11]  Daryl Maier,et al.  Experiences with multi-threading and dynamic class loading in a Java just-in-time compiler , 2006, International Symposium on Code Generation and Optimization (CGO'06).

[12]  Matthew Arnold,et al.  Adaptive optimization in the Jalapeño JVM , 2000, OOPSLA '00.

[13]  Peter Lee,et al.  Generational stack collection and profile-driven pretenuring , 1998, PLDI.