Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v11.x backport] src: simplify NativeModule caching and remove redundant data #25964

Closed

Commits on Feb 6, 2019

  1. src: simplify NativeModule caching and remove redundant data

    - Remove `NativeModule._source` - the compilation is now entirely
      done in C++ and `process.binding('natives')` is implemented
      directly in the binding loader so there is no need to store
      additional source code strings.
    - Instead of using an object as `NativeModule._cached` and insert
      into it after compilation of each native module, simply prebuild
      a JS map filled with all the native modules and infer the
      state of compilation through `mod.loading`/`mod.loaded`.
    - Rename `NativeModule.nonInternalExists` to
      `NativeModule.canBeRequiredByUsers` and precompute that
      property for all the native modules during bootstrap instead
      of branching in every require call during runtime. This also fixes
      the bug where `worker_threads` can be made available with
      `--expose-internals`.
    - Rename `NativeModule.requireForDeps` to
      `NativeModule.requireWithFallbackInDeps`.
    - Add a test to make sure we do not accidentally leak any module
      to the global namespace.
    
    PR-URL: nodejs#25352
    Reviewed-By: Anna Henningsen <anna@addaleax.net>
    joyeecheung authored and antsmartian committed Feb 6, 2019
    Configuration menu
    Copy the full SHA
    7dd4e41 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c5a7fed View commit details
    Browse the repository at this point in the history