Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16339 from Liamolucko/wasm-i64
Add `i64` to the set of JS-compatible wasm types in `syncWebAssembly` mode
- Loading branch information
Showing
9 changed files
with
38 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
it("should allow to run a WebAssembly module with non-js-compatible imports", function() { | ||
return import("./wasm.wasm").then(function(wasm) { | ||
const result = wasm.testI64(); | ||
const result = wasm.testV128(); | ||
expect(result).toEqual(42); | ||
}); | ||
}); |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
var supportsWebAssembly = require("../../../helpers/supportsWebAssembly"); | ||
const supports = require("webassembly-feature"); | ||
|
||
module.exports = function(config) { | ||
return supportsWebAssembly(); | ||
return supports["simd"](); | ||
}; |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
it("should allow converting i64s to JS bigints", async () => { | ||
const { getI64 } = await import("./wasm.wat"); | ||
expect(getI64()).toEqual(42n); | ||
}); | ||
|
||
it("should allow converting JS bigints to i64s", async () => { | ||
const { takeI64 } = await import("./wasm.wat"); | ||
takeI64(42n); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
const supports = require("webassembly-feature"); | ||
|
||
module.exports = function(config) { | ||
return supports["JS-BigInt-integration"](); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(module | ||
(func (export "getI64") (result i64) | ||
i64.const 42) | ||
(func (export "takeI64") (param i64))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** @type {import("../../../../").Configuration} */ | ||
module.exports = { | ||
entry: "./index", | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.wat$/, | ||
loader: "wast-loader", | ||
type: "webassembly/sync" | ||
} | ||
] | ||
}, | ||
experiments: { | ||
syncWebAssembly: true | ||
} | ||
}; |