Commit 62024b6
build: create V8 code cache after script is run
This patch makes it possible to generate the code cache
for the builtins directly from the original script object
(instead of compiling a new one) and after the script has
been run (via `NativeModule.require`). Before this patch
only the top level functions (the wrapped ones)
are included in the cache, after this patch the inner
functions in those modules will be included as well.
Also blacklists modules from dependencies like V8 and
node-inspect since we cannot guarantee that they are suitable
to be executed directly.
PR-URL: #21567
Refs: #21563
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>1 parent 67d7a15 commit 62024b6Copy full SHA for 62024b6
File tree
Expand file treeCollapse file tree
4 files changed
+55
-35
lines changedOpen diff view settings
Filter options
- lib/internal/bootstrap
- test/code-cache
- tools
Expand file treeCollapse file tree
4 files changed
+55
-35
lines changedOpen diff view settings
Collapse file
lib/internal/bootstrap/cache.js
Copy file name to clipboardExpand all lines: lib/internal/bootstrap/cache.js+38-11Lines changed: 38 additions & 11 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
9 | 9 | |
10 | 10 | |
11 | 11 | |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
12 | 45 | |
| 46 | + |
| 47 | + |
| 48 | + |
13 | 49 | |
| 50 | + |
14 | 51 | |
15 | 52 | |
16 | 53 | |
17 | 54 | |
18 | 55 | |
19 | 56 | |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | | - |
25 | | - |
26 | | - |
27 | | - |
28 | | - |
29 | | - |
30 | | - |
| 57 | + |
31 | 58 | |
Collapse file
lib/internal/bootstrap/loaders.js
Copy file name to clipboardExpand all lines: lib/internal/bootstrap/loaders.js+8-2Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
118 | 118 | |
119 | 119 | |
120 | 120 | |
| 121 | + |
121 | 122 | |
122 | 123 | |
123 | 124 | |
| ||
165 | 166 | |
166 | 167 | |
167 | 168 | |
| 169 | + |
| 170 | + |
| 171 | + |
| 172 | + |
168 | 173 | |
169 | 174 | |
170 | 175 | |
171 | | - |
172 | | - |
| 176 | + |
173 | 177 | |
174 | 178 | |
175 | 179 | |
| ||
241 | 245 | |
242 | 246 | |
243 | 247 | |
| 248 | + |
| 249 | + |
244 | 250 | |
245 | 251 | |
246 | 252 | |
|
Collapse file
test/code-cache/test-code-cache.js
Copy file name to clipboardExpand all lines: test/code-cache/test-code-cache.js+2-4Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
12 | 12 | |
13 | 13 | |
14 | 14 | |
15 | | - |
| 15 | + |
16 | 16 | |
17 | | - |
18 | 17 | |
19 | 18 | |
20 | 19 | |
| ||
35 | 34 | |
36 | 35 | |
37 | 36 | |
38 | | - |
39 | | - |
| 37 | + |
40 | 38 | |
41 | 39 | |
42 | 40 | |
Collapse file
tools/generate_code_cache.js
Copy file name to clipboardExpand all lines: tools/generate_code_cache.js+7-18Lines changed: 7 additions & 18 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
8 | 8 | |
9 | 9 | |
10 | 10 | |
11 | | - |
12 | | - |
13 | | - |
| 11 | + |
| 12 | + |
14 | 13 | |
15 | 14 | |
16 | | - |
17 | 15 | |
18 | 16 | |
19 | 17 | |
| ||
72 | 70 | |
73 | 71 | |
74 | 72 | |
75 | | - |
76 | | - |
77 | | - |
78 | | - |
79 | | - |
80 | | - |
81 | | - |
82 | | - |
83 | | - |
84 | | - |
85 | | - |
86 | | - |
| 73 | + |
| 74 | + |
| 75 | + |
87 | 76 | |
88 | 77 | |
89 | 78 | |
90 | 79 | |
91 | | - |
| 80 | + |
92 | 81 | |
93 | | - |
| 82 | + |
94 | 83 | |
95 | 84 | |
96 | 85 | |
|
0 commit comments