Abstract
Modern virtual machines for JavaScript use just-in-time (JIT) compilation to produce binary code. JIT compilers cannot perform complex optimizations. In contrast, static compilation has unlimited capabilities for complex optimizing transformations, but it cannot be efficiently applied to dynamic languages, such as JavaScript. In this paper, a general approach to the ahead-of-time compilation of programs in dynamic languages is proposed, and this approach is used for improving two virtual machines JavaScript- Core and V8. In the implementation of the improved JavaScriptCore engine with ahead-of-time compilation, the specifics of using JavaScript programs as a part of locally stored applications for the ARM platform were taken into account. In the V8 engine for the x86-64 platform, the ahead-of-time compilation is implemented by caching an optimized internal representation in a separate file.
Similar content being viewed by others
References
JavaScriptCore webpage on WebKit website. http://trac.webkit.org/wiki/JavaScriptCore
WebKit Browser Engine website. http://www.webkit.org
V8 Browser Engine webpage. https://code.google.com/p/v8/
Hong, S., Kim, J., Shin, J.W., Moon, S., Oh, H. Lee, J., and Choi, H., Java client ahead-of-time compiler for embedded systems, in Proc. of the 2007 ACM SIGPLAN/SIGBED Conference on Languages, Compilers, and Tools for Embedded Systems, 2007, pp. 63–72.
Hong, S. and Moon, S., Client-ahead-of-time compilation for digital TV software platform, in 3rd Workshop on Dynamic Compilation Everywhere, preprint, 2013. http: //sites.google.com/site/dynamiccompilationeverywhere /home/dce-2014/DCE-2014-Sunghyun-Hong-article. pdf
Zhuykov, R., Melnik, D., Buchatskiy, R., Vardanyan, V., Ivanishin, V., and Sharygin, E., Dynamic and ahead of time optimization for JavaScript programs, Trudy Inst. Sist. Programmirovaniya RAN, 2014, vol. 26, issue 1, pp. 297–314.
ECMA-262 Standard 5.1 edition description. http://www.ecma-international.org/ecma-262/5.1/index.html
Asm.js language website. http://asmjs.org/
“Are we fast yet?” https://arewefastyet.com/
Tramp3d testing webpage. http://gcc.opensuse.org/c++bench/tramp3d/
Emscripten project website. http://kripken.github.io/emscripten-site/
WebKit JavaScriptCore ahead-of-time compilation project sources at github.com website. http://github.com/ispras/webkit-aotc
V8 ahead-of-time compilation project sources at github.com website. http://github.com/ispras/v8-aotc
Author information
Authors and Affiliations
Corresponding author
Additional information
Original Russian Text © R. Zhuykov, E. Sharygin, 2017, published in Trudy Instituta Sistemnogo Programmirovaniya, vol. 27, issue 6, 2015, pp. 67–86.
Rights and permissions
About this article
Cite this article
Zhuykov, R., Sharygin, E. Ahead-of-time compilation of JavaScript programs. Program Comput Soft 43, 51–59 (2017). https://doi.org/10.1134/S036176881701008X
Received:
Published:
Issue Date:
DOI: https://doi.org/10.1134/S036176881701008X