@@ -569,7 +569,7 @@ enum IndexType {
569569 "i64",
570570};
571571
572- typedef ([EnforceRange] unsigned long long or bigint) IndexValue;
572+ typedef ([EnforceRange] unsigned long or bigint) IndexValue;
573573
574574dictionary ModuleExportDescriptor {
575575 required USVString name;
@@ -683,7 +683,7 @@ dictionary MemoryDescriptor {
683683[LegacyNamespace=WebAssembly, Exposed=*]
684684interface Memory {
685685 constructor(MemoryDescriptor descriptor);
686- unsigned long grow(IndexValue delta);
686+ IndexValue grow(IndexValue delta);
687687 ArrayBuffer toFixedLengthBuffer();
688688 ArrayBuffer toResizableBuffer();
689689 readonly attribute ArrayBuffer buffer;
@@ -792,7 +792,8 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
792792 1. Let |store| be the [=surrounding agent=] 's [=associated store=] .
793793 1. Let |indextype| be the [=index type=] in [=mem_type=] (|store|, |memaddr|).
794794 1. Let |delta64| be [=?=] [=IndexValueToU64=] (|delta|, |indextype|).
795- 1. Return the result of [=grow the memory buffer|growing the memory buffer=] associated with |memaddr| by |delta64|.
795+ 1. Let |ret| be the result of [=grow the memory buffer|growing the memory buffer=] associated with |memaddr| by |delta64|.
796+ 1. Return [=U64ToIndexValue=] (|ret|, |indextype|).
796797</div>
797798
798799Immediately after a WebAssembly [=memory.grow=] instruction executes, perform the following steps:
@@ -1364,7 +1365,9 @@ The algorithm <dfn>IndexValueToU64</dfn>(|v|, |indextype|) asserts that a JavaSc
13641365 1. Otherwise, [=throw=] a {{TypeError}} .
136513661. Else if |indextype| is "i64",
13661367 1. If |v| [=is a BigInt=] ,
1367- 1. If |v| is not equal to [=!=] [$ToBigUint64$] (|v|), [=throw=] a {{RangeError}} .
1368+ 1. If |v| is not equal to [=!=] [$ToBigUint64$] (|v|), [=throw=] a {{TypeError}} .
1369+
1370+ Note: This operation is designed to mirror [=[EnforceRange]=] , which [=throws=] a {{TypeError}} for out-of-range numeric values.
13681371 1. Return [=ℝ=] (|v|) as a WebAssembly [=u64=] .
13691372 1. Otherwise, [=throw=] a {{TypeError}} .
137013731. Assert: This step is not reached.
0 commit comments