ABSTRACT
Today's web applications are pushing the limits of modern web browsers. The emergence of the browser as the platform of choice for rich client-side applications has shifted the use of in-browser JavaScript from small scripting programs to large computationally intensive application logic. For many web applications, JavaScript performance has become one of the bottlenecks preventing the development of even more interactive client side applications. While traditional just-in-time compilation is successful for statically typed virtual machine based languages like Java, compiling JavaScript turns out to be a challenging task. Many JavaScript programs and scripts are short-lived, and users expect a responsive browser during page loading. This leaves little time for compilation of JavaScript to generate machine code.
We present a trace-based just-in-time compiler for JavaScript that uses run-time profiling to identify frequently executed code paths, which are compiled to executable machine code. Our approach increases execution performance by up to 116% by decomposing complex JavaScript instructions into a simple Forth-based representation, and then recording the actually executed code path through this low-level IR. Giving developers more computational horsepower enables a new generation of innovative web applications.
- Adobe Systems Inc. ActionScript 3 Language Specification, 2006. http://livedocs.adobe.com/specs/actionscript/3/wwhelp/wwhimpl/js/html/wwhelp.htm.Google Scholar
- Adobe Systems Inc. ActionScript Virtual Machine 2 Overview, 2007. http://www.adobe.com/devnet/actionscript/articles/avm2overview.pdf.Google Scholar
- Adobe Systems Inc. Adobe Flex SDK, 2008. http://www.adobe.com/products/flex/flexdownloads/#sdk.Google Scholar
- O. Agesen, J. Palsberg, and M. I. Schwartzbach. Type Inference of SELF: Analysis of Objects with Dynamic and Multiple Inheritance. Software Practice and Experience, 25(9):975--995, 1995. Google ScholarDigital Library
- A. Aiken and B. Murphy. Static Type Inference in a Dynamically Typed Language. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 279--290. ACM Press, 1991. Google ScholarDigital Library
- V. Bala, E. Duesterwald, and S. Banerjia. Dynamo: A Transparent Dynamic Optimization System. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 1--12. ACM Press, 2000. Google ScholarDigital Library
- J. R. Bell. Threaded Code. Communications of the ACM, 16(6):370--372, 1973. Google ScholarDigital Library
- C. Chambers and D. Ungar. Customization: Optimizing Compiler Technology for SELF, a Dynamically-Typed Object-Oriented Programming Language. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 146--160. ACM Press, 1989. Google ScholarDigital Library
- P. Cousot and R. Cousot. Systematic Design of Program Analysis Frameworks. In Proceedings of the ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages, pages 269--282. ACM Press, 1979. Google ScholarDigital Library
- R. Cytron, J. Ferrante, B. Rosen, M. Wegman, and F. Zadeck. Efficiently Computing Static Single Assignment Form and the Control Dependence Graph. ACM Transactions on Programming Languages and Systems, 13(4):451--490, 1991. Google ScholarDigital Library
- ECMA. Standard ECMA-262: ECMAScript Language Specification, 3rd edition, 1999. http://www.ecma-international.org/publications/standards/Ecma-262.htm.Google Scholar
- M. Ertl and D. Gregg. The Structure and Performance of Efficient Interpreters. Journal of Instruction-Level Parallelism, 5:1--25, 2003.Google Scholar
- A. Gal, C. W. Probst, and M. Franz. HotpathVM: An Effective JIT Compiler for Resource-Constrained Devices. In Proceedings of the International Conference on Virtual Execution Environments, pages 144--153. ACM Press, 2006. Google ScholarDigital Library
- C. Garrett, J. Dean, D. Grove, and C. Chambers. Measurement and Application of Dynamic Receiver Class Distributions. Technical Report CSE-TR-94-03-05, University of Washington, 1994.Google Scholar
- J. O. Graver and R. E. Johnson. A Type System for Smalltalk. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 136--150. ACM Press, 1990. Google ScholarDigital Library
- U. Hölzle, C. Chambers, and D. Ungar. Optimizing Dynamically-Typed Object-Oriented Languages With Polymorphic Inline Caches. In Proceedings of the European Conference on Object-Oriented Programming, pages 21--38. LNCS 512, Springer-Verlag, 1991. Google ScholarDigital Library
- U. Hölzle and D. Ungar. Optimizing Dynamically-Dispatched Calls with Run-Time Type Feedback. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 326--336. ACM Press, 1994. Google ScholarDigital Library
- JavaScript:TraceMonkey - Mozilla Wiki, 2008. https://wiki.mozilla.org/JavaScript:TraceMonkey.Google Scholar
- T. Lindholm and F. Yellin. The JavaTM Virtual Machine Specification. Addison-Wesley, 2nd edition, 1999. Google ScholarDigital Library
- Microsoft Developer Network. JScript (Windows Script Technologies), 2008. http://msdn.microsoft.com/en-us/library/hbxc2t98(VS.85).aspx.Google Scholar
- R. Milner. A Theory of Type Polymorphism in Programming. Journal of Computer and System Sciences, 17(3):348--375, 1978.Google ScholarCross Ref
- Mozilla Foundation. SpiderMonkey (JavaScript-C) Engine, 2008. http://www.mozilla.org/js/spidermonkey/.Google Scholar
- Mozilla Foundation. Tamarin Central, 2008. http://hg.mozilla.org/tamarin-central/.Google Scholar
- F. Nielson. Program Transformations in a Denotational Setting. ACM Transactions on Programming Languages and Systems, 7(3):359--379, 1985. Google ScholarDigital Library
- M. Pall. LuaJIT Roadmap, 2008. http://lua-users.org/lists/lua-l/2008-02/msg00051.html.Google Scholar
- Y. Shi, K. Casey, M. A. Ertl, and D. Gregg. Virtual Machine Showdown: Stack Versus Registers. ACM Transactions on Architecture and Code Optimization, 4(4):1--36, 2008. Google ScholarDigital Library
- SunSpider JavaScript Benchmark, 2008. http://webkit.org/perf/sunspider-0.9/sunspider.html.Google Scholar
- Surfin' Safari -- Blog Archive -- Announcing SquirrelFish, 2008. http://webkit.org/blog/189/announcing-squirrelfish/.Google Scholar
- S. Thatte. Type inference with partial types. In Proceedings of the International Colloquium on Automata, Languages and Programming, pages 615--629. LNCS 317, Springer-Verlag, 1988. Google ScholarDigital Library
- M. Zaleski, A. D. Brown, and K. Stoodley. YETI: A graduallY Extensible Trace Interpreter. In Proceedings of the International Conference on Virtual Execution Environments, pages 83--93. ACM Press, 2007. Google ScholarDigital Library
Index Terms
- Tracing for web 3.0: trace compilation for the next generation web applications
Recommendations
SPUR: a trace-based JIT compiler for CIL
OOPSLA '10: Proceedings of the ACM international conference on Object oriented programming systems languages and applicationsTracing just-in-time compilers (TJITs) determine frequently executed traces (hot paths and loops) in running programs and focus their optimization effort by emitting optimized machine code specialized to these traces. Prior work has established this ...
SPUR: a trace-based JIT compiler for CIL
OOPSLA '10Tracing just-in-time compilers (TJITs) determine frequently executed traces (hot paths and loops) in running programs and focus their optimization effort by emitting optimized machine code specialized to these traces. Prior work has established this ...
HappyJIT: a tracing JIT compiler for PHP
DLS '11: Proceedings of the 7th symposium on Dynamic languagesCurrent websites are a combination of server-generated dynamic content with client-side interactive programs. Dynamically - typed languages have gained a lot of ground in both of these domains. The growth of Web 2.0 has introduced a myriad of websites ...
Comments