А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
Published in:Труды Института системного программирования РАН
Main Authors: Roman Zhuykov, Eugene Sharygin
Format: Article
Language:English
Published: Russian Academy of Sciences, Ivannikov Institute for System Programming 2018-10-01
Subjects:
Online Access:https://ispranproceedings.elpub.ru/jour/article/view/914
_version_ 1848651592381759488
author Roman Zhuykov
Eugene Sharygin
author_facet Roman Zhuykov
Eugene Sharygin
author_sort Roman Zhuykov
collection DOAJ
container_title Труды Института системного программирования РАН
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.
format Article
id doaj-e46fcff7f7b1474eb2cc3eeda2c93470
institution Directory of Open Access Journals
issn 2079-8156
2220-6426
language English
publishDate 2018-10-01
publisher Russian Academy of Sciences, Ivannikov Institute for System Programming
record_format Article
spelling doaj-e46fcff7f7b1474eb2cc3eeda2c934702025-11-03T00:33:48ZengRussian Academy of Sciences, Ivannikov Institute for System ProgrammingТруды Института системного программирования РАН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
spellingShingle Roman Zhuykov
Eugene Sharygin
Аhead of time optimization for JavaScript programs
оптимизация программ
javascript
компиляция во время выполнения
предварительная компиляция
webkit javascriptcore
виртуальная машина v8
title А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_short Аhead of time optimization for JavaScript programs
title_sort аhead of time optimization for javascript programs
topic оптимизация программ
javascript
компиляция во время выполнения
предварительная компиляция
webkit javascriptcore
виртуальная машина v8
url https://ispranproceedings.elpub.ru/jour/article/view/914
work_keys_str_mv AT romanzhuykov aheadoftimeoptimizationforjavascriptprograms
AT eugenesharygin aheadoftimeoptimizationforjavascriptprograms