You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: JS.md
+62-62Lines changed: 62 additions & 62 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -319,49 +319,49 @@ For each [`import`](https://github.com/WebAssembly/spec/blob/master/interpreter/
319
319
1. If `Type(o)` is not Object, throw a [`TypeError`](https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror).
320
320
1. Let `v` be the value of performing [`Get`](http://tc39.github.io/ecma262/#sec-get-o-p)(`o`, [`i.item_name`](https://github.com/WebAssembly/spec/blob/master/interpreter/spec/ast.ml#L171))
321
321
1. If `i` is a function import:
322
-
1. If [`IsCallable(v)`](https://tc39.github.io/ecma262/#sec-iscallable) is `false`,
323
-
throw a `WebAssembly.LinkError`.
324
-
1. If `v` is an [Exported Function Exotic Object](#exported-function-exotic-objects):
325
-
1. (The signature of `v.[[Closure]]` is checked against the import's declared
1. Let `e` be the `i`the element of `v.[[Table]]`.
364
-
1. If `e` is a [`closure`](https://github.com/WebAssembly/spec/blob/master/interpreter/spec/instance.ml#L7)`c`:
360
+
1. Append `v` to `tables`.
361
+
1. Append `v.[[Table]]` to `imports`.
362
+
1. For each index `i` of `v.[[Table]]`:
363
+
1. Let `e` be the `i`the element of `v.[[Table]]`.
364
+
1. If `e` is a [`closure`](https://github.com/WebAssembly/spec/blob/master/interpreter/spec/instance.ml#L7)`c`:
365
365
1. Append the `i`th element of `v.[[Values]]` to `funcs`.
366
366
367
367
Let `instance` be the result of creating a new
@@ -390,50 +390,50 @@ Among other things, this function performs the following observable steps:
390
390
The following steps are performed _before_ the `start` function executes:
391
391
392
392
1. For each table 't' in [`instance.tables`](https://github.com/WebAssembly/spec/blob/master/interpreter/spec/instance.ml#L17):
393
-
1. If there is no element in `tables` whose `table.[[Table]]` is `t`:
394
-
1. Let `table` be a new `WebAssembly.Table` object with [[Table]] set to `t` and [[Values]] set to a new list of the same length all whose entries are `null`.
395
-
1. Append `table` to `tables`.
396
-
1. Otherwise:
397
-
1. Let `table` be the element in `tables` whose `table.[[Table]]` is `t`
398
-
1. (Note: At most one `WebAssembly.Table` object is created for any table, so the above `table` is unique, even if there are multiple occurrances in the list. Moreover, if the item was an import, the original object will be found.)
399
-
1. For each index `i` of `t`:
400
-
1. Let `c` be the `i`th element of `t`
401
-
1. If `c` is a [`closure`](https://github.com/WebAssembly/spec/blob/master/interpreter/spec/instance.ml#L7)`c`:
402
-
1. If there is an [Exported Function Exotic Object](#exported-function-exotic-objects) in `funcs` whose `[[Closure]]` equals `c`:
403
-
1. Let `func` be that function object.
404
-
1. (Note: At most one wrapper is created for any closure, so `func` is uniquely determined. Moreover, if the item was an import that is already an [Exported Function Exotic Object](#exported-function-exotic-objects), then the original function object will be found. For imports that are regular JS functions, a new wrapper will be created.)
405
-
1. Otherwise:
406
-
1. Let `func` be an [Exported Function Exotic Object](#exported-function-exotic-objects) created from `c`.
407
-
1. Append `func` to `funcs`.
408
-
1. Set the `i`th element of `table.[[Values]]` to `func`.
393
+
1. If there is no element in `tables` whose `table.[[Table]]` is `t`:
394
+
1. Let `table` be a new `WebAssembly.Table` object with [[Table]] set to `t` and [[Values]] set to a new list of the same length all whose entries are `null`.
395
+
1. Append `table` to `tables`.
396
+
1. Otherwise:
397
+
1. Let `table` be the element in `tables` whose `table.[[Table]]` is `t`
398
+
1. (Note: At most one `WebAssembly.Table` object is created for any table, so the above `table` is unique, even if there are multiple occurrances in the list. Moreover, if the item was an import, the original object will be found.)
399
+
1. For each index `i` of `t`:
400
+
1. Let `c` be the `i`th element of `t`
401
+
1. If `c` is a [`closure`](https://github.com/WebAssembly/spec/blob/master/interpreter/spec/instance.ml#L7)`c`:
402
+
1. If there is an [Exported Function Exotic Object](#exported-function-exotic-objects) in `funcs` whose `[[Closure]]` equals `c`:
403
+
1. Let `func` be that function object.
404
+
1. (Note: At most one wrapper is created for any closure, so `func` is uniquely determined. Moreover, if the item was an import that is already an [Exported Function Exotic Object](#exported-function-exotic-objects), then the original function object will be found. For imports that are regular JS functions, a new wrapper will be created.)
405
+
1. Otherwise:
406
+
1. Let `func` be an [Exported Function Exotic Object](#exported-function-exotic-objects) created from `c`.
407
+
1. Append `func` to `funcs`.
408
+
1. Set the `i`th element of `table.[[Values]]` to `func`.
409
409
410
410
(Note: The table and element function objects created by the above steps are only observable for tables that are either imported or exported.)
411
411
412
412
Let `exports` be a list of (string, JS value) pairs that is mapped from
413
413
each [external](https://github.com/WebAssembly/spec/blob/master/interpreter/spec/instance.ml#L24) value `e` in `instance.exports` as follows:
414
414
415
415
1. If `e` is a [closure](https://github.com/WebAssembly/spec/blob/master/interpreter/spec/instance.ml#L12)`c`:
416
-
1. If there is an [Exported Function Exotic Object](#exported-function-exotic-objects)`func` in `funcs` whose `func.[[Closure]]` equals `c`, then return `func`.
417
-
1. (Note: At most one wrapper is created for any closure, so `func` is unique, even if there are multiple occurrances in the list. Moreover, if the item was an import that is already an [Exported Function Exotic Object](#exported-function-exotic-objects), then the original function object will be found. For imports that are regular JS functions, a new wrapper will be created.)
418
-
1. Otherwise:
419
-
1. Let `func` be an [Exported Function Exotic Object](#exported-function-exotic-objects) created from `c`.
420
-
1. Append `func` to `funcs`.
421
-
1. Return `func`.
416
+
1. If there is an [Exported Function Exotic Object](#exported-function-exotic-objects)`func` in `funcs` whose `func.[[Closure]]` equals `c`, then return `func`.
417
+
1. (Note: At most one wrapper is created for any closure, so `func` is unique, even if there are multiple occurrances in the list. Moreover, if the item was an import that is already an [Exported Function Exotic Object](#exported-function-exotic-objects), then the original function object will be found. For imports that are regular JS functions, a new wrapper will be created.)
418
+
1. Otherwise:
419
+
1. Let `func` be an [Exported Function Exotic Object](#exported-function-exotic-objects) created from `c`.
420
+
1. Append `func` to `funcs`.
421
+
1. Return `func`.
422
422
1. If `e` is a [global](https://github.com/WebAssembly/spec/blob/master/interpreter/spec/instance.ml#L15)`v`:
423
-
1.[Assert](https://tc39.github.io/ecma262/#assert): the global is immutable
424
-
by MVP validation constraint.
425
-
1. If `v` is an `i64`, throw a `WebAssembly.LinkError`.
426
-
1. Return [`ToJSValue`](#tojsvalue)`(v)`.
423
+
1.[Assert](https://tc39.github.io/ecma262/#assert): the global is immutable
424
+
by MVP validation constraint.
425
+
1. If `v` is an `i64`, throw a `WebAssembly.LinkError`.
426
+
1. Return [`ToJSValue`](#tojsvalue)`(v)`.
427
427
1. If `e` is a [memory](https://github.com/WebAssembly/spec/blob/master/interpreter/spec/instance.ml#L14)`m`:
428
-
1. If there is an element `memory` in `memories` whose `memory.[[Memory]]` is `m`, then return `memory`.
429
-
1. (Note: At most one `WebAssembly.Memory` object is created for any memory, so the above `memory` is unique, even if there are multiple occurrances in the list. Moreover, if the item was an import, the original object will be found.)
430
-
1. Otherwise:
431
-
1. Let `memory` be a new `WebAssembly.Memory` object created via [`CreateMemoryObject`](#creatememoryobject) from `m`.
432
-
1. Append `memory` to `memories`.
433
-
1. Return `memory`.
428
+
1. If there is an element `memory` in `memories` whose `memory.[[Memory]]` is `m`, then return `memory`.
429
+
1. (Note: At most one `WebAssembly.Memory` object is created for any memory, so the above `memory` is unique, even if there are multiple occurrances in the list. Moreover, if the item was an import, the original object will be found.)
430
+
1. Otherwise:
431
+
1. Let `memory` be a new `WebAssembly.Memory` object created via [`CreateMemoryObject`](#creatememoryobject) from `m`.
432
+
1. Append `memory` to `memories`.
433
+
1. Return `memory`.
434
434
1. Otherwise `e` must be a [table](https://github.com/WebAssembly/spec/blob/master/interpreter/spec/instance.ml#L13)`t`:
435
-
1. Assert: There is an element `table` in `tables` whose `table.[[Table]]` is `t`.
436
-
1. Return that `table`.
435
+
1. Assert: There is an element `table` in `tables` whose `table.[[Table]]` is `t`.
436
+
1. Return that `table`.
437
437
438
438
Note: For the purpose of the above algorithm, two [closure](https://github.com/WebAssembly/spec/blob/master/interpreter/spec/instance.ml#L7) values are considered equal if and only if:
0 commit comments