Commit e262e31
committed
src: compile code eagerly in snapshot builder
By default V8 only compiles the top-level function and
skips code generation for inner functions - that would
only be done when those inner functions are invoked.
Since builtins are compiled as wrapped functions, most
functions that look visually top-level are not actually
included in the built-in code cache. For most of the
builtins this is not too bad because usually only a subset of
all builtin functions are needed by a particular
application and including all their code in the binary
would incur an unnecessary size overhead. But there is also
a subset of more commonly used builtins and it would be
better to include the inner functions in the built-in
code cache because they are more universally used by
most applications.
This patch changes the compilation strategy to eager compilation
(including inner functions) for the following scripts:
1. Primordials (internal/per_context/*), in all situations.
2. Bootstrap scripts (internal/bootstrap/*) and main scripts
(internal/main/*), when being compiled for built-in code
cache.
3. Any scripts loaded during built-in snapshot generation.
With this patch the binary size increases by about 1.2MB (~1%
increase) in return the startup of --version command of bundled
CLIs and the core startup of processes are 2-4% faster and
worker startup can be 10-12% faster.1 parent fc80168 commit e262e31
File tree
5 files changed
+81
-18
lines changed- src
- api
5 files changed
+81
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
802 | 802 | | |
803 | 803 | | |
804 | 804 | | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
805 | 808 | | |
806 | 809 | | |
807 | 810 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
827 | 827 | | |
828 | 828 | | |
829 | 829 | | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
830 | 839 | | |
831 | 840 | | |
832 | 841 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
289 | 296 | | |
290 | 297 | | |
291 | 298 | | |
292 | 299 | | |
293 | 300 | | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
298 | 307 | | |
299 | 308 | | |
300 | 309 | | |
| |||
481 | 490 | | |
482 | 491 | | |
483 | 492 | | |
484 | | - | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
485 | 497 | | |
486 | 498 | | |
487 | 499 | | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
488 | 506 | | |
489 | 507 | | |
| 508 | + | |
490 | 509 | | |
491 | 510 | | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
492 | 520 | | |
493 | 521 | | |
494 | 522 | | |
| |||
503 | 531 | | |
504 | 532 | | |
505 | 533 | | |
506 | | - | |
507 | | - | |
508 | 534 | | |
509 | | - | |
510 | 535 | | |
511 | 536 | | |
512 | 537 | | |
513 | 538 | | |
| 539 | + | |
514 | 540 | | |
515 | 541 | | |
516 | 542 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | 10 | | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
115 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
116 | 119 | | |
117 | | - | |
118 | 120 | | |
119 | 121 | | |
120 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
121 | 127 | | |
122 | 128 | | |
123 | 129 | | |
| |||
126 | 132 | | |
127 | 133 | | |
128 | 134 | | |
129 | | - | |
130 | | - | |
131 | 135 | | |
132 | 136 | | |
133 | 137 | | |
| |||
179 | 183 | | |
180 | 184 | | |
181 | 185 | | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
182 | 197 | | |
183 | 198 | | |
184 | 199 | | |
| |||
188 | 203 | | |
189 | 204 | | |
190 | 205 | | |
| 206 | + | |
191 | 207 | | |
192 | 208 | | |
193 | 209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1069 | 1069 | | |
1070 | 1070 | | |
1071 | 1071 | | |
1072 | | - | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
1073 | 1076 | | |
1074 | 1077 | | |
1075 | | - | |
1076 | 1078 | | |
1077 | 1079 | | |
1078 | 1080 | | |
| |||
1098 | 1100 | | |
1099 | 1101 | | |
1100 | 1102 | | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
1101 | 1106 | | |
1102 | 1107 | | |
1103 | 1108 | | |
| |||
1176 | 1181 | | |
1177 | 1182 | | |
1178 | 1183 | | |
1179 | | - | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
1180 | 1190 | | |
1181 | | - | |
1182 | | - | |
| 1191 | + | |
1183 | 1192 | | |
1184 | 1193 | | |
1185 | 1194 | | |
| |||
0 commit comments