Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions document/js-api/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje
To <dfn>instantiate imported strings</dfn> with module |module| and |importedStringModule|, perform the following steps:

1. Assert: |importedStringModule| is not null.
1. Let |exportsObject| be [=!=] [$OrdinaryObjectCreate$](null).
1. Let |exportsObject| be [$OrdinaryObjectCreate$](null).
1. [=list/iterate|For each=] (|moduleName|, |componentName|, |externtype|) of [=module_imports=](|module|),
1. If |moduleName| does not equal |importedStringModule|, then [=iteration/continue=].
1. Let |stringConstant| be |componentName|.
Expand All @@ -497,7 +497,7 @@ To <dfn>instantiate imported strings</dfn> with module |module| and |importedStr
1. [=list/iterate|For each=] (|moduleName|, |componentName|, |externtype|) of [=module_imports=](|module|),
1. If |builtinOrStringImports| [=map/exist|contains=] |moduleName|,
1. Let |o| be |builtinOrStringImports|[|moduleName|].
1. If |o| [=is not an Object=] or if [$HasProperty$](|o|, |componentName|) is false,
1. If |o| [=is not an Object=] or if [=?=] [$HasProperty$](|o|, |componentName|) is false,
1. Set |o| to [=?=] [$Get$](|importObject|, |moduleName|).
1. Else,
1. Let |o| be [=?=] [$Get$](|importObject|, |moduleName|).
Expand Down Expand Up @@ -552,7 +552,7 @@ The verification of WebAssembly type requirements is deferred to the

<div algorithm>
To <dfn>create an exports object</dfn> from a WebAssembly module |module| and instance |instance|, perform the following steps:
1. Let |exportsObject| be [=!=] [$OrdinaryObjectCreate$](null).
1. Let |exportsObject| be [$OrdinaryObjectCreate$](null).
1. [=list/iterate|For each=] (|name|, |externtype|) of [=module_exports=](|module|),
1. Let |externval| be [=instance_export=](|instance|, |name|).
1. Assert: |externval| is not [=error=].
Expand Down Expand Up @@ -1093,7 +1093,7 @@ Each {{Table}} object has a \[[Table]] internal slot, which is a [=table address
1. Let |index64| be [=?=] [=AddressValueToU64=](|index|, |addrtype|).
1. Let |result| be [=table_read=](|store|, |tableaddr|, |index64|).
1. If |result| is [=error=], throw a {{RangeError}} exception.
1. Return [=!=] [=ToJSValue=](|result|).
1. Return [=ToJSValue=](|result|).
</div>

<div algorithm>
Expand Down Expand Up @@ -1211,7 +1211,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
1. Let |globaltype| be [=global_type=](|store|, |globaladdr|).
1. If |globaltype| is of the form <var ignore>mut</var> |valuetype| where |valuetype| [=matches/valtype|matches=] [=v128=] or [=exnref=], throw a {{TypeError}}.
1. Let |value| be [=global_read=](|store|, |globaladdr|).
1. Return [=!=] [=ToJSValue=](|value|).
1. Return [=ToJSValue=](|value|).
</div>

<div algorithm>
Expand Down Expand Up @@ -1269,7 +1269,7 @@ This slot holds a [=function address=] relative to the [=surrounding agent=]'s [
1. Let [|paramTypes|] → [<var ignore>resultTypes</var>] be |functype|.
1. Let |arity| be |paramTypes|'s [=list/size=].
1. Let |name| be the [=name of the WebAssembly function=] |funcaddr|.
1. Let |function| be [=!=] [$CreateBuiltinFunction$](|steps|, |arity|, |name|, « \[[FunctionAddress]] », |realm|).
1. Let |function| be [$CreateBuiltinFunction$](|steps|, |arity|, |name|, « \[[FunctionAddress]] », |realm|).
1. Set |function|.\[[FunctionAddress]] to |funcaddr|.
1. [=map/Set=] |map|[|funcaddr|] to |function|.
1. Return |function|.
Expand Down Expand Up @@ -1299,17 +1299,17 @@ This slot holds a [=function address=] relative to the [=surrounding agent=]'s [
1. Let |payload| be [=exn_read=](|store|, |exnaddr|).
1. Let |jsTagAddr| be the result of [=get the JavaScript exception tag|getting the JavaScript exception tag=].
1. If |tagaddr| is equal to |jsTagAddr|,
1. Throw [=!=] [=ToJSValue=](|payload|[0]).
1. Throw [=ToJSValue=](|payload|[0]).
1. Otherwise,
1. Let |exception| be [=create an Exception object|a new Exception=] created from |exnaddr|.
1. Throw |exception|.
1. Let |outArity| be the [=list/size=] of |ret|.
1. If |outArity| is 0, return undefined.
1. Otherwise, if |outArity| is 1, return [=!=] [=ToJSValue=](|ret|[0]).
1. Otherwise, if |outArity| is 1, return [=ToJSValue=](|ret|[0]).
1. Otherwise,
1. Let |values| be « ».
1. [=list/iterate|For each=] |r| of |ret|,
1. [=list/Append=] [=!=] [=ToJSValue=](|r|) to |values|.
1. [=list/Append=] [=ToJSValue=](|r|) to |values|.
1. Return [$CreateArrayFromList$](|values|).
</div>

Expand All @@ -1324,7 +1324,7 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not
1. If any type in |parameters| or |results| [=matches/valtype|matches=] [=v128=] or [=exnref=], throw a {{TypeError}}.
1. Let |jsArguments| be « ».
1. [=list/iterate|For each=] |arg| of |arguments|,
1. [=list/Append=] [=!=] [=ToJSValue=](|arg|) to |jsArguments|.
1. [=list/Append=] [=ToJSValue=](|arg|) to |jsArguments|.
1. Let |ret| be [=?=] [$Call$](|func|, undefined, |jsArguments|).
1. Let |resultsSize| be |results|'s [=list/size=].
1. If |resultsSize| is 0, return « ».
Expand Down Expand Up @@ -1759,7 +1759,7 @@ The <dfn method for="Exception">getArg(|exceptionTag|, |index|)</dfn> method ste
1. Let [|types|] → [] be [=tag_type=](|store|, |tagaddr|).
1. If |types|[|index|] [=matches/valtype|matches=] [=v128=] or [=exnref=],
1. Throw a {{TypeError}}.
1. Return [=!=] [=ToJSValue=](|payload|[|index|]).
1. Return [=ToJSValue=](|payload|[|index|]).

</div>

Expand Down Expand Up @@ -1882,7 +1882,7 @@ To <dfn>create a builtin function</dfn> from type |funcType| and execution steps
To <dfn>instantiate a builtin set</dfn> with name |builtinSetName|, perform the following steps:

1. Let |builtins| be the result of [=get the builtins for a builtin set=] |builtinSetName|.
1. Let |exportsObject| be [=!=] [$OrdinaryObjectCreate$](null).
1. Let |exportsObject| be [$OrdinaryObjectCreate$](null).
1. [=list/iterate|For each=] (|name|, |funcType|, |steps|) of |builtins|,
1. Let |funcaddr| be the result of [=create a builtin function=] with |funcType| and |steps|.
1. Let |func| be the result of creating [=a new Exported Function=] from |funcaddr|.
Expand Down Expand Up @@ -2138,7 +2138,7 @@ When this builtin is invoked with parameters |first| and |second|, the following
1. Throw a {{RuntimeError}} exception as if a [=trap=] was executed.
1. If |second| is not null and |second| [=is not a String=],
1. Throw a {{RuntimeError}} exception as if a [=trap=] was executed.
1. If [=!=] [=IsStrictlyEqual=](|first|, |second|) is true,
1. If [=IsStrictlyEqual=](|first|, |second|) is true,
1. Return 1.
1. Return 0.

Expand All @@ -2154,7 +2154,7 @@ When this builtin is invoked with parameters |first| and |second|, the following

1. Let |first| be [=?=] [$UnwrapString$](|first|).
1. Let |second| be [=?=] [$UnwrapString$](|second|).
1. If [=!=] [=IsStrictlyEqual=](|first|, |second|) is true,
1. If [=IsStrictlyEqual=](|first|, |second|) is true,
1. Return 0.
1. If [=!=] [=IsLessThan=](|first|, |second|, true) is true,
1. Return -1.
Expand Down
Loading