Аhead of time optimization for JavaScript programs

Modern JavaScript engines use just-in-time (JIT) compilation to produce binary code. JIT compilers are limited in a complexity of optimizations they can perform at a runtime without delaying an execution. Static ahead-of-time (AOT) compilers do not have such limitations, but they are not well suited...

Full description

Bibliographic Details
Main Authors: Roman Zhuykov, Eugene Sharygin
Format: Article
Language:English
Published: Ivannikov Institute for System Programming of the Russian Academy of Sciences 2018-10-01
Series:Труды Института системного программирования РАН
Subjects:
Online Access:https://ispranproceedings.elpub.ru/jour/article/view/914
id doaj-e46fcff7f7b1474eb2cc3eeda2c93470
record_format Article
spelling doaj-e46fcff7f7b1474eb2cc3eeda2c934702020-11-25T02:55:11Zeng Ivannikov Institute for System Programming of the Russian Academy of SciencesТруды Института системного программирования РАН2079-81562220-64262018-10-01276678610.15514/ISPRAS-2015-27(6)-5914Аhead of time optimization for JavaScript programsRoman Zhuykov0Eugene Sharygin1ИСП РАНМГУ им. ЛомоносоваModern JavaScript engines use just-in-time (JIT) compilation to produce binary code. JIT compilers are limited in a complexity of optimizations they can perform at a runtime without delaying an execution. Static ahead-of-time (AOT) compilers do not have such limitations, but they are not well suited for compiling dynamic languages such as JavaScript. In the paper, we discuss methods for augmenting multi-tiered JIT compiler with a capability for AOT compilation, and implement some of ahead-of-time compilation ideas in two JavaScript engines - JavaScriptCore and V8. In JavaScriptCore (JSC), which is a part of open-source WebKit library, we have developed and implemented a framework, which allows saving of JavaScript programs as a binary package containing bytecode and a native code. The framework consists of two components: command-line compiler, which compiles source JavaScript program into compressed binary package, consisting of JSC internal representation called bytecode and native code produced by JSC’s non-optimized JIT compiler. The second component is patched JSC engine with a capability for loading and executing binary packages produced by the compiler. In addition, we have implemented saving of optimized internal representation in another JavaScript engine, which is called V8 and is used in Chrome and many other browsers. When running the same JavaScript program, cached internal representation can be loaded to reduce JIT-compilation time and decrease percentage of running unoptimized code before it became hot.https://ispranproceedings.elpub.ru/jour/article/view/914оптимизация программjavascriptкомпиляция во время выполненияпредварительная компиляцияwebkit javascriptcoreвиртуальная машина v8
collection DOAJ
language English
format Article
sources DOAJ
author Roman Zhuykov
Eugene Sharygin
spellingShingle Roman Zhuykov
Eugene Sharygin
Аhead of time optimization for JavaScript programs
Труды Института системного программирования РАН
оптимизация программ
javascript
компиляция во время выполнения
предварительная компиляция
webkit javascriptcore
виртуальная машина v8
author_facet Roman Zhuykov
Eugene Sharygin
author_sort Roman Zhuykov
title Аhead of time optimization for JavaScript programs
title_short Аhead of time optimization for JavaScript programs
title_full Аhead of time optimization for JavaScript programs
title_fullStr Аhead of time optimization for JavaScript programs
title_full_unstemmed Аhead of time optimization for JavaScript programs
title_sort аhead of time optimization for javascript programs
publisher Ivannikov Institute for System Programming of the Russian Academy of Sciences
series Труды Института системного программирования РАН
issn 2079-8156
2220-6426
publishDate 2018-10-01
description Modern JavaScript engines use just-in-time (JIT) compilation to produce binary code. JIT compilers are limited in a complexity of optimizations they can perform at a runtime without delaying an execution. Static ahead-of-time (AOT) compilers do not have such limitations, but they are not well suited for compiling dynamic languages such as JavaScript. In the paper, we discuss methods for augmenting multi-tiered JIT compiler with a capability for AOT compilation, and implement some of ahead-of-time compilation ideas in two JavaScript engines - JavaScriptCore and V8. In JavaScriptCore (JSC), which is a part of open-source WebKit library, we have developed and implemented a framework, which allows saving of JavaScript programs as a binary package containing bytecode and a native code. The framework consists of two components: command-line compiler, which compiles source JavaScript program into compressed binary package, consisting of JSC internal representation called bytecode and native code produced by JSC’s non-optimized JIT compiler. The second component is patched JSC engine with a capability for loading and executing binary packages produced by the compiler. In addition, we have implemented saving of optimized internal representation in another JavaScript engine, which is called V8 and is used in Chrome and many other browsers. When running the same JavaScript program, cached internal representation can be loaded to reduce JIT-compilation time and decrease percentage of running unoptimized code before it became hot.
topic оптимизация программ
javascript
компиляция во время выполнения
предварительная компиляция
webkit javascriptcore
виртуальная машина v8
url https://ispranproceedings.elpub.ru/jour/article/view/914
work_keys_str_mv AT romanzhuykov aheadoftimeoptimizationforjavascriptprograms
AT eugenesharygin aheadoftimeoptimizationforjavascriptprograms
_version_ 1724717779863470080