-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Simplify _scriptName
/ scriptDirectory
handling
#24023
base: main
Are you sure you want to change the base?
Conversation
Can you add some info to the PR description. |
Presumably this comes with some code size deltas? |
#if EXPORT_ES6 | ||
_scriptName = typeof __filename != 'undefined' ? __filename : import.meta.url | ||
var _scriptName = import.meta.url; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the declaration of this variable was complete elided previous unless #if SHARED_MEMORY && !MODULARIZE
. Can we not continue to default to not defining it at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea was to always ensure that _scriptName
is defined, so that we can do our scriptDirectory
logic on top of that (which is just new URL('.', _scriptName).href
on the web). Note that _scriptName
was also previously defined in MODULARIZE
mode, but outside the wrapper function.
In EXPORT_ES6
mode it was also previously defined outside the wrapper function, but I moved it to here since storing import.meta.url
there isn't necessary (afaik).
Marking as draft until I've written a PR description and rebasedlined the test expectations. |
6aa59ca
to
0c17b88
Compare
This is an automatic change generated by tools/maint/rebaseline_tests.py. The following (86) test expectation files were updated by running the tests with `--rebaseline`: ``` browser/test_small_js_flags.js.size: 4091 => 4029 [-62 bytes / -1.52%] other/codesize/test_codesize_cxx_ctors1.gzsize: 8243 => 8222 [-21 bytes / -0.25%] other/codesize/test_codesize_cxx_ctors1.jssize: 19969 => 19960 [-9 bytes / -0.05%] other/codesize/test_codesize_cxx_ctors2.gzsize: 8230 => 8211 [-19 bytes / -0.23%] other/codesize/test_codesize_cxx_ctors2.jssize: 19947 => 19938 [-9 bytes / -0.05%] other/codesize/test_codesize_cxx_except.gzsize: 9233 => 9215 [-18 bytes / -0.19%] other/codesize/test_codesize_cxx_except.jssize: 23707 => 23698 [-9 bytes / -0.04%] other/codesize/test_codesize_cxx_except_wasm.gzsize: 8187 => 8168 [-19 bytes / -0.23%] other/codesize/test_codesize_cxx_except_wasm.jssize: 19861 => 19853 [-8 bytes / -0.04%] other/codesize/test_codesize_cxx_except_wasm_legacy.gzsize: 8187 => 8168 [-19 bytes / -0.23%] other/codesize/test_codesize_cxx_except_wasm_legacy.jssize: 19861 => 19853 [-8 bytes / -0.04%] other/codesize/test_codesize_cxx_lto.gzsize: 8259 => 8240 [-19 bytes / -0.23%] other/codesize/test_codesize_cxx_lto.jssize: 20043 => 20035 [-8 bytes / -0.04%] other/codesize/test_codesize_cxx_mangle.gzsize: 9272 => 9256 [-16 bytes / -0.17%] other/codesize/test_codesize_cxx_mangle.jssize: 23821 => 23812 [-9 bytes / -0.04%] other/codesize/test_codesize_cxx_noexcept.gzsize: 8243 => 8222 [-21 bytes / -0.25%] other/codesize/test_codesize_cxx_noexcept.jssize: 19969 => 19960 [-9 bytes / -0.05%] other/codesize/test_codesize_cxx_wasmfs.gzsize: 3424 => 3408 [-16 bytes / -0.47%] other/codesize/test_codesize_cxx_wasmfs.jssize: 7366 => 7356 [-10 bytes / -0.14%] other/codesize/test_codesize_files_js_fs.gzsize: 7540 => 7517 [-23 bytes / -0.31%] other/codesize/test_codesize_files_js_fs.jssize: 18547 => 18538 [-9 bytes / -0.05%] other/codesize/test_codesize_files_wasmfs.gzsize: 2681 => 2656 [-25 bytes / -0.93%] other/codesize/test_codesize_files_wasmfs.jssize: 5749 => 5738 [-11 bytes / -0.19%] other/codesize/test_codesize_hello_O0.gzsize: 7934 => 7915 [-19 bytes / -0.24%] other/codesize/test_codesize_hello_O0.jssize: 21291 => 21294 [+3 bytes / +0.01%] other/codesize/test_codesize_hello_O1.gzsize: 2546 => 2519 [-27 bytes / -1.06%] other/codesize/test_codesize_hello_O1.jssize: 6580 => 6588 [+8 bytes / +0.12%] other/codesize/test_codesize_hello_O2.gzsize: 2202 => 2182 [-20 bytes / -0.91%] other/codesize/test_codesize_hello_O2.jssize: 4542 => 4531 [-11 bytes / -0.24%] other/codesize/test_codesize_hello_O3.gzsize: 2161 => 2140 [-21 bytes / -0.97%] other/codesize/test_codesize_hello_O3.jssize: 4484 => 4473 [-11 bytes / -0.25%] other/codesize/test_codesize_hello_Os.gzsize: 2161 => 2140 [-21 bytes / -0.97%] other/codesize/test_codesize_hello_Os.jssize: 4484 => 4473 [-11 bytes / -0.25%] other/codesize/test_codesize_hello_Oz.gzsize: 2161 => 2140 [-21 bytes / -0.97%] other/codesize/test_codesize_hello_Oz.jssize: 4484 => 4473 [-11 bytes / -0.25%] other/codesize/test_codesize_hello_dylink.gzsize: 5858 => 5841 [-17 bytes / -0.29%] other/codesize/test_codesize_hello_dylink.jssize: 12832 => 12825 [-7 bytes / -0.05%] other/codesize/test_codesize_hello_export_nothing.gzsize: 1577 => 1553 [-24 bytes / -1.52%] other/codesize/test_codesize_hello_export_nothing.jssize: 3415 => 3402 [-13 bytes / -0.38%] other/codesize/test_codesize_hello_single_file.gzsize: 3687 => 3644 [-43 bytes / -1.17%] other/codesize/test_codesize_hello_single_file.jssize: 6779 => 6737 [-42 bytes / -0.62%] other/codesize/test_codesize_hello_wasmfs.gzsize: 2161 => 2140 [-21 bytes / -0.97%] other/codesize/test_codesize_hello_wasmfs.jssize: 4484 => 4473 [-11 bytes / -0.25%] other/codesize/test_codesize_libcxxabi_message_O3.gzsize: 1761 => 1739 [-22 bytes / -1.25%] other/codesize/test_codesize_libcxxabi_message_O3.jssize: 3769 => 3756 [-13 bytes / -0.34%] other/codesize/test_codesize_libcxxabi_message_O3_standalone.gzsize: 1795 => 1773 [-22 bytes / -1.23%] other/codesize/test_codesize_libcxxabi_message_O3_standalone.jssize: 3812 => 3799 [-13 bytes / -0.34%] other/codesize/test_codesize_mem_O3.gzsize: 2214 => 2195 [-19 bytes / -0.86%] other/codesize/test_codesize_mem_O3.jssize: 4640 => 4629 [-11 bytes / -0.24%] other/codesize/test_codesize_mem_O3_grow.gzsize: 2359 => 2343 [-16 bytes / -0.68%] other/codesize/test_codesize_mem_O3_grow.jssize: 4924 => 4913 [-11 bytes / -0.22%] other/codesize/test_codesize_mem_O3_grow_standalone.gzsize: 2056 => 2037 [-19 bytes / -0.92%] other/codesize/test_codesize_mem_O3_grow_standalone.jssize: 4337 => 4324 [-13 bytes / -0.30%] other/codesize/test_codesize_mem_O3_standalone.gzsize: 2018 => 2000 [-18 bytes / -0.89%] other/codesize/test_codesize_mem_O3_standalone.jssize: 4269 => 4257 [-12 bytes / -0.28%] other/codesize/test_codesize_mem_O3_standalone_lib.gzsize: 1792 => 1767 [-25 bytes / -1.40%] other/codesize/test_codesize_mem_O3_standalone_lib.jssize: 3825 => 3812 [-13 bytes / -0.34%] other/codesize/test_codesize_mem_O3_standalone_narg.gzsize: 1795 => 1773 [-22 bytes / -1.23%] other/codesize/test_codesize_mem_O3_standalone_narg.jssize: 3812 => 3799 [-13 bytes / -0.34%] other/codesize/test_codesize_mem_O3_standalone_narg_flto.gzsize: 1795 => 1773 [-22 bytes / -1.23%] other/codesize/test_codesize_mem_O3_standalone_narg_flto.jssize: 3812 => 3799 [-13 bytes / -0.34%] other/codesize/test_codesize_minimal_64.gzsize: 1317 => 1290 [-27 bytes / -2.05%] other/codesize/test_codesize_minimal_64.jssize: 2775 => 2763 [-12 bytes / -0.43%] other/codesize/test_codesize_minimal_O0.gzsize: 6284 => 6265 [-19 bytes / -0.30%] other/codesize/test_codesize_minimal_O0.jssize: 16651 => 16653 [+2 bytes / +0.01%] other/codesize/test_codesize_minimal_O1.gzsize: 1381 => 1352 [-29 bytes / -2.10%] other/codesize/test_codesize_minimal_O1.jssize: 3240 => 3246 [+6 bytes / +0.19%] other/codesize/test_codesize_minimal_O2.gzsize: 1247 => 1221 [-26 bytes / -2.09%] other/codesize/test_codesize_minimal_O2.jssize: 2522 => 2510 [-12 bytes / -0.48%] other/codesize/test_codesize_minimal_O3.gzsize: 1212 => 1187 [-25 bytes / -2.06%] other/codesize/test_codesize_minimal_O3.jssize: 2472 => 2460 [-12 bytes / -0.49%] other/codesize/test_codesize_minimal_Os.gzsize: 1212 => 1187 [-25 bytes / -2.06%] other/codesize/test_codesize_minimal_Os.jssize: 2472 => 2460 [-12 bytes / -0.49%] other/codesize/test_codesize_minimal_Oz-ctors.gzsize: 1197 => 1171 [-26 bytes / -2.17%] other/codesize/test_codesize_minimal_Oz-ctors.jssize: 2451 => 2439 [-12 bytes / -0.49%] other/codesize/test_codesize_minimal_Oz.gzsize: 1212 => 1187 [-25 bytes / -2.06%] other/codesize/test_codesize_minimal_Oz.jssize: 2472 => 2460 [-12 bytes / -0.49%] other/codesize/test_codesize_minimal_esm.gzsize: 1404 => 1301 [-103 bytes / -7.34%] other/codesize/test_codesize_minimal_esm.jssize: 2928 => 2725 [-203 bytes / -6.93%] other/codesize/test_codesize_minimal_pthreads.gzsize: 4043 => 3984 [-59 bytes / -1.46%] other/codesize/test_codesize_minimal_pthreads.jssize: 8379 => 8256 [-123 bytes / -1.47%] other/codesize/test_codesize_minimal_wasmfs.gzsize: 1212 => 1187 [-25 bytes / -2.06%] other/codesize/test_codesize_minimal_wasmfs.jssize: 2472 => 2460 [-12 bytes / -0.49%] other/test_unoptimized_code_size.js.size: 52403 => 52158 [-245 bytes / -0.47%] other/test_unoptimized_code_size_no_asserts.js.size: 27275 => 27030 [-245 bytes / -0.90%] other/test_unoptimized_code_size_strict.js.size: 50557 => 50312 [-245 bytes / -0.48%] Average change: -0.80% (-7.34% - +0.19%) ```
944aaf2
to
89d55ff
Compare
No description provided.