Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2178f17

Browse filesBrowse files
joyeecheungdanielleadams
authored andcommitted
bootstrap: support more builtins in the embedded code cache
This patch: - Make NativeModuleLoader::LookupAndCompile() detect parameters based on module IDs. This allows us to compile more builtins when generating the embedded bootstrap, including - internal/per_context/* - internal/bootstrap/* - internal/main/* - Move pre_execution.js to lib/internal/process as it needs to be compiled as a regular built-in module, unlike other scripts in lib/internal/bootstrap - Move markBootstrapComplete() to the performance binding instead of making it a function-wrapper-based global to reduce number of special cases. PR-URL: #44018 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent 6cfb1ac commit 2178f17
Copy full SHA for 2178f17
Expand file treeCollapse file tree

27 files changed

+156
-137
lines changed
Open diff view settings
Collapse file

‎lib/internal/bootstrap/loaders.js‎

Copy file name to clipboardExpand all lines: lib/internal/bootstrap/loaders.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,8 @@ class NativeModule {
326326
requireWithFallbackInDeps : nativeModuleRequire;
327327

328328
const fn = compileFunction(id);
329+
// Arguments must match the parameters specified in
330+
// NativeModuleLoader::LookupAndCompile().
329331
fn(this.exports, requireFn, this, process, internalBinding, primordials);
330332

331333
this.loaded = true;
Collapse file

‎lib/internal/bootstrap/node.js‎

Copy file name to clipboardExpand all lines: lib/internal/bootstrap/node.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77
// This file is expected not to perform any asynchronous operations itself
88
// when being executed - those should be done in either
9-
// `lib/internal/bootstrap/pre_execution.js` or in main scripts. The majority
9+
// `lib/internal/process/pre_execution.js` or in main scripts. The majority
1010
// of the code here focuses on setting up the global proxy and the process
1111
// object in a synchronous manner.
1212
// As special caution is given to the performance of the startup process,
@@ -28,7 +28,7 @@
2828
// Then, depending on how the Node.js instance is launched, one of the main
2929
// scripts in `lib/internal/main` will be selected by C++ to start the actual
3030
// execution. They may run additional setups exported by
31-
// `lib/internal/bootstrap/pre_execution.js` depending on the runtime states.
31+
// `lib/internal/process/pre_execution.js` depending on the runtime states.
3232

3333
'use strict';
3434

Collapse file

‎lib/internal/main/.eslintrc.yaml‎

Copy file name to clipboardExpand all lines: lib/internal/main/.eslintrc.yaml
-2Lines changed: 0 additions & 2 deletions
This file was deleted.
Collapse file

‎lib/internal/main/check_syntax.js‎

Copy file name to clipboardExpand all lines: lib/internal/main/check_syntax.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44
// instead of actually running the file.
55

66
const {
7-
prepareMainThreadExecution
8-
} = require('internal/bootstrap/pre_execution');
7+
prepareMainThreadExecution,
8+
markBootstrapComplete
9+
} = require('internal/process/pre_execution');
910

1011
const {
1112
readStdin
Collapse file
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
// that depends on run time states.
55
// It is currently only intended for preparing contexts for embedders.
66

7-
/* global markBootstrapComplete */
87
const {
9-
prepareMainThreadExecution
10-
} = require('internal/bootstrap/pre_execution');
8+
prepareMainThreadExecution,
9+
markBootstrapComplete
10+
} = require('internal/process/pre_execution');
1111

1212
prepareMainThreadExecution();
1313
markBootstrapComplete();
Collapse file

‎lib/internal/main/eval_stdin.js‎

Copy file name to clipboardExpand all lines: lib/internal/main/eval_stdin.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
// Stdin is not a TTY, we will read it and execute it.
44

55
const {
6-
prepareMainThreadExecution
7-
} = require('internal/bootstrap/pre_execution');
6+
prepareMainThreadExecution,
7+
markBootstrapComplete
8+
} = require('internal/process/pre_execution');
89

910
const { getOptionValue } = require('internal/options');
1011

Collapse file

‎lib/internal/main/eval_string.js‎

Copy file name to clipboardExpand all lines: lib/internal/main/eval_string.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ const {
88
} = primordials;
99

1010
const {
11-
prepareMainThreadExecution
12-
} = require('internal/bootstrap/pre_execution');
11+
prepareMainThreadExecution,
12+
markBootstrapComplete
13+
} = require('internal/process/pre_execution');
1314
const { evalModule, evalScript } = require('internal/process/execution');
1415
const { addBuiltinLibsToObject } = require('internal/modules/cjs/helpers');
1516

Collapse file

‎lib/internal/main/inspect.js‎

Copy file name to clipboardExpand all lines: lib/internal/main/inspect.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
// `node inspect ...` or `node debug ...`
44

55
const {
6-
prepareMainThreadExecution
7-
} = require('internal/bootstrap/pre_execution');
6+
prepareMainThreadExecution,
7+
markBootstrapComplete
8+
} = require('internal/process/pre_execution');
89

910
prepareMainThreadExecution();
1011

Collapse file

‎lib/internal/main/mksnapshot.js‎

Copy file name to clipboardExpand all lines: lib/internal/main/mksnapshot.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function requireForUserSnapshot(id) {
114114
function main() {
115115
const {
116116
prepareMainThreadExecution
117-
} = require('internal/bootstrap/pre_execution');
117+
} = require('internal/process/pre_execution');
118118

119119
prepareMainThreadExecution(true, false);
120120

Collapse file

‎lib/internal/main/print_help.js‎

Copy file name to clipboardExpand all lines: lib/internal/main/print_help.js
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ const { types } = internalBinding('options');
2020
const hasCrypto = Boolean(process.versions.openssl);
2121

2222
const {
23-
prepareMainThreadExecution
24-
} = require('internal/bootstrap/pre_execution');
23+
prepareMainThreadExecution,
24+
markBootstrapComplete
25+
} = require('internal/process/pre_execution');
2526

2627
const typeLookup = [];
2728
for (const key of ObjectKeys(types))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.