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

Unified Diff: test/mjsunit/wasm/grow-memory.js

Issue 2216443002: [wasm] Grow memory should return -1 on failure. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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
Index: test/mjsunit/wasm/grow-memory.js
diff --git a/test/mjsunit/wasm/grow-memory.js b/test/mjsunit/wasm/grow-memory.js
index cb90a464825e6c07becb771624422e95d8267192..bfc18f545bccbf2c94ce452dfe190ed6d9445dd0 100644
--- a/test/mjsunit/wasm/grow-memory.js
+++ b/test/mjsunit/wasm/grow-memory.js
@@ -41,13 +41,8 @@ function testGrowMemoryReadWrite() {
assertTraps(kTrapMemOutOfBounds, peek);
}
- try {
- assertEquals(growMem(3), 1);
- } catch (e) {
- assertEquals("object", typeof e);
- assertEquals(e.message, kTrapMsgs[kTrapMemAllocationFail]);
- return;
- }
+ var result = growMem(3);
+ assertTrue(result === 1 || result === -1);
ahaas 2016/08/04 07:17:34 What do you actually assert here? Should growMem f
gdeepti 2016/08/04 16:12:43 The intent here was to reduce flakiness due to all
for (offset = kPageSize; offset <= 4*kPageSize -4; offset++) {
poke(20);
@@ -58,13 +53,8 @@ function testGrowMemoryReadWrite() {
assertTraps(kTrapMemOutOfBounds, peek);
}
- try {
- assertEquals(growMem(15), 4);
- } catch (e) {
- assertEquals("object", typeof e);
- assertEquals(e.message, kTrapMsgs[kTrapMemAllocationFail]);
- return;
- }
+ var result = growMem(15);
+ assertTrue(result === 4 || result === -1);
ahaas 2016/08/04 07:17:34 Same here.
for (offset = 4*kPageSize - 3; offset <= 4*kPageSize + 4; offset++) {
poke(20);
@@ -93,13 +83,8 @@ function testGrowMemoryZeroInitialSize() {
assertTraps(kTrapMemOutOfBounds, peek);
assertTraps(kTrapMemOutOfBounds, poke);
- try {
- assertEquals(growMem(1), 0);
- } catch (e) {
- assertEquals("object", typeof e);
- assertEquals(e.message, kTrapMsgs[kTrapMemAllocationFail]);
- return;
- }
+ var result = growMem(1);
+ assertTrue(result === 0 || result === -1);
ahaas 2016/08/04 07:17:34 Same here.
for(offset = 0; offset <= kPageSize - 4; offset++) {
poke(20);
@@ -119,8 +104,8 @@ function testGrowMemoryTrapMaxPagesZeroInitialMemory() {
var builder = genGrowMemoryBuilder();
var module = builder.instantiate();
var maxPages = 16385;
- function growMem() { return module.exports.grow_memory(maxPages); }
- assertTraps(kTrapMemOutOfBounds, growMem);
+ function growMem(pages) { return module.exports.grow_memory(pages); }
+ assertEquals(growMem(maxPages), -1);
}
testGrowMemoryTrapMaxPagesZeroInitialMemory();
@@ -130,8 +115,8 @@ function testGrowMemoryTrapMaxPages() {
builder.addMemory(1, 1, false);
var module = builder.instantiate();
var maxPages = 16384;
- function growMem() { return module.exports.grow_memory(maxPages); }
- assertTraps(kTrapMemOutOfBounds, growMem);
+ function growMem(pages) { return module.exports.grow_memory(pages); }
+ assertEquals(growMem(maxPages), -1);
}
testGrowMemoryTrapMaxPages();

Powered by Google App Engine
This is Rietveld 408576698