Proceedings of ISP RAS


Dynamic and ahead of time optimization for JavaScript programs.

Roman Zhuykov, Dmitry Melnik, Ruben Buchatskiy, Vahagn Vardanyan, Vladislav Ivanishin, Eugene Sharygin.

Abstract

The paper is dedicated to performance improvement of JavaScript programs. In this work we examine the specifics of dynamic optimizations in the WebKit JSC JITcompiler for JavaScript, and how the performance of such optimizations can be improved. We concentrate on two main directions for performance improvement. First, we strive to move the hot spots code generation to the highest possible speculative JIT level. We achieve this goal by removing the obstacles that prevent speculative optimizations of such code, e.g., by correctly checking for negative zero floating constant we remove unneeded checks and move more code to the speculative optimizations level. Second, we improve code generation quality for the JSC compiler, mainly by implementing some of operations in C++ instead of own JavaScript API. Also we propose a method for ahead-of-time (AOT) compilation of JavaScript programs, and for saving them as a bytecode. This method allows reducing startup time of applications by moving the optimizations to AOT phase. The proposed methods were implemented in opensource WebKit library, and resulted in significant performance gain for popular JavaScript benchmarks on ARM platform. However, this comes at a cost of increased (up to 3x) source code file sizes.

Keywords

program optimizations; JIT optimization; ahead of time optimization; data flow graph; ARM

Edition

Proceedings of the Institute for System Programming, vol. 26, issue 1, 2014, pp. 297-314.

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

DOI: 10.15514/ISPRAS-2014-26(1)-10

Full text of the paper in pdf Back to the contents of the volume