Go to file
yaojian16 44140ff18c update README_zh.md.
Signed-off-by: y00576111 <yaojian16@huawei.com>
2021-09-08 08:19:08 +00:00
docs !4 modify documents 2021-09-08 04:59:40 +00:00
ecmascript modify library dependent 2021-09-07 19:13:06 +08:00
test fix testcase in debug mode 2021-09-06 15:33:17 +08:00
.gitignore add ark js_runtime 2021-09-05 16:05:06 +08:00
BUILD.gn fix testcase in debug mode 2021-09-06 15:33:17 +08:00
js_runtime_config.gni add ark js_runtime 2021-09-05 16:05:06 +08:00
LICENSE add ark js_runtime 2021-09-05 16:05:06 +08:00
OAT.xml add ark js_runtime 2021-09-05 16:05:06 +08:00
ohos.build add ark js_runtime 2021-09-05 16:05:06 +08:00
README_zh.md update README_zh.md. 2021-09-08 08:19:08 +00:00
README.md modify document 2021-09-07 09:24:32 +08:00
run_test262.sh test262 ci build 2021-09-06 20:39:36 +08:00

ARK JS Runtime Module

Introduction

ARK JS Runtime is the runtime used by JavaScript JS applications on OpenHarmony. It consists of the JS object allocator, garbage collector GC, a standard library compliant with ECMAScript specifications, ARK bytecode interpreter, inline caches that store hidden classes, and the ARK Foreign Function Interface AFFI.

ARK JS runtime architecture

Directory Structure

/ark/js_runtime
├─ ecmascript             # JS object definition
│   ├─ base               # Base helper class
│   ├─ builtins           # ECMAScript library
│   ├─ class_linker       # Bytecode pre-processing module
│   ├─ compiler           # JS compiler
│   ├─ hprof              # Memory analysis utility class
│   ├─ ic                 # Inline cache module
│   ├─ interpreter        # JS interpreter
│   ├─ jobs               # Queue of jobs
│   ├─ js_vm              # ARK command line tool
│   ├─ mem                # Memory management module
│   ├─ napi               # External native interface
│   ├─ regexp             # Regular expression engine module
│   ├─ snapshot/mem       # Snapshot module
│   ├─ tests              # Unit test cases
│   ├─ thread             # Thread pool
│   ├─ tooling            # JS debugger
│   └─ vmstat             # Runtime status utility classes
└─ test                   # Module test cases

Constraints

  • Only the bytecode file generated by the ARK JS frontend can be run.
  • Only support ES2015 standard and strict mode ("use strict").
  • Don't support dynamically create functions via string (e.g., new Function("console.log(1))).

Build

./build.sh --product-name Hi3516DV300 --build-target ark_js_runtime

Available APIs

For details, see NAPI.

Usage Guidelines

For details about how to generate JS bytecodes, see Using the Toolchain.

To run bytecodes:

cd out/release

LD_LIBRARY_PATH=clang_x64/ark/ark:clang_x64/global/i18n:../../prebuilts/clang/ohos/linux-x86_64/llvm/lib/

./clang_x64/ark/ark/ark_js_vm helloworld.abc

Repositories Involved

ARK Runtime Subsystem

ark/runtime_core

ark/js_runtime

ark/ts2abc