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

Unified Diff: test/cctest/wasm/test-run-wasm-interpreter.cc

Issue 2361053004: Revert of [wasm] Master CL for Binary 0xC changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 3 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 | « test/cctest/wasm/test-run-wasm-64.cc ('k') | test/cctest/wasm/test-run-wasm-js.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/test-run-wasm-interpreter.cc
diff --git a/test/cctest/wasm/test-run-wasm-interpreter.cc b/test/cctest/wasm/test-run-wasm-interpreter.cc
index 218ee956c03fec4a5a1f895c085db40c8aa17072..db5bb2a786c6891fc7f890fb48c3ca5222d8faa7 100644
--- a/test/cctest/wasm/test-run-wasm-interpreter.cc
+++ b/test/cctest/wasm/test-run-wasm-interpreter.cc
@@ -36,7 +36,7 @@
TEST(Run_WasmIfElse) {
WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Int32());
- BUILD(r, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I8(9), WASM_I8(10)));
+ BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_I8(9), WASM_I8(10)));
CHECK_EQ(10, r.Call(0));
CHECK_EQ(9, r.Call(1));
}
@@ -65,39 +65,31 @@
TEST(Run_WasmConstsN) {
const int kMaxConsts = 10;
- byte code[kMaxConsts * 3];
- int32_t expected = 0;
+ byte code[kMaxConsts * 2];
for (int count = 1; count < kMaxConsts; count++) {
for (int i = 0; i < count; i++) {
- byte val = static_cast<byte>(count * 10 + i);
- code[i * 3] = kExprI8Const;
- code[i * 3 + 1] = val;
- if (i == (count - 1)) {
- code[i * 3 + 2] = kExprNop;
- expected = val;
- } else {
- code[i * 3 + 2] = kExprDrop;
- }
- }
+ code[i * 2] = kExprI8Const;
+ code[i * 2 + 1] = static_cast<byte>(count * 10 + i);
+ }
+ byte expected = static_cast<byte>(count * 11 - 1);
WasmRunner<int32_t> r(kExecuteInterpreted);
- r.Build(code, code + (count * 3));
+ r.Build(code, code + (count * 2));
CHECK_EQ(expected, r.Call());
}
}
TEST(Run_WasmBlocksN) {
const int kMaxNops = 10;
- const int kExtra = 5;
+ const int kExtra = 4;
byte code[kMaxNops + kExtra];
for (int nops = 0; nops < kMaxNops; nops++) {
byte expected = static_cast<byte>(30 + nops);
memset(code, kExprNop, sizeof(code));
code[0] = kExprBlock;
- code[1] = kLocalI32;
- code[2 + nops] = kExprI8Const;
- code[2 + nops + 1] = expected;
- code[2 + nops + 2] = kExprEnd;
+ code[1 + nops] = kExprI8Const;
+ code[1 + nops + 1] = expected;
+ code[1 + nops + 2] = kExprEnd;
WasmRunner<int32_t> r(kExecuteInterpreted);
r.Build(code, code + nops + kExtra);
@@ -114,14 +106,14 @@
for (int index = 0; index < nops; index++) {
memset(code, kExprNop, sizeof(code));
code[0] = kExprBlock;
- code[1] = kLocalI32;
code[sizeof(code) - 1] = kExprEnd;
int expected = nops * 11 + index;
- code[2 + index + 0] = kExprI8Const;
- code[2 + index + 1] = static_cast<byte>(expected);
- code[2 + index + 2] = kExprBr;
- code[2 + index + 3] = 0;
+ code[1 + index + 0] = kExprI8Const;
+ code[1 + index + 1] = static_cast<byte>(expected);
+ code[1 + index + 2] = kExprBr;
+ code[1 + index + 3] = ARITY_1;
+ code[1 + index + 4] = 0;
WasmRunner<int32_t> r(kExecuteInterpreted);
r.Build(code, code + kMaxNops + kExtra);
@@ -134,10 +126,10 @@
WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Int32(),
MachineType::Int32());
- BUILD(r, WASM_IF_ELSE_I(
+ BUILD(r, WASM_IF_ELSE(
WASM_GET_LOCAL(0),
- WASM_IF_ELSE_I(WASM_GET_LOCAL(1), WASM_I8(11), WASM_I8(12)),
- WASM_IF_ELSE_I(WASM_GET_LOCAL(1), WASM_I8(13), WASM_I8(14))));
+ WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_I8(11), WASM_I8(12)),
+ WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_I8(13), WASM_I8(14))));
CHECK_EQ(11, r.Call(1, 1));
CHECK_EQ(12, r.Call(1, 0));
@@ -308,10 +300,10 @@
TestingModule module(kExecuteInterpreted);
WasmRunner<int32_t> r(&module, MachineType::Uint32());
module.AddMemory(WasmModule::kPageSize);
- BUILD(r, WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index),
- WASM_I32V(value)),
- WASM_GROW_MEMORY(WASM_GET_LOCAL(0)), WASM_DROP,
- WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V(index)));
+ BUILD(r, WASM_BLOCK(WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index),
+ WASM_I32V(value)),
+ WASM_GROW_MEMORY(WASM_GET_LOCAL(0)),
+ WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V(index))));
CHECK_EQ(value, r.Call(1));
}
@@ -320,7 +312,7 @@
// Grow memory by an invalid amount without initial memory.
TestingModule module(kExecuteInterpreted);
WasmRunner<int32_t> r(&module, MachineType::Uint32());
- BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0)));
+ BUILD(r, WASM_BLOCK(WASM_GROW_MEMORY(WASM_GET_LOCAL(0))));
CHECK_EQ(-1, r.Call(1048575));
}
{
@@ -328,7 +320,7 @@
TestingModule module(kExecuteInterpreted);
WasmRunner<int32_t> r(&module, MachineType::Uint32());
module.AddMemory(WasmModule::kPageSize);
- BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0)));
+ BUILD(r, WASM_BLOCK(WASM_GROW_MEMORY(WASM_GET_LOCAL(0))));
CHECK_EQ(-1, r.Call(1048575));
}
}
« no previous file with comments | « test/cctest/wasm/test-run-wasm-64.cc ('k') | test/cctest/wasm/test-run-wasm-js.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698