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.
References
- 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 Scholar
Digital 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 Scholar
Digital 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 Scholar
Digital Library
- J. R. Bell. Threaded Code. Communications of the ACM, 16(6):370--372, 1973. Google Scholar
Digital 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 Scholar
Digital 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 Scholar
Digital 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 Scholar
Digital 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 Scholar
Digital 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 Scholar
Digital 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 Scholar
Digital 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 Scholar
Digital 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 Scholar
Digital 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 Scholar
Cross 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 Scholar
Digital 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 Scholar
Digital 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 Scholar
Digital 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 Scholar
Digital Library
Index Terms
Tracing for web 3.0: trace compilation for the next generation web applications





Comments