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

Unified Diff: test/unittests/wasm/loop-assignment-analysis-unittest.cc

Issue 2345593003: [wasm] Master CL for Binary 0xC changes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix test failures and TSAN races. 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/unittests/wasm/control-transfer-unittest.cc ('k') | test/unittests/wasm/module-decoder-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/wasm/loop-assignment-analysis-unittest.cc
diff --git a/test/unittests/wasm/loop-assignment-analysis-unittest.cc b/test/unittests/wasm/loop-assignment-analysis-unittest.cc
index 9c89d5df586fb13ea1936f4ad44affcb8b3e3b94..f4e4be5fb2f636eeb3d992a0ad60769b3c5e804f 100644
--- a/test/unittests/wasm/loop-assignment-analysis-unittest.cc
+++ b/test/unittests/wasm/loop-assignment-analysis-unittest.cc
@@ -39,7 +39,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Empty0) {
}
TEST_F(WasmLoopAssignmentAnalyzerTest, Empty1) {
- byte code[] = {kExprLoop, 0};
+ byte code[] = {kExprLoop, kLocalVoid, 0};
for (int i = 0; i < 5; i++) {
BitVector* assigned = Analyze(code, code + arraysize(code));
for (int j = 0; j < assigned->length(); j++) {
@@ -60,6 +60,17 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, One) {
}
}
+TEST_F(WasmLoopAssignmentAnalyzerTest, TeeOne) {
+ num_locals = 5;
+ for (int i = 0; i < 5; i++) {
+ byte code[] = {WASM_LOOP(WASM_TEE_LOCAL(i, WASM_ZERO))};
+ BitVector* assigned = Analyze(code, code + arraysize(code));
+ for (int j = 0; j < assigned->length(); j++) {
+ CHECK_EQ(j == i, assigned->Contains(j));
+ }
+ }
+}
+
TEST_F(WasmLoopAssignmentAnalyzerTest, OneBeyond) {
num_locals = 5;
for (int i = 0; i < 5; i++) {
@@ -98,24 +109,10 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, NestedIf) {
}
}
-static byte LEBByte(uint32_t val, byte which) {
- byte b = (val >> (which * 7)) & 0x7F;
- if (val >> ((which + 1) * 7)) b |= 0x80;
- return b;
-}
-
TEST_F(WasmLoopAssignmentAnalyzerTest, BigLocal) {
num_locals = 65000;
for (int i = 13; i < 65000; i = static_cast<int>(i * 1.5)) {
- byte code[] = {kExprLoop,
- 1,
- kExprSetLocal,
- LEBByte(i, 0),
- LEBByte(i, 1),
- LEBByte(i, 2),
- 11,
- 12,
- 13};
+ byte code[] = {WASM_LOOP(WASM_I8(11), kExprSetLocal, U32V_3(i))};
BitVector* assigned = Analyze(code, code + arraysize(code));
for (int j = 0; j < assigned->length(); j++) {
@@ -172,7 +169,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Loop2) {
WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO, WASM_GET_LOCAL(kSum)),
WASM_GET_LOCAL(kIter))};
- BitVector* assigned = Analyze(code + 1, code + arraysize(code));
+ BitVector* assigned = Analyze(code + 2, code + arraysize(code));
for (int j = 0; j < assigned->length(); j++) {
bool expected = j == kIter || j == kSum;
CHECK_EQ(expected, assigned->Contains(j));
@@ -180,9 +177,9 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Loop2) {
}
TEST_F(WasmLoopAssignmentAnalyzerTest, Malformed) {
- byte code[] = {kExprLoop, kExprF32Neg, kExprBrTable, 0x0e, 'h', 'e',
- 'l', 'l', 'o', ',', ' ', 'w',
- 'o', 'r', 'l', 'd', '!'};
+ byte code[] = {kExprLoop, kLocalVoid, kExprF32Neg, kExprBrTable, 0x0e, 'h',
+ 'e', 'l', 'l', 'o', ',', ' ',
+ 'w', 'o', 'r', 'l', 'd', '!'};
BitVector* assigned = Analyze(code, code + arraysize(code));
CHECK_NULL(assigned);
}
« no previous file with comments | « test/unittests/wasm/control-transfer-unittest.cc ('k') | test/unittests/wasm/module-decoder-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698