Skip to content

Commit 9a2cab4

Browse files
authored
[js-api] Fix bikeshed errors (WebAssembly#1771)
1 parent babba57 commit 9a2cab4

File tree

12 files changed

+40
-43
lines changed

12 files changed

+40
-43
lines changed

document/js-api/index.bs

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMASCRIPT
6262
text: 𝔽; url: #𝔽
6363
text: ℤ; url: #ℤ
6464
text: SameValue; url: sec-samevalue
65-
type: abstract-op
66-
text: CreateMethodProperty; url: sec-createmethodproperty
6765
urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: dfn
6866
url: valid/modules.html#valid-module
6967
text: valid
@@ -395,7 +393,7 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje
395393
1. Let |index| be the number of external functions in |imports|. This value |index| is known as the <dfn>index of the host function</dfn> |funcaddr|.
396394
1. Let |externfunc| be the [=external value=] [=external value|func=] |funcaddr|.
397395
1. [=list/Append=] |externfunc| to |imports|.
398-
1. If |externtype| is of the form [=global=] <var ignore>mut</var> |valtype|,
396+
1. If |externtype| is of the form [=external-type/global=] <var ignore>mut</var> |valtype|,
399397
1. If |v| [=implements=] {{Global}},
400398
1. Let |globaladdr| be |v|.\[[Global]].
401399
1. Otherwise,
@@ -411,16 +409,16 @@ A {{Module}} object represents a single WebAssembly module. Each {{Module}} obje
411409
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
412410
1. Let |externglobal| be [=external value|global=] |globaladdr|.
413411
1. [=list/Append=] |externglobal| to |imports|.
414-
1. If |externtype| is of the form [=mem=] <var ignore>memtype</var>,
412+
1. If |externtype| is of the form [=external-type/mem=] <var ignore>memtype</var>,
415413
1. If |v| does not [=implement=] {{Memory}}, throw a {{LinkError}} exception.
416414
1. Let |externmem| be the [=external value=] [=external value|mem=] |v|.\[[Memory]].
417415
1. [=list/Append=] |externmem| to |imports|.
418-
1. If |externtype| is of the form [=table=] <var ignore>tabletype</var>,
416+
1. If |externtype| is of the form [=external-type/table=] <var ignore>tabletype</var>,
419417
1. If |v| does not [=implement=] {{Table}}, throw a {{LinkError}} exception.
420418
1. Let |tableaddr| be |v|.\[[Table]].
421419
1. Let |externtable| be the [=external value=] [=external value|table=] |tableaddr|.
422420
1. [=list/Append=] |externtable| to |imports|.
423-
1. If |externtype| is of the form [=externtype/tag=] |attribute| <var ignore>functype</var>,
421+
1. If |externtype| is of the form [=external-type/tag=] |attribute| <var ignore>functype</var>,
424422
1. Assert: |attribute| is [=tagtype/attribute/exception=].
425423
1. If |v| does not [=implement=] {{Tag}}, throw a {{LinkError}} exception.
426424
1. Let |tagaddr| be |v|.\[[Address]].
@@ -444,22 +442,22 @@ The verification of WebAssembly type requirements is deferred to the
444442
1. Let [=external value|func=] |funcaddr| be |externval|.
445443
1. Let |func| be the result of creating [=a new Exported Function=] from |funcaddr|.
446444
1. Let |value| be |func|.
447-
1. If |externtype| is of the form [=global=] <var ignore>mut</var> <var ignore>globaltype</var>,
445+
1. If |externtype| is of the form [=external-type/global=] <var ignore>mut</var> <var ignore>globaltype</var>,
448446
1. Assert: |externval| is of the form [=external value|global=] |globaladdr|.
449447
1. Let [=external value|global=] |globaladdr| be |externval|.
450448
1. Let |global| be [=create a global object|a new Global object=] created from |globaladdr|.
451449
1. Let |value| be |global|.
452-
1. If |externtype| is of the form [=mem=] <var ignore>memtype</var>,
450+
1. If |externtype| is of the form [=external-type/mem=] <var ignore>memtype</var>,
453451
1. Assert: |externval| is of the form [=external value|mem=] |memaddr|.
454452
1. Let [=external value|mem=] |memaddr| be |externval|.
455453
1. Let |memory| be [=create a memory object|a new Memory object=] created from |memaddr|.
456454
1. Let |value| be |memory|.
457-
1. If |externtype| is of the form [=table=] <var ignore>tabletype</var>,
455+
1. If |externtype| is of the form [=external-type/table=] <var ignore>tabletype</var>,
458456
1. Assert: |externval| is of the form [=external value|table=] |tableaddr|.
459457
1. Let [=external value|table=] |tableaddr| be |externval|.
460458
1. Let |table| be [=create a Table object|a new Table object=] created from |tableaddr|.
461459
1. Let |value| be |table|.
462-
1. If |externtype| is of the form [=externtype/tag=] |attribute| <var ignore>functype</var>,
460+
1. If |externtype| is of the form [=external-type/tag=] |attribute| <var ignore>functype</var>,
463461
1. Assert: |attribute| is [=tagtype/attribute/exception=].
464462
1. Assert: |externval| is of the form [=external value/tag=] |tagaddr|.
465463
1. Let [=external value/tag=] |tagaddr| be |externval|.
@@ -582,10 +580,10 @@ interface Module {
582580
<div algorithm>
583581
The <dfn>string value of the extern type</dfn> |type| is
584582
* "function" if |type| is of the form [=external-type/func=] <var ignore>functype</var>
585-
* "table" if |type| is of the form [=table=] <var ignore>tabletype</var>
586-
* "memory" if |type| is of the form [=mem=] <var ignore>memtype</var>
587-
* "global" if |type| is of the form [=global=] <var ignore>globaltype</var>
588-
* "tag" if |type| is of the form [=externtype/tag=] <var ignore>tag</var>
583+
* "table" if |type| is of the form [=external-type/table=] <var ignore>tabletype</var>
584+
* "memory" if |type| is of the form [=external-type/mem=] <var ignore>memtype</var>
585+
* "global" if |type| is of the form [=external-type/global=] <var ignore>globaltype</var>
586+
* "tag" if |type| is of the form [=external-type/tag=] <var ignore>tag</var>
589587
</div>
590588

591589
<div algorithm>
@@ -818,7 +816,8 @@ Immediately after a WebAssembly [=memory.grow=] instruction executes, perform th
818816
{{ArrayBuffer}} objects returned by a {{Memory}} object must have a size that is a multiple of a WebAssembly [=page size=] (the constant 65536). For this reason [=HostResizeArrayBuffer=] is redefined as follows.
819817

820818
<div algorithm>
821-
The <dfn>abstract operation [=HostResizeArrayBuffer=]</dfn> takes arguments |buffer| (an {{ArrayBuffer}}) and |newLength|. It performs the following steps when called.
819+
820+
The <dfn id=HostResizeArrayBuffer export>abstract operation [=HostResizeArrayBuffer=]</dfn> takes arguments |buffer| (an {{ArrayBuffer}}) and |newLength|. It performs the following steps when called.
822821

823822
1. If |buffer|.\[[ArrayBufferDetachKey]] is "WebAssembly.Memory",
824823
1. Let |map| be the [=surrounding agent=]'s associated [=Memory object cache=].
@@ -1149,7 +1148,7 @@ This slot holds a [=function address=] relative to the [=surrounding agent=]'s [
11491148
1. Let |payload| be [=exn_read=](|store|, |exnaddr|).
11501149
1. Let |jsTagAddr| be the result of [=get the JavaScript exception tag |getting the JavaScript exception tag=].
11511150
1. If |tagaddr| is equal to |jsTagAddr|,
1152-
1. Throw the result of [=retrieving an extern value=] from |payload|[0].
1151+
1. Throw the result of [=retrieving a host value=] from |payload|[0].
11531152
1. Otherwise,
11541153
1. Let |exception| be [=create an Exception object|a new Exception=] created from |exnaddr|.
11551154
1. Throw |exception|.
@@ -1180,7 +1179,7 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not
11801179
1. If |resultsSize| is 0, return « ».
11811180
1. Otherwise, if |resultsSize| is 1, return « [=?=] [=ToWebAssemblyValue=](|ret|, |results|[0]) ».
11821181
1. Otherwise,
1183-
1. Let |method| be [=?=] [$GetMethod$](|ret|, {{@@iterator}}).
1182+
1. Let |method| be [=?=] [$GetMethod$](|ret|, {{%Symbol.iterator%}}).
11841183
1. If |method| is undefined, [=throw=] a {{TypeError}}.
11851184
1. Let |values| be [=?=] [$IteratorToList$]([=?=] [$GetIteratorFromMethod$](|ret|, |method|)).
11861185
1. Let |wasmValues| be a new, empty [=list=].
@@ -1229,7 +1228,7 @@ The algorithm <dfn>ToJSValue</dfn>(|w|) coerces a [=WebAssembly value=] to a Jav
12291228
1. If |w| is of the form [=i64.const=] |u64|,
12301229
1. Let |i64| be [=signed_64=](|u64|).
12311230
1. Return [=ℤ=](|i64| interpreted as a mathematical value).
1232-
1. If |w| is of the form [=i32.const=] |u32|,
1231+
1. If |w| is of the form [=i32.const=] |i32|,
12331232
1. Let |i32| be [=signed_32=](|i32|).
12341233
2. Return [=𝔽=](|i32| interpreted as a mathematical value).
12351234
1. If |w| is of the form [=f32.const=] |f32|,
@@ -1240,15 +1239,15 @@ The algorithm <dfn>ToJSValue</dfn>(|w|) coerces a [=WebAssembly value=] to a Jav
12401239
1. If |f64| is [=+∞=] or [=−∞=], return **+∞**<sub>𝔽</sub> or **-∞**<sub>𝔽</sub>, respectively.
12411240
1. If |f64| is [=nan=], return **NaN**.
12421241
1. Return [=𝔽=](|f64| interpreted as a mathematical value).
1243-
1. If |w| is of the form [=ref.null=] |t|, return null.
1242+
1. If |w| is of the form [=ref.null=] <var ignore>t</var>, return null.
12441243
1. If |w| is of the form [=ref.i31=] |u31|,
12451244
1. Let |i31| be [=signed_31=](|u31|).
12461245
1. Let return [=𝔽=](|i31|).
12471246
1. If |w| is of the form [=ref.struct=] |structaddr|, return the result of creating [=a new Exported GC Object=] from |structaddr| and "struct".
12481247
1. If |w| is of the form [=ref.array=] |arrayaddr|, return the result of creating [=a new Exported GC Object=] from |arrayaddr| and "array".
12491248
1. If |w| is of the form [=ref.func=] |funcaddr|, return the result of creating [=a new Exported Function=] from |funcaddr|.
12501249
1. If |w| is of the form [=ref.host=] |hostaddr|, return the result of [=retrieving a host value=] from |hostaddr|.
1251-
1. If |w| is of the form [=ref.extern=] <var ignore>ref</var>, return [=ToJSValue=](|ref|).
1250+
1. If |w| is of the form [=ref.extern=] |ref|, return [=ToJSValue=](|ref|).
12521251

12531252

12541253
Note: Number values which are equal to NaN may have various observable NaN payloads; see [$NumericToRawBytes$] for details.
@@ -1334,8 +1333,6 @@ The algorithm <dfn>ToWebAssemblyValue</dfn>(|v|, |type|) coerces a JavaScript va
13341333

13351334
The <dfn>tag_alloc</dfn>(|store|, |parameters|) algorithm creates a new [=tag address=] for |parameters| in |store| and returns the updated store and the [=tag address=].
13361335

1337-
The <dfn>tag_parameters</dfn>(|store|, |tagAddress|) algorithm returns the [=list=] of types for |tagAddress| in |store|.
1338-
13391336
<h4 id="tag-types">Tag types</h4>
13401337

13411338
<pre class="idl">
@@ -1494,7 +1491,7 @@ The internal methods of an [=Exported GC Object=] use the following implementati
14941491
1. Set |object|.\[[OwnPropertyKeys]] as specified in [=[[OwnPropertyKeys]] internal method of an Exported GC Object=].
14951492
1. [=map/Set=] |map|[|objectaddr|] to |object|.
14961493
1. Return |object|.
1497-
1494+
</div>
14981495

14991496
<h3 id="exceptions">Exceptions</h3>
15001497

@@ -1639,7 +1636,7 @@ When the [=namespace object=] for the {{WebAssembly}} namespace is [=create a na
16391636
1. Let |namespaceObject| be the [=namespace object=].
16401637
1. [=list/iterate|For each=] |error| of « "CompileError", "LinkError", "RuntimeError" »,
16411638
1. Let |constructor| be a new object, implementing the [=NativeError Object Structure=], with <var ignore>NativeError</var> set to |error|.
1642-
1. [=!=] [$CreateMethodProperty$](|namespaceObject|, |error|, |constructor|).
1639+
1. [=!=] [$DefineMethodProperty$](|namespaceObject|, |error|, |constructor|, false).
16431640

16441641
</div>
16451642

document/util/htmldiff.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
# also requires the perl modules Getopt::Std
4949
#
5050
# NOTE: The markup created by htmldiff may not validate against the HTML 4.0
51-
# DTD. This is because the algorithm is realtively simple, and there are
51+
# DTD. This is because the algorithm is relatively simple, and there are
5252
# places in the markup content model where the span element is not allowed.
5353
# Htmldiff is NOT aware of these places.
5454
#

proposals/bulk-memory-operations/Overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ The meaning of the bits of the flag field (a `varuint32`) for element segments i
228228
| 0 | 0=is active, 1=is passive |
229229
| 1 | if bit 0 clear: 0=table 0, 1=has table index |
230230
| | if bit 0 set: 0=active, 1=declared |
231-
| 2 | 0=carries indicies; 1=carries elemexprs |
231+
| 2 | 0=carries indices; 1=carries elemexprs |
232232

233233
which yields this view, with the fields carried by each flag value:
234234

@@ -356,7 +356,7 @@ The bounds check is performed before any data are written.
356356

357357
### `table.init`, `elem.drop`, and `table.copy` instructions
358358

359-
The `table.*` instructions behave similary to the `memory.*` instructions, with
359+
The `table.*` instructions behave similarly to the `memory.*` instructions, with
360360
the difference that they operate on element segments and tables, instead of
361361
data segments and memories. The offset and length operands of `table.init` and
362362
`table.copy` have element units instead of bytes as well.

proposals/multi-value/Overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- instructions: `value* -> value?`
1010
- blocks: `[] -> value?`
1111

12-
* In a stack machine, these asymmetries are artifical restrictions
12+
* In a stack machine, these asymmetries are artificial restrictions
1313
- were imposed to simplify the initial WebAssembly release (multiple results deferred to post-MVP)
1414
- can easily be lifted by generalising to value* -> value*
1515

@@ -32,7 +32,7 @@
3232
- loop labels can have arguments
3333
- can represent phis on backward edges
3434
- enable future `pick` operator to cross block boundary
35-
- macro definability of instructons with inputs
35+
- macro definability of instructions with inputs
3636
* `i32.select3` = `dup if ... else ... end`
3737

3838

proposals/reference-types/Overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ New/extended instructions:
9595
* The new instruction `table.fill` fills a range in a table with a value.
9696
- `table.fill $x : [i32 t i32] -> []`
9797
- iff `$x : table t`
98-
- the first operand is the start index of the range, the third operand its length (analoguous to `memory.fill`)
99-
- traps when range+length > size of the table, but only after filling range up to size (analoguous to `memory.fill`)
98+
- the first operand is the start index of the range, the third operand its length (analogous to `memory.fill`)
99+
- traps when range+length > size of the table, but only after filling range up to size (analogous to `memory.fill`)
100100

101101
* The `table.init` instruction takes an additional table index as immediate.
102102
- `table.init $x $y : [i32 i32 i32] -> []`

proposals/simd/SIMD.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ packed data in one instruction. These are commonly used to improve performance
1818
for multimedia applications. The set of SIMD instructions in hardware is large,
1919
and varies across different versions of hardware. This proposal is comprised
2020
of a portable subset of operations that in most cases map to commonly used
21-
instructions in mordern hardware.
21+
instructions in modern hardware.
2222

2323

2424
# Types
@@ -136,14 +136,14 @@ Accessing WebAssembly module imports or exports containing SIMD Type from JavaSc
136136

137137
### Module Function Imports
138138

139-
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).
139+
Calling an imported function from JavaScript when the function arguments or result is of type v128 will cause the host function to immediately throw a [`TypeError`](https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror).
140140

141141
### Exported Function Exotic Objects
142142

143-
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).
143+
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 immediately throw a [`TypeError`](https://tc39.github.io/ecma262/#sec-native-error-types-used-in-this-standard-typeerror).
144144

145145

146-
## WebAssembly Module Instatiation
146+
## WebAssembly Module Instantiation
147147

148148
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.
149149

test/core/float_exprs.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1986,7 +1986,7 @@
19861986
(assert_return (invoke "f64.xkcd_better_sqrt_5" (f64.const 13.0) (f64.const 4.0) (f64.const 0x1.921fb54442d18p+1) (f64.const 24.0)) (f64.const 0x1.1e3778509a5a3p+1))
19871987

19881988
;; Compute the floating-point radix.
1989-
;; M. A. Malcom. Algorithms to reveal properties of floating-point arithmetic.
1989+
;; M. A. Malcolm. Algorithms to reveal properties of floating-point arithmetic.
19901990
;; Communications of the ACM, 15(11):949-951, November 1972.
19911991
(module
19921992
(func (export "f32.compute_radix") (param $0 f32) (param $1 f32) (result f32)

test/core/simd/simd_load.wast

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;; v128.load operater with normal argument (e.g. (i8x16, i16x8 i32x4))
1+
;; v128.load operator with normal argument (e.g. (i8x16, i16x8 i32x4))
22

33
(module
44
(memory 1)
@@ -13,7 +13,7 @@
1313
(assert_return (invoke "v128.load") (v128.const i32x4 0x03020100 0x07060504 0x0b0a0908 0x0f0e0d0c))
1414

1515

16-
;; v128.load operater as the argument of other SIMD instructions
16+
;; v128.load operator as the argument of other SIMD instructions
1717

1818
(module (memory 1)
1919
(data (i32.const 0) "\00\01\02\03\04\05\06\07\08\09\0a\0b\0c\0d\0e\0f\00\01\02\03")
@@ -185,4 +185,4 @@
185185
(assert_invalid
186186
(module (memory 1) (func (drop (v128.load))))
187187
"type mismatch"
188-
)
188+
)

test/core/simd/simd_store.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
;; v128.store operater with normal argument (e.g. (i8x16, i16x8, i32x4, f32x4))
1+
;; v128.store operator with normal argument (e.g. (i8x16, i16x8, i32x4, f32x4))
22

33
(module
44
(memory 1)

test/core/utf8-custom-section-id.wast

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
"malformed UTF-8 encoding"
137137
)
138138

139-
;; byte after (first) 2-byte prefix not a contination byte
139+
;; byte after (first) 2-byte prefix not a continuation byte
140140
(assert_malformed
141141
(module binary
142142
"\00asm" "\01\00\00\00"

0 commit comments

Comments
 (0)