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
@@ -675,8 +680,8 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
675
680
The <dfn constructor for="Memory">Memory(|descriptor|)</dfn> constructor, when invoked, performs the following steps:
676
681
1. Let |initial| be |descriptor|["initial"].
677
682
1. If |descriptor|["maximum"][=map/exists=], let |maximum| be |descriptor|["maximum"]; otherwise, let |maximum| be empty.
678
-
1. If |maximum| is not empty and |maximum| < |initial|, throw a {{RangeError}} exception.
679
-
1. Let |memtype| be { min |initial|, max |maximum| }.
683
+
1. Let |memtype| be the [=memory type=] { <b>[=limits|min=]</b>|initial|, <b>[=limits|max=]</b> |maximum| }.
684
+
1. If |memtype| is not [=valid memtype|valid=], throw a {{RangeError}} exception.
680
685
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
681
686
1. Let (|store|, |memaddr|) be [=mem_alloc=](|store|, |memtype|). If allocation fails, throw a {{RangeError}} exception.
682
687
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
@@ -836,14 +841,16 @@ Each {{Table}} object has a \[[Table]] internal slot, which is a [=table address
836
841
1. [=Throw=] a {{TypeError}} exception.
837
842
1. Let |initial| be |descriptor|["initial"].
838
843
1. If |descriptor|["maximum"][=map/exists=], let |maximum| be |descriptor|["maximum"]; otherwise, let |maximum| be empty.
839
-
1. If |maximum| is not empty and |maximum| < |initial|, throw a {{RangeError}} exception.
844
+
1. Let |type| be the [=table type=] { <b>[=limits|min=]</b> |initial|, <b>[=limits|max=]</b> |maximum| } |elementType|.
845
+
1. If |type| is not [=valid tabletype|valid=], throw a {{RangeError}} exception.
846
+
847
+
Note: Because tables may have up to 2<sup>32</sup> - 1 elements in validation, the checks for [=limits|min=] ≤ 2<sup>32</sup> - 1 and [=limits|max=] ≤ 2<sup>32</sup> - 1 in [=valid limits|limits validation=] cannot fail.
840
848
1. If |value| is missing,
841
849
1. Let |ref| be [=DefaultValue=](|elementType|).
842
850
1. Otherwise,
843
851
1. Let |ref| be [=?=][=ToWebAssemblyValue=](|value|, |elementType|).
844
-
1. Let |type| be the [=table type=] {[=table type|min=] |initial|, [=table type|max=] |maximum|} |elementType|.
845
852
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
846
-
1. Let (|store|, |tableaddr|) be [=table_alloc=](|store|, |type|, |ref|). <!-- TODO(littledan): Report allocation failure https://github.com/WebAssembly/spec/issues/584 -->
853
+
1. Let (|store|, |tableaddr|) be [=table_alloc=](|store|, |type|, |ref|). If allocation fails, throw a {{RangeError}} exception.
847
854
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
848
855
1. [=initialize a table object|Initialize=] **this** from |tableaddr|.
0 commit comments