Skip to content

Commit

Permalink
[wasm64] Remove temporary toIndexType workaround
Browse files Browse the repository at this point in the history
Now the firefox and chrome both use BigInt for indexing 64-bit memories
and tables this workaround is no longer needed.
  • Loading branch information
sbc100 committed Oct 22, 2024
1 parent f88c213 commit 0dd9f78
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 20 deletions.
3 changes: 1 addition & 2 deletions src/parseTools.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -964,8 +964,7 @@ function from64Expr(x, assign = true) {
}

function toIndexType(x) {
if (MEMORY64 != 1) return x;
return `toIndexType(${x})`;
return to64(x);
}

function to64(x) {
Expand Down
16 changes: 0 additions & 16 deletions src/runtime_shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,6 @@ function updateMemoryViews() {
#endif
}

#if MEMORY64 == 1
var toIndexType = (function() {
// Probe for support of bigint bounds with memory64.
// TODO(sbc): Remove this once all browsers start requiring bigint here.
// See https://github.com/WebAssembly/memory64/issues/68
var bigintMemoryBounds = 1;
try {
/** @suppress {checkTypes} */
new WebAssembly.Memory({'initial': 1n, 'index': 'i64'});
} catch (e) {
bigintMemoryBounds = 0;
}
return (i) => bigintMemoryBounds ? BigInt(i) : i;
})();
#endif

#if ENVIRONMENT_MAY_BE_NODE && MIN_NODE_VERSION < 160000
// The performance global was added to node in v16.0.0:
// https://nodejs.org/api/globals.html#performance
Expand Down
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_minimal_64.gzsize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1579
1517
2 changes: 1 addition & 1 deletion test/other/codesize/test_codesize_minimal_64.jssize
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3257
3139

0 comments on commit 0dd9f78

Please sign in to comment.