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: document/js-api/index.bs
+15-22
Original file line number
Diff line number
Diff line change
@@ -740,14 +740,9 @@ interface Table {
740
740
};
741
741
</pre>
742
742
743
-
<div>
744
-
A {{Table}} object represents a single [=table instance=]
745
-
which can be simultaneously referenced by multiple {{Instance}} objects.
746
-
Each {{Table}} object has the following internal slots:
747
-
748
-
* \[[Table]] : a [=table address=]
749
-
* \[[Values]] : a [=list=] whose elements depend on the element type of \[[Table]]'s [=table type=].
750
-
</div>
743
+
A {{Table}} object represents a single [=table instance=] which can be simultaneously referenced by
744
+
multiple {{Instance}} objects.
745
+
Each {{Table}} object has a \[[Table]] internal slot, which is a [=table address=].
751
746
752
747
<div algorithm>
753
748
To <dfn>initialize a table object</dfn> |table| from a [=table address=] |tableaddr|, perform the following steps:
@@ -770,7 +765,7 @@ Each {{Table}} object has the following internal slots:
770
765
<div algorithm>
771
766
The <dfn constructor for="Table">Table(|descriptor|, |value|)</dfn> constructor, when invoked, performs the following steps:
772
767
1. Let |elementType| be [=ToValueType=](|descriptor|["element"]).
773
-
1. let |initial| be |descriptor|["initial"].
768
+
1. Let |initial| be |descriptor|["initial"].
774
769
1. If |descriptor|["maximum"][=map/exists=], let |maximum| be |descriptor|["maximum"]; otherwise, let |maximum| be empty.
775
770
1. If |maximum| is not empty and |maximum| < |initial|, throw a {{RangeError}} exception.
776
771
1. If |value| is missing,
@@ -782,8 +777,6 @@ Each {{Table}} object has the following internal slots:
782
777
1. Let (|store|, |tableaddr|) be [=table_alloc=](|store|, |type|, |ref|). <!-- TODO(littledan): Report allocation failure https://github.com/WebAssembly/spec/issues/584 -->
783
778
1. Set the [=surrounding agent=]'s [=associated store=] to |store|.
784
779
1. [=initialize a table object|Initialize=] **this** from |tableaddr|.
785
-
1. [=list/Empty=] **this**.\[[Values]].
786
-
1. [=list/Append=] |value| to **this**.\[[Values]] |initial| times.
787
780
</div>
788
781
789
782
<div algorithm=dom-Table-grow>
@@ -802,7 +795,6 @@ Each {{Table}} object has the following internal slots:
802
795
Note: The above exception can happen due to either insufficient memory or an invalid size parameter.
803
796
804
797
1. Set the [=surrounding agent=]'s [=associated store=] to |result|.
805
-
1. [=list/Append=] |value| to **this**.\[[Values]] |delta| times.
806
798
1. Return |initialSize|.
807
799
</div>
808
800
@@ -819,14 +811,12 @@ Each {{Table}} object has the following internal slots:
819
811
1. Let |store| be the [=surrounding agent=]'s [=associated store=].
820
812
1. Let |result| be [=table_read=](|store|, |tableaddr|, |index|).
821
813
1. If |result| is [=error=], throw a {{RangeError}} exception.
822
-
1. Let |function| be the result of creating [=a new Exported Function=] from |result|.
823
-
1. Return |function|.
814
+
1. Return [=ToJSValue=](|result|).
824
815
</div>
825
816
826
817
<div algorithm>
827
818
The <dfn method for="Table">set(|index|, |value|)</dfn> method, when invoked, performs the following steps:
828
819
1. Let |tableaddr| be **this**.\[[Table]].
829
-
1. Let |values| be **this**.\[[Values]].
830
820
1. Let (<var ignore>limits</var>, |elementType|) be [=table_type=](|tableaddr|).
831
821
1. If |value| is missing,
832
822
1. Let |ref| be [=DefaultValue=](|elementType|).
@@ -897,7 +887,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
897
887
1. If |s| equals "i64", return [=i64=].
898
888
1. If |s| equals "f32", return [=f32=].
899
889
1. If |s| equals "f64", return [=f64=].
900
-
1. If |s| equals "funcref", return [=funcref=].
890
+
1. If |s| equals "anyfunc", return [=funcref=].
901
891
1. If |s| equals "externref", return [=externref=].
902
892
1. Assert: This step is not reached.
903
893
</div>
@@ -908,6 +898,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
908
898
1. If |valuetype| equals [=i64=], return [=i64.const=] 0.
909
899
1. If |valuetype| equals [=f32=], return [=f32.const=] 0.
910
900
1. If |valuetype| equals [=f64=], return [=f64.const=] 0.
901
+
1. If |valuetype| equals [=funcref=], return [=ref.null=][=funcref=].
911
902
1. If |valuetype| equals [=externref=], return [=ToWebAssemblyValue=](undefined, |valuetype|).
912
903
1. Assert: This step is not reached.
913
904
</div>
@@ -917,7 +908,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
917
908
1. Let |mutable| be |descriptor|["mutable"].
918
909
1. Let |valuetype| be [=ToValueType=](|descriptor|["value"]).
919
910
1. If |v| is missing,
920
-
1. let |value| be [=DefaultValue=](|valuetype|).
911
+
1. Let |value| be [=DefaultValue=](|valuetype|).
921
912
1. Otherwise,
922
913
1. Let |value| be [=ToWebAssemblyValue=](|v|, |valuetype|).
923
914
1. If |mutable| is true, let |globaltype| be [=var=] |valuetype|; otherwise, let |globaltype| be [=const=] |valuetype|.
@@ -1088,10 +1079,13 @@ Note: Number values which are equal to NaN may have various observable NaN paylo
1088
1079
</div>
1089
1080
1090
1081
<div algorithm>
1091
-
For <dfn>retrieving an extern value</dfn> from a [=extern address=] |externaddr|, perform the following steps:
1092
-
1. Let |map| be the [=surrounding agent=]'s associated [=extern value cache=].
1093
-
1. Assert: |map|[|externaddr|][=map/exists=].
1094
-
1. Return |map|[|externaddr|].
1082
+
1083
+
For <dfn>retrieving an extern value</dfn> from an [=extern address=] |externaddr|, perform the following steps:
1084
+
1085
+
1. Let |map| be the [=surrounding agent=]'s associated [=extern value cache=].
1086
+
1. Assert: |map|[|externaddr|][=map/exists=].
1087
+
1. Return |map|[|externaddr|].
1088
+
1095
1089
</div>
1096
1090
1097
1091
<div algorithm>
@@ -1129,7 +1123,6 @@ The algorithm <dfn>ToWebAssemblyValue</dfn>(|v|, |type|) coerces a JavaScript va
1129
1123
1130
1124
</div>
1131
1125
1132
-
1133
1126
<h3 id="error-objects">Error Objects</h3>
1134
1127
1135
1128
WebAssembly defines the following Error classes: <dfn exception>CompileError</dfn>, <dfn exception>LinkError</dfn>, and <dfn exception>RuntimeError</dfn>.
0 commit comments