百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
E

escargot

> 编程语言
开源

Escargot 是一款专为资源受限环境设计的轻量级 JavaScript 引擎。

357 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

Escargot 是一款专为资源受限环境设计的轻量级 JavaScript 引擎。

Escargot

Escargot is an embeddable JavaScript engine developed by Samsung. It is designed for products that need more than a minimal scripting runtime but still have to manage CPU, memory, and platform constraints carefully.

Rather than minimizing the engine binary at all costs, Escargot balances runtime memory efficiency, interpreter performance, and modern JavaScript functionality. Its C++ implementation and built-in features can produce a larger native binary than ultra-minimal engines, but the engine is designed to use memory efficiently as applications and object graphs grow. This makes it a strong fit for substantial JavaScript workloads on embedded Linux, mobile, IoT, and other resource-aware products.

Escargot compiles JavaScript to bytecode and executes it without a JIT. The interpreter-based architecture avoids executable-memory requirements and provides predictable deployment characteristics, while the standards implementation supplies the language and internationalization features expected by real products.

Key capabilities include:

  • Modern JavaScript and internationalization: broad ECMAScript support, including the ECMAScript 2026 specification, plus Intl (ECMA-402) and Temporal backed by ICU.
  • Efficient execution of growing applications: runtime data structures and interpreter optimizations target good performance without allowing memory overhead to scale unnecessarily with larger programs.
  • Product-oriented portability: Linux, Android, Tizen, macOS, iOS, Windows, and reference bare-metal/RTOS ports are supported without depending on JIT availability.
  • Flexible feature footprint: WebAssembly, threading, code cache, debugger, ICU, and small-device optimizations can be selected for the target instead of imposing one fixed runtime configuration.
  • System-provided ICU option: instead of vendoring its own ICU, Escargot can link against the ICU already installed on the target OS, trading some Intl/Temporal functionality for a smaller binary.
  • Multiple embedding surfaces: applications can use the public C++ API in src/api/EscargotPublic.h, or enable the Node-API v10 layer and C-style hosting APIs documented in docs/n-api.md.
  • Deployment-ready outputs: CMake can produce static or shared libraries, a command-line shell, and C++ tests. Memory is managed by the Boehm-Demers-Weiser conservative garbage collector in third_party/GCutil.

Escargot powers services in Samsung products and is available as an LGPL-2.1 open source project for other embedders and contributors.

Contents

  • Building
    • Linux
    • macOS
    • iOS
    • Android
    • Tizen
    • Windows
    • Bare-metal / RTOS
    • Vendored ICU
  • Debugger
  • Testing
  • Contributing
  • Research Papers
  • License

Building ️

Supported Platforms and Architectures

Architecture names below use x86 for 32-bit Intel, x64 for x86-64, arm for 32-bit ARM, and aarch64/arm64 for 64-bit ARM.

Platform Architectures Status
Linux x86, x64, arm, aarch64, riscv64 Supported Linux platform. Ubuntu is used by CI and in the package-install example; it is not an OS restriction.
macOS x64, aarch64 Supported on both Intel and Apple Silicon.
iOS / iPadOS aarch64 Simulator and device builds are supported.
Windows x86, x64, arm64 Supported; WebAssembly is currently unavailable on arm64.
Android x86, x64, arm, aarch64 Supported across the Android ABIs.
Tizen x86, x64, arm, aarch64, riscv64
Bare-metal / RTOS arm (Cortex-M) FreeRTOS and NuttX reference ports are provided.

Build Options

Pass these options when configuring with CMake.

Flag Description Value Default
-DESCARGOT_BUILD_SHARED_LIBS Build shared library ON/OFF OFF
-DESCARGOT_BUILD_GC_SHARED_LIBS Build GCutil as a shared library ON/OFF OFF
-DESCARGOT_ENABLE_SHELL Build the Escargot shell (-DENABLE_SHELL remains a legacy alias) ON/OFF ON, except OFF when ESCARGOT_NAPI is ON
-DESCARGOT_BUILD_CCTEST Build the C++ tests ON/OFF OFF
-DESCARGOT_LIBICU_SUPPORT Include libicu library ON/OFF ON, except OFF on bare-metal
-DESCARGOT_WASM Enable WebAssembly support ON/OFF OFF
-DESCARGOT_CODE_CACHE Enable code cache ON/OFF OFF
-DESCARGOT_TCO Enable tail call optimization ON/OFF OFF
-DESCARGOT_THREADING Enable threading features (e.g. Atomics, SharedArrayBuffer) ON/OFF ON, except OFF on bare-metal
-DESCARGOT_TLS_ACCESS_BY_ADDRESS Enable thread local storage access optimization (offset) ON/OFF OFF everywhere (safety-first; opt in manually on stable glibc-style targets)
-DESCARGOT_TLS_ACCESS_BY_PTHREAD_KEY Enable thread local storage access optimization (pthread_key) ON/OFF ON when THREADING is ON and host is Android, otherwise OFF
-DESCARGOT_TEMPORAL Enable Temporal support (requires ICU) ON/OFF ON when LIBICU is ON, otherwise OFF
-DESCARGOT_SHADOWREALM Enable ShadowRealm support ON/OFF OFF
-DESCARGOT_SMALL_CONFIG Enable aggressive memory optimizations for tiny devices ON/OFF OFF
-DESCARGOT_EXPORT_ALL Export all symbols instead of the default curated public API ON/OFF OFF
-DESCARGOT_TEST Enable additional features used only for testing ON/OFF OFF
-DESCARGOT_DEBUGGER Enable Debug server ON/OFF OFF
-DESCARGOT_NAPI Enable Node-API (N-API) support and C-style hosting APIs ON/OFF OFF

Advanced / developer-only options (profiling, sanitizers, internal knobs)

Flag Description Value Default
-DESCARGOT_ASAN Build with AddressSanitizer ON/OFF OFF
-DESCARGOT_COVERAGE Build with gcov/Codecov instrumentation ON/OFF OFF
-DESCARGOT_DEPLOY Build for deployment (set up RPATH for a bundled ICU) ON/OFF OFF
-DESCARGOT_LIBICU_SUPPORT_WITH_DLOPEN Load libicu at runtime via dlopen() instead of linking directly ON/OFF ON, except OFF on macOS (dlopen-loaded ICU doesn't work correctly there), disallowed entirely on iOS, and OFF when ESCARGOT_LIBICU_SUPPORT_VENDORED is ON
-DESCARGOT_LIBICU_SUPPORT_VENDORED Build/ship Escargot's own ICU instead of relying on a system-provided one (see "Vendored ICU" below) ON/OFF ON on windows, macOS and iOS (the only ICU option there), OFF elsewhere (available on linux too)
-DESCARGOT_USE_EXTENDED_API Enable the extended C++ API (FunctionTemplateRef, etc.) ON/OFF ON when NAPI is ON, otherwise OFF
-DESCARGOT_USE_CUSTOM_LOGGING Use a custom logging backend instead of the host's native log (e.g. dlog on Tizen) ON/OFF OFF
-DESCARGOT_YARR_START_CHAR_FILTER Enable the Yarr interpreter first-character prefilter ON/OFF ON
-DESCARGOT_TCO_DEBUG Enable extra tail-call-optimization debug checks (debug builds only, requires ESCARGOT_TCO) ON/OFF OFF
-DESCARGOT_PROFILE_BDWGC Enable bdwgc (Boehm GC) profiling ON/OFF OFF
-DESCARGOT_MEM_STATS Enable memory usage statistics ON/OFF OFF
-DESCARGOT_VALGRIND Build with Valgrind annotations ON/OFF OFF
-DESCARGOT_GOOGLE_PERF Build with gperftools (Google Performance Tools) profiling ON/OFF OFF
-DESCARGOT_BUILD_64BIT_FORCE_LARGE On 64-bit targets, force full 64-bit pointers instead of 32-bit-in-64-bit compression ON/OFF ON

Linux

Escargot supports Linux distributions generally. The commands below use Debian/Ubuntu package names because Ubuntu is used by CI; install the equivalent development packages on other distributions.

Debian/Ubuntu prerequisites:

sudo apt-get install build-essential cmake git libicu-dev pkg-config python3

Prerequisites for x86-64-to-x86 compilation:

sudo apt-get install gcc-multilib g++-multilib
sudo apt-get install libicu-dev:i386

Build Escargot:

git submodule update --init third_party
cmake -S . -B out -DCMAKE_BUILD_TYPE=Release -DESCARGOT_ENABLE_SHELL=ON
cmake --build out

# Run a JavaScript file with the shell produced by the default build.
./out/escargot path/to/script.js

The default configuration produces the static library out/libescargot.a and the out/escargot shell. Set ESCARGOT_BUILD_SHARED_LIBS=ON for a shared library, or ESCARGOT_ENABLE_SHELL=OFF when embedding the library without the command-line shell.

macOS

Install the Xcode Command Line Tools (or full Xcode), then install the remaining build prerequisites:

xcode-select --install
brew install cmake python

Build Escargot:

git submodule update --init third_party
cmake -S . -B out -DCMAKE_BUILD_TYPE=Release -DESCARGOT_ENABLE_SHELL=ON
cmake --build out

ICU is vendored by default on macOS (see "Vendored ICU" below) -- it's built from the third_party/icu submodule above and linked statically, so no Homebrew icu4c/pkg-config setup is needed for the default path. To opt back into a Homebrew/system-provided ICU instead:

brew install icu4c

# add icu path to pkg_config_path (x64)
export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig:$PKG_CONFIG_PATH"
# add icu path to pkg_config_path (arm64)
export PKG_CONFIG_PATH="/opt/homebrew/opt/icu4c/lib/pkgconfig:$PKG_CONFIG_PATH"

cmake -S . -B out -DCMAKE_BUILD_TYPE=Release \
    -DESCARGOT_LIBICU_SUPPORT_VENDORED=OFF \
    -DESCARGOT_ENABLE_SHELL=ON
cmake --build out

Android

Build prerequisites on Ubuntu:

sudo apt install openjdk-17-jdk # require java 17

Build Escargot using gradle:

git submodule update --init third_party
export ANDROID_SDK_ROOT=.... # set your android SDK root first
cd build/android/
./gradlew bundleReleaseAar # build escargot AAR
./gradlew bundleHostJar # bundle jar for host
./gradlew javadocJar # create java doc
./gradlew sourcesJar # create sources jar

./gradlew assembleDebug # build debug test shell
./gradlew :escargot:connectedDebugAndroidTest # run escargot-jni tests on android device
./gradlew :escargot:testDebugUnitTest # run escargot-jni tests on host

Tizen

Escargot is packaged and deployed in Tizen products. The RPM spec supports the Tizen package architectures x86, x64, arm, aarch64, and riscv64, and selects product profiles such as TV, mobile, wearable, and headless through the Tizen build environment.

For a reference GBS build, use the repository's Tizen profile:

git submodule update --init third_party/GCutil
gbs -c .github/workflows/gbs.conf build -A armv7l -P profile.tizen --define "enable_shell 1"

The public CI continuously validates the armv7 package build. Tizen product build and qualification flows use the same RPM packaging integration.

Bare-metal / RTOS

Escargot runs on bare-metal and RTOS targets with no OS underneath (no pthreads, no mmap, no filesystem). Specifying a bare-metal/RTOS target via CMAKE_SYSTEM_NAME (such as Generic, NuttX, FreeRTOS) automatically configures the engine side of this (-DOS_BAREMETAL=1 and friends, ICU/threading defaulted off):

cmake -DCMAKE_SYSTEM_NAME=Generic -DCMAKE_SYSTEM_PROCESSOR=arm ... /path/to/escargot

A full port additionally needs its own small CMake project for BDWGC (third_party/GCutil) and a PlatformRef implementation providing the RTOS's task stack bounds and tick source. See docs/porting/RTOS_PORTING_GUIDE.md for the full checklist and code contract, and samples/rtos/freertos/ for a complete, working in-tree sample (FreeRTOS / Cortex-M55, QEMU mps3-an547) — cross-compiled a

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++javascript-engine

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言