Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Unified Diff: test/mjsunit/wasm/table.js

Issue 2977543002: [wasm] Allow full u32 range for table maximum in WebAssembly.Table constructor. (Closed)
Patch Set: [wasm] Allow full u32 range for table maximum in WebAssembly.Table constructor. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-objects.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/wasm/table.js
diff --git a/test/mjsunit/wasm/table.js b/test/mjsunit/wasm/table.js
index ed5c61f41a6f91ed5cff054e3f063866e0333fa2..c63eb5a2b251cd703227de6ec02dfed6201dd8c3 100644
--- a/test/mjsunit/wasm/table.js
+++ b/test/mjsunit/wasm/table.js
@@ -14,13 +14,15 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
var outOfUint32RangeValue = 1e12;
var int32ButOob = 1073741824;
var kMaxUint32 = (4 * 1024 * 1024 * 1024) - 1;
+var kMaxUint31 = (2 * 1024 * 1024 * 1024) - 1;
var kV8MaxWasmTableSize = 10000000;
-function assertTableIsValid(table) {
+function assertTableIsValid(table, length) {
assertSame(WebAssembly.Table.prototype, table.__proto__);
assertSame(WebAssembly.Table, table.constructor);
assertTrue(table instanceof Object);
assertTrue(table instanceof WebAssembly.Table);
+ assertEquals(length, table.length);
}
(function TestConstructor() {
@@ -57,56 +59,48 @@ function assertTableIsValid(table) {
let table;
table = new WebAssembly.Table({element: "anyfunc", initial: 1});
- assertTableIsValid(table);
- assertEquals(1, table.length);
+ assertTableIsValid(table, 1);
assertEquals(null, table.get(0));
assertEquals(undefined, table[0]);
table = new WebAssembly.Table({element: "anyfunc", initial: "2"});
- assertTableIsValid(table);
- assertEquals(2, table.length);
+ assertTableIsValid(table, 2);
assertEquals(null, table.get(0));
assertEquals(null, table.get(1));
assertEquals(undefined, table[0]);
assertEquals(undefined, table[1]);
table = new WebAssembly.Table({element: "anyfunc", initial: {valueOf() { return "1" }}});
- assertTableIsValid(table);
- assertEquals(1, table.length);
+ assertTableIsValid(table, 1);
assertEquals(null, table.get(0));
assertEquals(undefined, table[0]);
table = new WebAssembly.Table({element: "anyfunc", initial: undefined});
- assertTableIsValid(table);
- assertEquals(0, table.length);
+ assertTableIsValid(table, 0);
table = new WebAssembly.Table({element: "anyfunc"});
- assertTableIsValid(table);
- assertEquals(0, table.length);
+ assertTableIsValid(table, 0);
table = new WebAssembly.Table({element: "anyfunc", maximum: 10});
- assertTableIsValid(table);
- assertEquals(0, table.length);
+ assertTableIsValid(table, 0);
table = new WebAssembly.Table({element: "anyfunc", maximum: "10"});
- assertTableIsValid(table);
- assertEquals(0, table.length);
+ assertTableIsValid(table, 0);
table = new WebAssembly.Table({element: "anyfunc", maximum: {valueOf() { return "10" }}});
- assertTableIsValid(table);
- assertEquals(0, table.length);
+ assertTableIsValid(table, 0);
table = new WebAssembly.Table({element: "anyfunc", initial: 0, maximum: undefined});
- assertTableIsValid(table);
- assertEquals(0, table.length);
+ assertTableIsValid(table, 0);
+
+ table = new WebAssembly.Table({element: "anyfunc", maximum: kMaxUint31});
+ assertTableIsValid(table, 0);
table = new WebAssembly.Table({element: "anyfunc", maximum: kMaxUint32});
- assertTableIsValid(table);
- assertEquals(0, table.length);
+ assertTableIsValid(table, 0);
table = new WebAssembly.Table({element: "anyfunc", maximum: kV8MaxWasmTableSize + 1});
- assertTableIsValid(table);
- assertEquals(0, table.length);
+ assertTableIsValid(table, 0);
})();
(function TestMaximumIsReadOnce() {
@@ -123,7 +117,7 @@ function assertTableIsValid(table) {
}
}});
let table = new WebAssembly.Table(desc);
- assertTableIsValid(table);
+ assertTableIsValid(table, 10);
})();
(function TestMaximumDoesHasProperty() {
@@ -134,7 +128,7 @@ function assertTableIsValid(table) {
});
Object.setPrototypeOf(desc, proxy);
let table = new WebAssembly.Table(desc);
- assertTableIsValid(table);
+ assertTableIsValid(table, 10);
})();
(function TestLength() {
« no previous file with comments | « src/wasm/wasm-objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698