Skip to content

Commit 25b9ac1

Browse files
committed
Remove POLYFILL_OLD_MATH_FUNCTIONS setting
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.
1 parent 5a8d9e5 commit 25b9ac1

File tree

7 files changed

+5
-81
lines changed

7 files changed

+5
-81
lines changed

ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ See docs/process.md for more on how version tagging works.
4848
`--post-js` files will now be delayed until after module creation and after
4949
`main` runs. This matches the existing behaviour when using sync instantation
5050
(`-sWASM_ASYNC_COMPILATION=0`) but is an observable difference. (#23157)
51+
- The `POLYFILL_OLD_MATH_FUNCTIONS` setting was removed. The browser versions
52+
that require these polyfills are no longer supported by emscripten so the
53+
polyfills should never be needed. (#23262)
5154

5255
3.1.74 - 12/14/24
5356
-----------------

site/source/docs/tools_reference/settings_reference.rst

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -959,25 +959,14 @@ can also vary between browsers.
959959

960960
Default value: false
961961

962-
.. _polyfill_old_math_functions:
963-
964-
POLYFILL_OLD_MATH_FUNCTIONS
965-
===========================
966-
967-
If set, enables polyfilling for Math.clz32, Math.trunc, Math.imul, Math.fround.
968-
969-
Default value: false
970-
971962
.. _legacy_vm_support:
972963

973964
LEGACY_VM_SUPPORT
974965
=================
975966

976-
Set this to enable compatibility emulations for old JavaScript engines. This gives you
977967
the highest possible probability of the code working everywhere, even in rare old
978968
browsers and shell environments. Specifically:
979969

980-
- Add polyfilling for Math.clz32, Math.trunc, Math.imul, Math.fround. (-sPOLYFILL_OLD_MATH_FUNCTIONS)
981970
- Disable WebAssembly. (Must be paired with -sWASM=0)
982971
- Adjusts MIN_X_VERSION settings to 0 to include support for all browser versions.
983972
- Avoid TypedArray.fill, if necessary, in zeroMemory utility function.

src/preamble.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,6 @@ function addOnPostRun(cb) {
324324
__ATPOSTRUN__.unshift(cb);
325325
}
326326

327-
#include "runtime_math.js"
328-
329327
// A counter of dependencies for calling run(). If we need to
330328
// do asynchronous work before running, increment this and
331329
// decrement it. Incrementing must happen in a place like

src/preamble_minimal.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ var runtimeExited = false;
8585
var runtimeInitialized = false;
8686
#endif
8787

88-
#include "runtime_math.js"
8988
#include "memoryprofiler.js"
9089
#include "runtime_exceptions.js"
9190
#include "runtime_debug.js"

src/runtime_math.js

Lines changed: 0 additions & 53 deletions
This file was deleted.

src/settings.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -619,15 +619,9 @@ var GL_ENABLE_GET_PROC_ADDRESS = true;
619619
// [link]
620620
var JS_MATH = false;
621621

622-
// If set, enables polyfilling for Math.clz32, Math.trunc, Math.imul, Math.fround.
623-
// [link]
624-
var POLYFILL_OLD_MATH_FUNCTIONS = false;
625-
626-
// Set this to enable compatibility emulations for old JavaScript engines. This gives you
627622
// the highest possible probability of the code working everywhere, even in rare old
628623
// browsers and shell environments. Specifically:
629624
//
630-
// - Add polyfilling for Math.clz32, Math.trunc, Math.imul, Math.fround. (-sPOLYFILL_OLD_MATH_FUNCTIONS)
631625
// - Disable WebAssembly. (Must be paired with -sWASM=0)
632626
// - Adjusts MIN_X_VERSION settings to 0 to include support for all browser versions.
633627
// - Avoid TypedArray.fill, if necessary, in zeroMemory utility function.
@@ -1919,7 +1913,7 @@ var MIN_SAFARI_VERSION = 140100;
19191913
// numbers with Chrome.
19201914
// Chrome 85 was released on 2020-08-25.
19211915
// MAX_INT (0x7FFFFFFF, or -1) specifies that target is not supported.
1922-
// Minimum supported value is 33, which was released on 2014-02-18.
1916+
// Minimum supported value is 38, which was released on 2014-10-07.
19231917
// [link]
19241918
var MIN_CHROME_VERSION = 85;
19251919

@@ -2267,4 +2261,5 @@ var LEGACY_SETTINGS = [
22672261
['MIN_IE_VERSION', [0x7FFFFFFF], 'No longer supported'],
22682262
['WORKAROUND_OLD_WEBGL_UNIFORM_UPLOAD_IGNORED_OFFSET_BUG', [0], 'No longer supported'],
22692263
['AUTO_ARCHIVE_INDEXES', [0, 1], 'No longer needed'],
2264+
['POLYFILL_OLD_MATH_FUNCTIONS', [0], 'No longer supported'],
22702265
];

tools/link.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,9 +1157,6 @@ def phase_linker_setup(options, state, newargs): # noqa: C901, PLR0912, PLR0915
11571157
if settings.MINIMAL_RUNTIME and options.oformat == OFormat.HTML and not settings.PTHREADS:
11581158
settings.USE_READY_PROMISE = 0
11591159

1160-
if settings.WASM2JS and settings.LEGACY_VM_SUPPORT:
1161-
settings.POLYFILL_OLD_MATH_FUNCTIONS = 1
1162-
11631160
check_browser_versions()
11641161

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

1205-
# Silently drop any individual backwards compatibility emulation flags that are known never to occur on browsers that support WebAssembly.
1206-
if not settings.WASM2JS:
1207-
settings.POLYFILL_OLD_MATH_FUNCTIONS = 0
1208-
12091202
if settings.STB_IMAGE:
12101203
state.append_link_flag('-lstb_image')
12111204
settings.EXPORTED_FUNCTIONS += ['_stbi_load', '_stbi_load_from_memory', '_stbi_image_free']

0 commit comments

Comments
 (0)