Go to file
wanyanglan b11d945856 Refactoring HIR IF_EXCEPTION and bytecode ldai fdai instructions
The exception object is passed directly as a value inside the IR
will cause acc to generate many phi nodes (other vreg rarely generate
phi nodes when exceptions are handled). The current modification
is to add a GET_EXCEPTION directive (placed at the beginning of
the catch part) to indicate that the exception object is read after
an exception occurs, in this case lowering is simpler and does not
need to consider different value outputs, the logic is more concise
and the number of code instructions is reduced.
Replace ladi and fdai HIR with MIR: these two instructions to get
the immediate number, do not need to use HIR to handle, this will
increase the number of HIR instructions, simplify lowering.

issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4T6HX

Signed-off-by: wanyanglan <wanyanglan1@huawei.com>
Change-Id: I751677e11b50976af4e2fc5a6cac4457fa9a44df
2022-02-11 16:24:43 +08:00
docs Path changes for the compiled product 2021-12-24 17:04:42 +08:00
ecmascript Refactoring HIR IF_EXCEPTION and bytecode ldai fdai instructions 2022-02-11 16:24:43 +08:00
test !511 add a unit-test for BuiltinsIntl class 2022-02-11 01:49:30 +00:00
.gitignore modify debugger events and api test 2022-01-14 15:24:38 +08:00
BUILD.gn !513 add TreeMap and TreeSet 2022-02-10 06:22:29 +00:00
bundle.json add bundle.json for componentize 2022-01-24 18:29:28 +08:00
js_runtime_config.gni independent running ts aot 2022-01-26 15:22:50 +08:00
LICENSE add ark js_runtime 2021-09-05 16:05:06 +08:00
OAT.xml shield js_runtime binary files with master 2021-09-27 20:18:16 +08:00
README_zh.md add container in readme 2022-01-24 15:32:38 +08:00
README.md add container in readme 2022-01-24 15:32:38 +08:00
run_test262.sh Description:sync from code from wgr_master to ohos 2021-12-21 09:36:03 +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.

For more infomation, see: ARK Runtime Subsystem.

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
│   ├─ containers         # Non-ECMAScript container library
│   ├─ cpu_profiler       # CPU Performance Analyzer
│   ├─ 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
$ export LD_LIBRARY_PATH=clang_x64/ark/ark_js_runtime:clang_x64/ark/ark:clang_x64/global/i18n:../../prebuilts/clang/ohos/linux-x86_64/llvm/lib/
$ ./clang_x64/ark/ark_js_runtime/ark_js_vm helloworld.abc

For more infomation, please see: ARK-Runtime-Usage-Guide.

Repositories Involved

ark_runtime_core

ark_js_runtime

ark_ts2abc