From 059783666813fa65cd28f7543638828247af8184 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Fri, 8 Nov 2024 11:24:28 -0800 Subject: [PATCH] Cleanup emSetImmediate/emCleaImmediate. NFC This change avoids the extra dummy library entry `polyfillSetImmediate`. --- src/library_eventloop.js | 20 ++++++++----------- .../codesize/test_codesize_hello_O0.gzsize | 2 +- .../codesize/test_codesize_hello_O0.jssize | 2 +- .../codesize/test_codesize_minimal_O0.gzsize | 2 +- .../codesize/test_codesize_minimal_O0.jssize | 2 +- test/other/test_unoptimized_code_size.js.size | 2 +- .../test_unoptimized_code_size_strict.js.size | 2 +- 7 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/library_eventloop.js b/src/library_eventloop.js index 73b7bba938e5d..cd95eb3717a39 100644 --- a/src/library_eventloop.js +++ b/src/library_eventloop.js @@ -52,10 +52,8 @@ LibraryJSEventLoop = { setImmediateWrapped.mapping[id] = undefined; }, - $polyfillSetImmediate__deps: ['$setImmediateWrapped', '$clearImmediateWrapped'], - $polyfillSetImmediate__postset: ` - var emSetImmediate; - var emClearImmediate; + $emSetImmediate__deps: ['$setImmediateWrapped', '$clearImmediateWrapped', '$emClearImmediate'], + $emSetImmediate__postset: ` if (typeof setImmediate != "undefined") { emSetImmediate = setImmediateWrapped; emClearImmediate = clearImmediateWrapped; @@ -82,14 +80,12 @@ LibraryJSEventLoop = { if (index >= 0 && index < __setImmediate_queue.length) __setImmediate_queue[index] = () => {}; }) }`, + $emSetImmediate: undefined, - $polyfillSetImmediate: () => { - // nop, used for its postset to ensure setImmediate() polyfill is - // not duplicated between emscripten_set_immediate() and - // emscripten_set_immediate_loop() if application links to both of them. - }, + $emClearImmediate_deps: ['$emSetImmediate'], + $emClearImmediate: undefined, - emscripten_set_immediate__deps: ['$polyfillSetImmediate', '$callUserCallback'], + emscripten_set_immediate__deps: ['$emSetImmediate', '$callUserCallback'], emscripten_set_immediate: (cb, userData) => { {{{ runtimeKeepalivePush(); }}} return emSetImmediate(() => { @@ -98,13 +94,13 @@ LibraryJSEventLoop = { }); }, - emscripten_clear_immediate__deps: ['$polyfillSetImmediate'], + emscripten_clear_immediate__deps: ['$emClearImmediate'], emscripten_clear_immediate: (id) => { {{{ runtimeKeepalivePop(); }}} emClearImmediate(id); }, - emscripten_set_immediate_loop__deps: ['$polyfillSetImmediate', '$callUserCallback'], + emscripten_set_immediate_loop__deps: ['$emSetImmediate', '$callUserCallback'], emscripten_set_immediate_loop: (cb, userData) => { function tick() { callUserCallback(() => { diff --git a/test/other/codesize/test_codesize_hello_O0.gzsize b/test/other/codesize/test_codesize_hello_O0.gzsize index eb1d570cd3486..b1449acbaabed 100644 --- a/test/other/codesize/test_codesize_hello_O0.gzsize +++ b/test/other/codesize/test_codesize_hello_O0.gzsize @@ -1 +1 @@ -7905 +7913 diff --git a/test/other/codesize/test_codesize_hello_O0.jssize b/test/other/codesize/test_codesize_hello_O0.jssize index ca24f1eeac3f6..9ca615af52eb8 100644 --- a/test/other/codesize/test_codesize_hello_O0.jssize +++ b/test/other/codesize/test_codesize_hello_O0.jssize @@ -1 +1 @@ -21012 +21045 diff --git a/test/other/codesize/test_codesize_minimal_O0.gzsize b/test/other/codesize/test_codesize_minimal_O0.gzsize index 8ce186d95f541..536a5fa692079 100644 --- a/test/other/codesize/test_codesize_minimal_O0.gzsize +++ b/test/other/codesize/test_codesize_minimal_O0.gzsize @@ -1 +1 @@ -6443 +6449 diff --git a/test/other/codesize/test_codesize_minimal_O0.jssize b/test/other/codesize/test_codesize_minimal_O0.jssize index 53b0d1202080f..d925085b05f33 100644 --- a/test/other/codesize/test_codesize_minimal_O0.jssize +++ b/test/other/codesize/test_codesize_minimal_O0.jssize @@ -1 +1 @@ -17061 +17094 diff --git a/test/other/test_unoptimized_code_size.js.size b/test/other/test_unoptimized_code_size.js.size index 43d94fe09cb52..a0fed1c48a5f1 100644 --- a/test/other/test_unoptimized_code_size.js.size +++ b/test/other/test_unoptimized_code_size.js.size @@ -1 +1 @@ -52855 +52898 diff --git a/test/other/test_unoptimized_code_size_strict.js.size b/test/other/test_unoptimized_code_size_strict.js.size index fd424a6af5731..185191061e0f4 100644 --- a/test/other/test_unoptimized_code_size_strict.js.size +++ b/test/other/test_unoptimized_code_size_strict.js.size @@ -1 +1 @@ -51638 +51681