Uh oh!
There was an error while loading. Please reload this page.
src: simplify NativeModule caching and remove redudant data - #25352
Closed
joyeecheung wants to merge 2 commits into
Closed
src: simplify NativeModule caching and remove redudant data#25352joyeecheung wants to merge 2 commits into
joyeecheung wants to merge 2 commits into
Conversation
mscdex
commented
Jan 5, 2019
Contributor
Typo in commit message: s/redudant/redundant/ |
joyeecheung
commented
Jan 5, 2019
MemberAuthor
addaleax
approved these changes
Jan 5, 2019
Uh oh!
There was an error while loading. Please reload this page.
4 tasks
- 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.
- Rename `NativeModule.requireForDeps` to
`NativeModule.requireWithFallbackInDeps`.
- Add a test to make sure we do not accidentally leak any module
to the global namespace.joyeecheungforce-pushed
the
refactor-native
branch
from
January 9, 2019 15:45
9f0bbce to
ffaf389Comparejoyeecheung
commented
Jan 9, 2019
MemberAuthor
joyeecheung
commented
Jan 12, 2019
MemberAuthor
Landed in 92e95f1 |
joyeecheung added a commit
that referenced
this pull request
Jan 12, 2019
- 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: #25352
Reviewed-By: Anna Henningsen <anna@addaleax.net>4 tasks
addaleax
commented
Jan 15, 2019
Member
@joyeecheung Can you look into backporting this to v11.x-staging? |
Member
Seems like this requires a closer look. |
BridgeAR
commented
Jan 16, 2019
Member
This should be backported along #25481. |
addaleax
commented
Jan 23, 2019
Member
ping @joyeecheung |
antsmartian pushed a commit
to antsmartian/node
that referenced
this pull request
Feb 6, 2019
- 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>4 tasks
addaleax pushed a commit
that referenced
this pull request
Feb 9, 2019
- 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.
Backport-PR-URL: #25964
PR-URL: #25352
Reviewed-By: Anna Henningsen <anna@addaleax.net> Merged
This was referenced Feb 15, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
NativeModule._source- the compilation is now entirelydone in C++ and
process.binding('natives')is implementeddirectly in the binding loader so there is no need to store
additional source code strings.
NativeModule._cachedand insertinto 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.NativeModule.nonInternalExiststoNativeModule.canBeRequiredByUsersand precompute thatproperty for all the native modules during bootstrap instead
of branching in every require call during runtime. This also fixes
the bug where
worker_threadscan be made available with--expose-internalsNativeModule.requireForDepstoNativeModule.requireWithFallbackInDeps.to the global namespace.
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes