Proceedings of ISP RAS


Dynamic Compilation of JavaScript Programs to the Statically Typed LLVM Intermediate Representation

V. Vardanyan (ISP RAS, Moscow), V. Ivanishin (ISP RAS, Moscow), S. Asryan (YSU, Armenia), A. Khachatryan (YSU, Armenia), J. Hakobyan (YSU, Armenia)

Abstract

Since its inception in the middle of the 90’s, JavaScript has become one of the most popular web development languages. Although initially developed as a browser-agnostic scripting language, in recent years JavaScript continues its evolution beyond the desktop to areas such as mobile and server-side web applications. Many massive applications are written using JavaScript, such as gmail, google docs, etc. JavaScript is also used in the Node.js — server-side web application developing platform. Moreover, JavaScript is the main language for developing applications on some operating systems for mobile and media devices. Examples of such systems are Tizen and FirefoxOS. Modern JavaScript engines use just-in-time (JIT) compilation to produce binary code. JIT compilers are limited in complexity of optimizations they can perform at runtime without delaying the execution. To maintain a trade-off between quick startup and doing sophisticated optimizations, JavaScript engines usually use multiple tiers for compiling hot functions. Our work is dedicated to performance improvement of JavaScript programs by adding a new optimizing level to the JavaScript V8 compiler. This level uses the LLVM infrastructure to optimize JavaScript functions and generate machine code. The main challenge of adding a new optimizing level is to support all the technologies (speculative compilation, on-stack replacement, concurrent compilation etc.) that are used in the modern multi-tier JIT compilers for increasing the performance and minimizing pauses during the interactive communication. All these technologies are fully supported in our solution.  This has resulted in significant performance gains on the JavaScript benchmark suites when compiling hot functions.

Keywords

JavaScript, V8, LLVM, program optimization, dynamic compilation

Edition

Proceedings of the Institute for System Programming, vol. 27, issue 6, 2015, pp. 33-48.

ISSN 2220-6426 (Online), ISSN 2079-8156 (Print).

DOI: 10.15514/ISPRAS-2015-27(6)-3

Full text of the paper in pdf (in Russian) Back to the contents of the volume