14514f5e3Sopenharmony_ci# ArkCompiler JS Runtime 24514f5e3Sopenharmony_ci 34514f5e3Sopenharmony_ci### Introduction 44514f5e3Sopenharmony_ci 54514f5e3Sopenharmony_ciArkCompiler JS Runtime is the default JS runtime on OpenHarmony. It supports ECMAScript libraries and efficient container libraries. It also provides a set of native APIs for C++ and JS interaction and a variety of garbage collectors that features high performance. 64514f5e3Sopenharmony_ci 74514f5e3Sopenharmony_ciFor more information, see [ArkCompiler JS Runtime](https://gitee.com/openharmony/docs/blob/master/en/readme/ARK-Runtime-Subsystem.md). 84514f5e3Sopenharmony_ci 94514f5e3Sopenharmony_ci**ArkCompiler JS Runtime architecture** 104514f5e3Sopenharmony_ci 114514f5e3Sopenharmony_ci 124514f5e3Sopenharmony_ci 134514f5e3Sopenharmony_ci## Directory Structure 144514f5e3Sopenharmony_ci 154514f5e3Sopenharmony_ci``` 164514f5e3Sopenharmony_ci/arkcompiler/ets_runtime 174514f5e3Sopenharmony_ci├─ ecmascript # Implementation of ArkCompiler JS Runtime, including the ECMAScript library, interpreter, and memory management 184514f5e3Sopenharmony_ci│ ├─ base # Base helper class 194514f5e3Sopenharmony_ci│ ├─ builtins # ECMAScript libraries 204514f5e3Sopenharmony_ci│ ├─ compiler # JS compiler 214514f5e3Sopenharmony_ci│ ├─ containers # Non-ECMAScript containers 224514f5e3Sopenharmony_ci│ ├─ dfx # Memory and profiling tool 234514f5e3Sopenharmony_ci│ ├─ ic # Inline cache module 244514f5e3Sopenharmony_ci│ ├─ interpreter # JS interpreter 254514f5e3Sopenharmony_ci│ ├─ jobs # Queue of jobs 264514f5e3Sopenharmony_ci│ ├─ js_vm # Command line tool 274514f5e3Sopenharmony_ci│ ├─ jspandafile # abc file management module 284514f5e3Sopenharmony_ci│ ├─ mem # Memory management module 294514f5e3Sopenharmony_ci│ ├─ module # ECMAScript module 304514f5e3Sopenharmony_ci│ ├─ napi # C++ API module 314514f5e3Sopenharmony_ci│ ├─ taskpool # Task pool 324514f5e3Sopenharmony_ci│ ├─ regexp # Regular expression engine module 334514f5e3Sopenharmony_ci│ ├─ snapshot # Snapshot module 344514f5e3Sopenharmony_ci│ ├─ stubs # Runtime stub functions 354514f5e3Sopenharmony_ci│ ├─ tests # Unit test cases 364514f5e3Sopenharmony_ci│ ├─ debugger # JS debugger 374514f5e3Sopenharmony_ci│ ├─ trampoline # Trampoline function 384514f5e3Sopenharmony_ci│ ├─ ts_type # TS type management module 394514f5e3Sopenharmony_ci└─ test # Module test cases 404514f5e3Sopenharmony_ci``` 414514f5e3Sopenharmony_ci 424514f5e3Sopenharmony_ci## Constraints 434514f5e3Sopenharmony_ci 444514f5e3Sopenharmony_ci* Only the ArkCompiler bytecode files generated by ts2abc, which is the ArkCompiler JS frontend toolchain, can be run. 454514f5e3Sopenharmony_ci* Only the ES2021 standard and strict modes are supported. 464514f5e3Sopenharmony_ci* Functions cannot be dynamically created using strings, such as new Function("console.log(1);")). 474514f5e3Sopenharmony_ci 484514f5e3Sopenharmony_ci## Building 494514f5e3Sopenharmony_ci 504514f5e3Sopenharmony_ci``` 514514f5e3Sopenharmony_ci$./build.sh --product-name hispark_taurus_standard --build-target ark_js_host_linux_tools_packages 524514f5e3Sopenharmony_ci``` 534514f5e3Sopenharmony_ci 544514f5e3Sopenharmony_ci### Available APIs 554514f5e3Sopenharmony_ci 564514f5e3Sopenharmony_ciSee [NAPI](https://gitee.com/openharmony/arkui_napi/blob/master/README.md). 574514f5e3Sopenharmony_ci 584514f5e3Sopenharmony_ci### Usage 594514f5e3Sopenharmony_ci 604514f5e3Sopenharmony_ciFor details about how to generate JS bytecodes, see [Using the Toolchain](docs/using-the-toolchain.md). 614514f5e3Sopenharmony_ci 624514f5e3Sopenharmony_ciTo run bytecodes: 634514f5e3Sopenharmony_ci``` 644514f5e3Sopenharmony_ciLD_LIBRARY_PATH=out/hispark_taurus/clang_x64/arkcompiler/ets_runtime:out/hispark_taurus/clang_x64/thirdparty/icu:prebuilts/clang/ohos/linux-x86_64/llvm/lib ./out/hispark_taurus/clang_x64/arkcompiler/ets_runtime/ark_js_vm helloworld.abc 654514f5e3Sopenharmony_ci 664514f5e3Sopenharmony_ci``` 674514f5e3Sopenharmony_ci 684514f5e3Sopenharmony_ciFor more information, see [ARK Runtime Usage Guide](https://gitee.com/openharmony/arkcompiler_ets_runtime/blob/master/ 694514f5e3Sopenharmony_cidocs/ARK-Runtime-Usage-Guide.md). 704514f5e3Sopenharmony_ci 714514f5e3Sopenharmony_ci## Repositories Involved 724514f5e3Sopenharmony_ci 734514f5e3Sopenharmony_ci[arkcompiler\_runtime\_core](https://gitee.com/openharmony/arkcompiler_runtime_core) 744514f5e3Sopenharmony_ci 754514f5e3Sopenharmony_ci**[arkcompiler\_ets\_runtime](https://gitee.com/openharmony/arkcompiler_ets_runtime)** 764514f5e3Sopenharmony_ci 774514f5e3Sopenharmony_ci[arkcompiler\_ets\_frontend](https://gitee.com/openharmony/arkcompiler_ets_frontend) 78