Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf7f36ad

Browse files
authored
Merge pull request#16339 from Liamolucko/wasm-i64
Add `i64` to the set of JS-compatible wasm types in `syncWebAssembly` mode
2 parents2403a36 +cb9248c commitf7f36ad

File tree

9 files changed

+38
-4
lines changed

9 files changed

+38
-4
lines changed

‎lib/wasm-sync/WebAssemblyParser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const WebAssemblyImportDependency = require("../dependencies/WebAssemblyImportDe
1717
/**@typedef {import("../Parser").ParserState} ParserState */
1818
/**@typedef {import("../Parser").PreparsedAst} PreparsedAst */
1919

20-
constJS_COMPAT_TYPES=newSet(["i32","f32","f64"]);
20+
constJS_COMPAT_TYPES=newSet(["i32","i64","f32","f64"]);
2121

2222
/**
2323
*@param {t.Signature} signature the func signature
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
it("should allow to run a WebAssembly module with non-js-compatible imports",function(){
22
returnimport("./wasm.wasm").then(function(wasm){
3-
constresult=wasm.testI64();
3+
constresult=wasm.testV128();
44
expect(result).toEqual(42);
55
});
66
});
-20 Bytes
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
varsupportsWebAssembly=require("../../../helpers/supportsWebAssembly");
1+
constsupports=require("webassembly-feature");
22

33
module.exports=function(config){
4-
returnsupportsWebAssembly();
4+
returnsupports["simd"]();
55
};
-29 Bytes
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
it("should allow converting i64s to JS bigints",async()=>{
2+
const{ getI64}=awaitimport("./wasm.wat");
3+
expect(getI64()).toEqual(42n);
4+
});
5+
6+
it("should allow converting JS bigints to i64s",async()=>{
7+
const{ takeI64}=awaitimport("./wasm.wat");
8+
takeI64(42n);
9+
})
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
constsupports=require("webassembly-feature");
2+
3+
module.exports=function(config){
4+
returnsupports["JS-BigInt-integration"]();
5+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
(module
2+
(func (export"getI64") (resulti64)
3+
i64.const42)
4+
(func (export"takeI64") (parami64)))
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/**@type {import("../../../../").Configuration} */
2+
module.exports={
3+
entry:"./index",
4+
module:{
5+
rules:[
6+
{
7+
test:/\.wat$/,
8+
loader:"wast-loader",
9+
type:"webassembly/sync"
10+
}
11+
]
12+
},
13+
experiments:{
14+
syncWebAssembly:true
15+
}
16+
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp