Skip to content

Commit

Permalink
Remove POLYFILL_OLD_MATH_FUNCTIONS setting
Browse files Browse the repository at this point in the history
These polyfills are only needed on ancient browser versions that there
should be no need to support.

This change bumps out minimum required chrome version from 33 to 38.
  • Loading branch information
sbc100 committed Dec 31, 2024
1 parent b682a38 commit 3ab7eaf
Show file tree
Hide file tree
Showing 13 changed files with 10 additions and 84 deletions.
3 changes: 3 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ See docs/process.md for more on how version tagging works.
`--post-js` files will now be delayed until after module creation and after
`main` runs. This matches the existing behaviour when using sync instantation
(`-sWASM_ASYNC_COMPILATION=0`) but is an observable difference. (#23157)
- The `POLYFILL_OLD_MATH_FUNCTIONS` setting was removed. The browser versions
that require these polyfills are no longer supported by emscripten so the
polyfills should never be needed. (#23262)

3.1.74 - 12/14/24
-----------------
Expand Down
2 changes: 0 additions & 2 deletions src/preamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,6 @@ function addOnPostRun(cb) {
__ATPOSTRUN__.unshift(cb);
}

#include "runtime_math.js"

// A counter of dependencies for calling run(). If we need to
// do asynchronous work before running, increment this and
// decrement it. Incrementing must happen in a place like
Expand Down
1 change: 0 additions & 1 deletion src/preamble_minimal.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ var runtimeExited = false;
var runtimeInitialized = false;
#endif

#include "runtime_math.js"
#include "memoryprofiler.js"
#include "runtime_exceptions.js"
#include "runtime_debug.js"
Expand Down
53 changes: 0 additions & 53 deletions src/runtime_math.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_hello_O0.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8012
7891
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_hello_O0.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
21588
21016
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_minimal_O0.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6554
6435
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_minimal_O0.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17637
17061
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
53887
52851
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size_no_asserts.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
29086
28642
2 changes: 1 addition & 1 deletion test/other/test_unoptimized_code_size_strict.js.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
52670
51634
14 changes: 0 additions & 14 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -4908,20 +4908,6 @@ def test_precompiled_headers(self, suffix):
output = self.run_js('a.out.js')
self.assertContained('|5|', output)

def test_LEGACY_VM_SUPPORT(self):
# when modern features are lacking, we can polyfill them or at least warn
create_file('pre.js', 'Math.imul = undefined;')

def test(expected, opts):
print(opts)
self.run_process([EMCC, test_file('hello_world.c'), '--pre-js', 'pre.js'] + opts)
self.assertContained(expected, self.run_js('a.out.js', assert_returncode=0 if opts else NON_ZERO))

# when legacy is needed, we show an error indicating so
test('build with LEGACY_VM_SUPPORT', [])
# legacy + disabling wasm works
test('hello, world!', ['-sLEGACY_VM_SUPPORT', '-sWASM=0'])

@crossplatform
def test_on_abort(self):
expected_output = 'Module.onAbort was called'
Expand Down
7 changes: 0 additions & 7 deletions tools/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -1157,9 +1157,6 @@ def phase_linker_setup(options, state, newargs): # noqa: C901, PLR0912, PLR0915
if settings.MINIMAL_RUNTIME and options.oformat == OFormat.HTML and not settings.PTHREADS:
settings.USE_READY_PROMISE = 0

if settings.WASM2JS and settings.LEGACY_VM_SUPPORT:
settings.POLYFILL_OLD_MATH_FUNCTIONS = 1

check_browser_versions()

if settings.MIN_NODE_VERSION >= 150000:
Expand Down Expand Up @@ -1202,10 +1199,6 @@ def phase_linker_setup(options, state, newargs): # noqa: C901, PLR0912, PLR0915
diagnostics.warning('transpile', '-sEXCEPTION_STACK_TRACES requires an engine that support ES6 classes.')
settings.EXCEPTION_STACK_TRACES = 0

# Silently drop any individual backwards compatibility emulation flags that are known never to occur on browsers that support WebAssembly.
if not settings.WASM2JS:
settings.POLYFILL_OLD_MATH_FUNCTIONS = 0

if settings.STB_IMAGE:
state.append_link_flag('-lstb_image')
settings.EXPORTED_FUNCTIONS += ['_stbi_load', '_stbi_load_from_memory', '_stbi_image_free']
Expand Down

0 comments on commit 3ab7eaf

Please sign in to comment.