@@ -20,6 +20,12 @@ Prepare For TR: true
2020 "title": "WebAssembly Specification",
2121 "publisher": "W3C WebAssembly Community Group",
2222 "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"
2329 }
2430}
2531</pre>
@@ -154,6 +160,10 @@ urlPrefix: https://webassembly.github.io/spec/core/multipage/; spec: WebAssembly
154160 text: 𝗀𝗅𝗈𝖻𝖺𝗅
155161 text: global type; url: syntax/types.html#syntax-globaltype
156162 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
157167</pre>
158168
159169<pre class='link-defaults'>
@@ -333,7 +343,6 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje
333343 1. Let |externfunc| be the [=external value=] [=external value|𝖿𝗎𝗇𝖼=] |funcaddr|.
334344 1. [=Append=] |externfunc| to |imports|.
335345 1. If |externtype| is of the form [=𝗀𝗅𝗈𝖻𝖺𝗅=] |globaltype|,
336- 1. If |globaltype| is [=𝗂𝟨𝟦=] or [=Type=] (|v|) is not [=Number=] , throw a {{LinkError}} exception.
337346 1. Let |value| be [=ToWebAssemblyValue=] (|v|, |globaltype|.<em> [=global type|valtype=] </em> )
338347 1. Assert: |globaltype|.<em> [=global type|mut=] </em> is [=global type|𝖼𝗈𝗇𝗌𝗍=] , as verified by WebAssembly validation.
339348 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
371380 1. Let |func| be the result of creating [=a new Exported Function=] from |funcaddr|.
372381 1. Let |value| be |func|.
373382 1. If |externtype| is of the form [=𝗀𝗅𝗈𝖻𝖺𝗅=] |globaltype|,
374- 1. If |globaltype|.<em> [=global type|valtype=] </em> ) is [=𝗂𝟨𝟦=] , throw a {{LinkError}} exception.
375383 1. Assert: |globaltype|.<em> [=global type|mut=] </em> is [=global type|𝖼𝗈𝗇𝗌𝗍=] , as verified by WebAssembly validation.
376384 1. Assert: |externval| is of the form [=external value|𝗀𝗅𝗈𝖻𝖺𝗅=] |globaladdr|.
377385 1. Let [=external value|𝗀𝗅𝗈𝖻𝖺𝗅=] |globaladdr| be |externval|.
@@ -741,10 +749,6 @@ This slot holds a [=function address=] relative to the [=surrounding agent=]'s [
741749 1. Let |store| be the [=surrounding agent=] 's [=associated store=] .
742750 1. Let |functype| be [=type_func=] (|store|, |funcaddr|).
743751 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-
748752 5. Let |args| be an empty list of WebAssembly values.
749753 1. Let |i| be 0.
750754 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
767771 To <dfn>create a host function</dfn> from the JavaScript object |func|, perform the following steps:
768772
769773 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.
771774 1. Let |arguments| be a [=list=] of the arguments of the invocation of this function.
772775 1. Let |jsArguments| be an empty [=list=] .
773776 1. For each |arg| in |arguments|,
@@ -785,10 +788,12 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not
785788<div algorithm>
786789The algorithm <dfn>ToJSValue</dfn> (|w|) coerces a [=WebAssembly value=] to a JavaScript value performs the following steps:
787790
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|.
792797
793798<!-- If the WebAssembly value is optional, then given `None`, return JavaScript value `undefined`. -->
794799
@@ -799,7 +804,9 @@ Note: Implementations may optionally replace the NaN payload with any other NaN
799804The algorithm <dfn>ToWebAssemblyValue</dfn> (|v|, |type|) coerce a JavaScript value to a [=WebAssembly value=] performs the following steps:
800805
801806
802- Assert: |type| is not [=𝗂𝟨𝟦=] .
807+ 1. If |type| is [=𝗂𝟨𝟦=] ,
808+ 1. Let |i64| be [=ToBigInt64=] (|v|).
809+ 1. Return [=𝗂𝟨𝟦.𝖼𝗈𝗇𝗌𝗍=] |i64|.
8038101. If |type| is [=𝗂𝟥𝟤=] ,
804811 1. Let |i32| be ? [=ToInt32=] (|v|).
805812 1. Return [=𝗂𝟥𝟤.𝖼𝗈𝗇𝗌𝗍=] |i32|.
0 commit comments