openharmony_ci 85ffbea88f !1740 heapprofiler support traceAllocation
Merge pull request !1740 from Riachel/master
2022-07-09 15:17:20 +00:00
2022-04-06 16:05:22 +08:00
2022-07-06 18:58:13 +08:00
2022-04-25 21:28:10 +08:00
2022-07-07 21:09:56 +08:00
2022-05-23 16:52:23 +08:00
2021-09-05 16:05:06 +08:00
2022-04-15 16:21:39 +08:00
2022-06-14 10:09:20 +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 information, 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 hispark_taurus_standard --build-target ark_js_host_linux_tools_packages

Available APIs

For details, see NAPI.

Usage Guidelines

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

To run bytecodes:

LD_LIBRARY_PATH=out/hispark_taurus/clang_x64/ark/ark:out/hispark_taurus/clang_x64/ark/ark_js_runtime:out/hispark_taurus/clang_x64/thirdparty/icu:prebuilts/clang/ohos/linux-x86_64/llvm/lib ./out/hispark_taurus/clang_x64/ark/ark_js_runtime/ark_js_vm helloworld.abc

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

Repositories Involved

ark_runtime_core

ark_js_runtime

ark_ts2abc

S
Description
方舟JS运行时(ARK JavaScript Runtime)是OpenHarmony上JS应用使用的运行时。包含JS对象的分配器以及垃圾回收器(GC)、符合ECMAScript规范的标准库、用于运行ARK前端组件生成的方舟字节码(ARK Bytecode,abc)的解释器、用于存储隐藏类的内联缓存、方舟JS运行时对外的函数接口(AFFI)等模块。
Readme 12 MiB
Languages
C++ 98%
TypeScript 0.9%
JavaScript 0.6%
Python 0.2%
Shell 0.2%