Hermes JavaScript Engine

repository·static_h·Indexed 11 days ago

https://github.com/facebook/hermes

A JavaScript engine optimized for fast start-up of React Native applications, featuring ahead-of-time static optimization and compact bytecode. Version 0.12.0 includes the agent-perf infrastructure for performance analysis, featuring tools for statistical A/B benchmarking, deterministic instruction counting, binary size comparison, and C++ and JavaScript anti-pattern scanning.

Tokens
105.9K
Snippets
266
Records
519
Agent score
93%

What's inside Hermes

  1. Overview of the hermes_utils crate

    static_h

    The hermes_utils crate serves as a centralized collection of utility functions and helper code within the Hermes project. It is designed to be a low-level dependency used by many other crates in the workspace.

    Dependency Rule for Contributors: To maintain a clean dependency graph, hermes_utils should generally not depend on other workspace crates. If a utility requires types or logic from another specific crate in the project, that utility should instead be placed within the crate that requires it, rather than being moved to hermes_utils.

  2. Overview of hermes_estree

    static_h

    The hermes_estree crate provides a Rust implementation of the ESTree format. It is designed to represent standard ESTree structures along with popular extensions such as JSX and (planned) support for Flow and TypeScript.

    Key features include:

    • Cross-toolchain compatibility: Designed for use in both Rust-based toolchains and JavaScript-based toolchains.
    • Accurate Serialization: The format is engineered to support precise serialization to and from ESTree-compatible JSON, ensuring interoperability with existing JavaScript tooling.
  3. Overview of hermes_diagnostics

    static_h

    The hermes_diagnostics crate provides types for representing compiler diagnostics. It offers a general-purpose representation of diagnostic information that can be converted into miette::Diagnostic to leverage miette's pretty-printing capabilities for errors.

    A key feature of hermes_diagnostics is its categorization of error severities. Unlike other diagnostic libraries (such as lsp_types or miette), severities are categorized to allow different tools to decide how to report or filter them. For example, a tool can choose to report specific 'todo' errors while ignoring others.

  4. What is the AsmJit Instruction Database?

    static_h
    The AsmJit Instruction Database is a collection of instruction definitions used by AsmJit to generate its internal database and assembler implementations. The database is designed for high maintainability, where each instruction is defined by a single line in a JSON data file. This data is subsequently processed by architecture-specific readers to produce canonical instruction data.
  5. Overview of Octane Benchmarks

    static_h
    The Octane benchmarks in this directory are modified versions of the original Octane repository. To ensure each benchmark is individually complete and executable within the Hermes environment, the source files have been restructured. Each file is prefixed with the original base.js and contains all necessary dependencies to run standalone.
  6. Overview of the SQLite3 read benchmark

    static_h

    The sqlite-read benchmark measures the performance difference between reading an SQLite3 database into memory using native C++ versus using Static Hermes.

    To maintain focus on the memory-reading performance, the actual SQLite3 API is mocked via a simplified implementation in sqmock.cpp that only implements a subset of the standard SQLite3 APIs.

  7. Overview of hermes_semantic_analysis

    static_h

    The hermes_semantic_analysis crate provides tools for performing semantic analysis on JavaScript code. Specifically, it implements name resolution and scope information analysis by operating over the hermes_estree Abstract Syntax Tree (AST).

    Key Capabilities:

    • JavaScript name resolution.
    • Scope information extraction.
    • Support for core JS and JSX (with future plans to extend to Flow and TypeScript).

    Important Limitation:

    • This analysis assumes strict mode. It does not support legacy non-strict JavaScript semantics.
  8. Overview of Esprima features

    static_h

    Esprima is a high-performance, standard-compliant ECMAScript parser. Key capabilities include:

    • ECMAScript Support: Full support for ECMAScript 2017 (ECMA-262 8th Edition).
    • AST Format: Produces a syntax tree format standardized by the ESTree project.
    • JSX Support: Includes experimental support for JSX syntax extensions used by React.
    • Location Tracking: Provides optional tracking of syntax node locations using both index-based and line-column formats.
  9. Overview of Node-API Conformance Test Suite (`node-api-cts`)

    static_h

    The node-api-cts is a test suite designed for implementors of Node-API across various JavaScript engines and runtimes. It is written using ECMAScript and C/C++ and provides a harness that can be customized by the implementor.

    Note: This project is currently a work-in-progress and is not yet recommended for production reliance.