@@ -20,6 +20,12 @@ Prepare For TR: true
20
20
"title": "WebAssembly Specification",
21
21
"publisher": "W3C WebAssembly Community Group",
22
22
"status": "Draft"
23
+ },
24
+ "BIGINT": {
25
+ "href": "https://tc39.github.io/proposal-bigint/",
26
+ "title": "BigInt Specification",
27
+ "publisher": "TC39",
28
+ "status": "Stage 3 proposal"
23
29
}
24
30
}
25
31
</pre>
@@ -154,6 +160,10 @@ urlPrefix: https://webassembly.github.io/spec/core/multipage/; spec: WebAssembly
154
160
text: 𝗀𝗅𝗈𝖻𝖺𝗅
155
161
text: global type; url: syntax/types.html#syntax-globaltype
156
162
text: address; url: exec/runtime.html#addresses
163
+ text: signed_64; url: exec/numerics.html#aux-signed
164
+ urlPrefix: https://tc39.github.io/proposal-bigint/; spec: BIGINT; type: dfn
165
+ text: ToBigInt64; url: #sec-to-big-int64
166
+ text: BigInt; url: #sec-ecmascript-language-types-bigint-type
157
167
</pre>
158
168
159
169
<pre class='link-defaults'>
@@ -333,7 +343,6 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje
333
343
1. Let |externfunc| be the [=external value=] [=external value|𝖿𝗎𝗇𝖼=] |funcaddr|.
334
344
1. [=Append=] |externfunc| to |imports|.
335
345
1. If |externtype| is of the form [=𝗀𝗅𝗈𝖻𝖺𝗅=] |globaltype|,
336
- 1. If |globaltype| is [=𝗂𝟨𝟦=] or [=Type=] (|v|) is not [=Number=] , throw a {{LinkError}} exception.
337
346
1. Let |value| be [=ToWebAssemblyValue=] (|v|, |globaltype|.<em> [=global type|valtype=] </em> )
338
347
1. Assert: |globaltype|.<em> [=global type|mut=] </em> is [=global type|𝖼𝗈𝗇𝗌𝗍=] , as verified by WebAssembly validation.
339
348
1. Let |store| be the [=surrounding agent=] 's [=associated store=] .
@@ -371,7 +380,6 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje
371
380
1. Let |func| be the result of creating [=a new Exported Function=] from |funcaddr|.
372
381
1. Let |value| be |func|.
373
382
1. If |externtype| is of the form [=𝗀𝗅𝗈𝖻𝖺𝗅=] |globaltype|,
374
- 1. If |globaltype|.<em> [=global type|valtype=] </em> ) is [=𝗂𝟨𝟦=] , throw a {{LinkError}} exception.
375
383
1. Assert: |globaltype|.<em> [=global type|mut=] </em> is [=global type|𝖼𝗈𝗇𝗌𝗍=] , as verified by WebAssembly validation.
376
384
1. Assert: |externval| is of the form [=external value|𝗀𝗅𝗈𝖻𝖺𝗅=] |globaladdr|.
377
385
1. Let [=external value|𝗀𝗅𝗈𝖻𝖺𝗅=] |globaladdr| be |externval|.
@@ -741,10 +749,6 @@ This slot holds a [=function address=] relative to the [=surrounding agent=]'s [
741
749
1. Let |store| be the [=surrounding agent=] 's [=associated store=] .
742
750
1. Let |functype| be [=type_func=] (|store|, |funcaddr|).
743
751
1. Let [|parameters|] → [|results|] be |functype|.
744
- 1. If |parameters| or |results| contains an [=𝗂𝟨𝟦=] , throw a {{TypeError}} .
745
-
746
- Note: the above error is thrown each time the \[[Call]] method is invoked.
747
-
748
752
5. Let |args| be an empty list of WebAssembly values.
749
753
1. Let |i| be 0.
750
754
1. For each type |t| of |parameters|,
@@ -767,7 +771,6 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not
767
771
To <dfn>create a host function</dfn> from the JavaScript object |func|, perform the following steps:
768
772
769
773
1. Let |hostfunc| be a [=host function=] which performs the following steps when called:
770
- 1. If the signature contains an [=𝗂𝟨𝟦=] (as argument or result), the host function throws a {{TypeError}} when called.
771
774
1. Let |arguments| be a [=list=] of the arguments of the invocation of this function.
772
775
1. Let |jsArguments| be an empty [=list=] .
773
776
1. For each |arg| in |arguments|,
@@ -785,10 +788,12 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not
785
788
<div algorithm>
786
789
The algorithm <dfn>ToJSValue</dfn> (|w|) coerces a [=WebAssembly value=] to a JavaScript value performs the following steps:
787
790
788
- Assert: |w| is not of the form [=𝗂𝟨𝟦.𝖼𝗈𝗇𝗌𝗍=] |i64|.
789
- 1. If |w| is of the form [=𝗂𝟥𝟤.𝖼𝗈𝗇𝗌𝗍=] |i32|, return [=the Number value=] for |i32|.
790
- 1. If |w| is of the form [=𝖿𝟥𝟤.𝖼𝗈𝗇𝗌𝗍=] |f32|, return [=the Number value=] for |f32|.
791
- 1. If |w| is of the form [=𝖿𝟨𝟦.𝖼𝗈𝗇𝗌𝗍=] |f64|, return [=the Number value=] for |f64|.
791
+ 1. If |w| is of the form [=𝗂𝟨𝟦.𝖼𝗈𝗇𝗌𝗍=] |i64|,
792
+ 1. Let |v| be [=signed_64=] (|i64|).
793
+ 1. Return a [=BigInt=] representing the mathematical value |v|.
794
+ 1. If |w| is of the form [=𝗂𝟥𝟤.𝖼𝗈𝗇𝗌𝗍=] |i32|, return [=the Number value=] of |i32|.
795
+ 1. If |w| is of the form [=𝖿𝟥𝟤.𝖼𝗈𝗇𝗌𝗍=] |f32|, return [=the Number value=] of |f32|.
796
+ 1. If |w| is of the form [=𝖿𝟨𝟦.𝖼𝗈𝗇𝗌𝗍=] |f64|, return [=the Number value=] of |f64|.
792
797
793
798
<!-- If the WebAssembly value is optional, then given `None`, return JavaScript value `undefined`. -->
794
799
@@ -799,7 +804,9 @@ Note: Implementations may optionally replace the NaN payload with any other NaN
799
804
The algorithm <dfn>ToWebAssemblyValue</dfn> (|v|, |type|) coerce a JavaScript value to a [=WebAssembly value=] performs the following steps:
800
805
801
806
802
- Assert: |type| is not [=𝗂𝟨𝟦=] .
807
+ 1. If |type| is [=𝗂𝟨𝟦=] ,
808
+ 1. Let |i64| be [=ToBigInt64=] (|v|).
809
+ 1. Return [=𝗂𝟨𝟦.𝖼𝗈𝗇𝗌𝗍=] |i64|.
803
810
1. If |type| is [=𝗂𝟥𝟤=] ,
804
811
1. Let |i32| be ? [=ToInt32=] (|v|).
805
812
1. Return [=𝗂𝟥𝟤.𝖼𝗈𝗇𝗌𝗍=] |i32|.
0 commit comments