A Concurrent Trace-based Just-InTime Compiler for 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 single-thread, 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 multithreaded 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 88%, 97%, and 93%, respectively compared to the base single-threaded JIT system. Our design also improves throughput by 5% on average and up to 36%, 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]  Urs Hölzle,et al.  Optimizing dynamically-dispatched calls with run-time type feedback , 1994, PLDI '94.

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

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

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

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

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

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

[9]  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).

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

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

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

[13]  Java client ahead-of-time compiler for embedded systems , 2007, LCTES.

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

[15]  Mason Chang,et al.  Trace-based just-in-time type specialization for dynamic languages , 2009, PLDI '09.