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 958621970c7f6a68febb1d2493e95c8896cc31b6..e77c1cfff54306aed9124be57920b5aa82ae1767 100644 |
--- a/test/unittests/wasm/loop-assignment-analysis-unittest.cc |
+++ b/test/unittests/wasm/loop-assignment-analysis-unittest.cc |
@@ -23,25 +23,12 @@ namespace wasm { |
class WasmLoopAssignmentAnalyzerTest : public TestWithZone { |
public: |
- WasmLoopAssignmentAnalyzerTest() : TestWithZone(), sigs() { |
- init_env(&env, sigs.v_v()); |
- } |
- |
+ WasmLoopAssignmentAnalyzerTest() : num_locals(0) {} |
TestSignatures sigs; |
- FunctionEnv env; |
- |
- static void init_env(FunctionEnv* env, FunctionSig* sig) { |
- env->module = nullptr; |
- env->sig = sig; |
- env->local_i32_count = 0; |
- env->local_i64_count = 0; |
- env->local_f32_count = 0; |
- env->local_f64_count = 0; |
- env->SumLocals(); |
- } |
+ uint32_t num_locals; |
BitVector* Analyze(const byte* start, const byte* end) { |
- return AnalyzeLoopAssignmentForTesting(zone(), &env, start, end); |
+ return AnalyzeLoopAssignmentForTesting(zone(), num_locals, start, end); |
} |
}; |
@@ -60,13 +47,13 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Empty1) { |
for (int j = 0; j < assigned->length(); j++) { |
CHECK_EQ(false, assigned->Contains(j)); |
} |
- env.AddLocals(kAstI32, 1); |
+ num_locals++; |
} |
} |
TEST_F(WasmLoopAssignmentAnalyzerTest, One) { |
- env.AddLocals(kAstI32, 5); |
+ num_locals = 5; |
for (int i = 0; i < 5; i++) { |
byte code[] = {WASM_LOOP(1, WASM_SET_ZERO(i))}; |
BitVector* assigned = Analyze(code, code + arraysize(code)); |
@@ -78,7 +65,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, One) { |
TEST_F(WasmLoopAssignmentAnalyzerTest, OneBeyond) { |
- env.AddLocals(kAstI32, 5); |
+ num_locals = 5; |
for (int i = 0; i < 5; i++) { |
byte code[] = {WASM_LOOP(1, WASM_SET_ZERO(i)), WASM_SET_ZERO(1)}; |
BitVector* assigned = Analyze(code, code + arraysize(code)); |
@@ -90,7 +77,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, OneBeyond) { |
TEST_F(WasmLoopAssignmentAnalyzerTest, Two) { |
- env.AddLocals(kAstI32, 5); |
+ num_locals = 5; |
for (int i = 0; i < 5; i++) { |
for (int j = 0; j < 5; j++) { |
byte code[] = {WASM_LOOP(2, WASM_SET_ZERO(i), WASM_SET_ZERO(j))}; |
@@ -105,7 +92,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Two) { |
TEST_F(WasmLoopAssignmentAnalyzerTest, NestedIf) { |
- env.AddLocals(kAstI32, 5); |
+ num_locals = 5; |
for (int i = 0; i < 5; i++) { |
byte code[] = {WASM_LOOP( |
1, WASM_IF_ELSE(WASM_SET_ZERO(0), WASM_SET_ZERO(i), WASM_SET_ZERO(1)))}; |
@@ -126,7 +113,7 @@ static byte LEBByte(uint32_t val, byte which) { |
TEST_F(WasmLoopAssignmentAnalyzerTest, BigLocal) { |
- env.AddLocals(kAstI32, 65000); |
+ num_locals = 65000; |
for (int i = 13; i < 65000; i = static_cast<int>(i * 1.5)) { |
byte code[] = {kExprLoop, |
1, |
@@ -148,7 +135,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, BigLocal) { |
TEST_F(WasmLoopAssignmentAnalyzerTest, Break) { |
- env.AddLocals(kAstI32, 3); |
+ num_locals = 3; |
byte code[] = { |
WASM_LOOP(1, WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_SET_ZERO(1)))), |
WASM_SET_ZERO(0)}; |
@@ -162,7 +149,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Break) { |
TEST_F(WasmLoopAssignmentAnalyzerTest, Loop1) { |
- env.AddLocals(kAstI32, 5); |
+ num_locals = 5; |
byte code[] = { |
WASM_LOOP(1, WASM_IF(WASM_GET_LOCAL(0), |
WASM_BRV(0, WASM_SET_LOCAL( |
@@ -179,9 +166,8 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Loop1) { |
TEST_F(WasmLoopAssignmentAnalyzerTest, Loop2) { |
- env.AddLocals(kAstI32, 3); |
+ num_locals = 6; |
const byte kIter = 0; |
- env.AddLocals(kAstF32, 3); |
const byte kSum = 3; |
byte code[] = {WASM_BLOCK( |