Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Commit 449507a

Browse files
authored
Merge pull request #44 from aretmr/proposal-simdValuesInJSInterface
Accessing SIMD types form JavaScript throws
2 parents c7d08a9 + 5613a7d commit 449507a

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

proposals/simd/SIMD.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,65 @@ operations. This means that any subnormal operand is treated as 0, and any
104104
subnormal result is rounded to 0. Note that this differs from WebAssembly
105105
scalar floating-point semantics which require correct subnormal handling.
106106

107+
# JavaScript API and SIMD Values
108+
109+
Accessing WebAssembly module imports or exports containing SIMD Type from JavaScript will throw.
110+
111+
### Module Function Imports
112+
113+
Calling an imported function from JavaScript when the function arguments or result is of type v128 will cause the host function to immidiately throw a [`TypeError`](https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror).
114+
115+
### Exported Function Exotic Objects
116+
117+
Invoking the [[Call]] method of an Exported Function Exotic Object when the function type of its [[Closure]] has an argument or result of type v128 will cause the host function to immidiately throw a [`TypeError`](https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror).
118+
119+
120+
## WebAssembly Module Instatiation
121+
122+
Instantiating a WebAssembly Module from a Module moduleObject will throw a LinkError exception, when the global's valtype is v128 and the imported objects type is not WebAssembly.Global.
123+
124+
## Exported Functions
125+
126+
### Exported Function Call
127+
128+
Calling an Exported Function will throw a [`TypeError`](https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror), when parameters or results contains a v128. This error is thrown each time the [[Call]] method is invoked.
129+
130+
### Creating a host function
131+
132+
Creating a host function from JavaScript object will throw a [`TypeError`](https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror), when the host function signature contains a v128.
133+
134+
### Global constructor
135+
136+
If Global(descriptor, v) constructor will throw a [`TypeError`](https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror), when invoked with v of valuetype v128.
137+
138+
## JavaScript coercion
139+
140+
### ToJSValue
141+
142+
The algorithm toJSValue(w) should have an assertion ensuring w is not of the form v128.const v128.
143+
144+
### ToWebAssemblyValue
145+
146+
The algorithm ToWebAssemblyValue(v, type) should have an assertion ensuring type is not v128.
147+
148+
## JavaScript API Global Object algorithms
149+
150+
### ToValueType
151+
152+
The algorithm ToValueType(s) will return 'v128' if s equals "v128".
153+
154+
### DefaultValue
155+
156+
The algorithm DefaultValueType(valueType) will return v128.const 0.
157+
158+
### GetGlobalValue
159+
160+
The algorithm GetGlobalValue(Global global) will throw a [`TypeError`](https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror), when type_global(store, global.[[Global]]) is of the form mut v128.
161+
162+
### Global value attribute Setter
163+
164+
The setter of the value attribute of Global will throw a [`TypeError`](https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror), when invoked with a value v of valuetype v128.
165+
107166
# Operations
108167

109168
The SIMD operations described in this sections are generally named

0 commit comments

Comments
 (0)