| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "test/unittests/test-utils.h" | 5 #include "test/unittests/test-utils.h" |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #include "test/cctest/wasm/test-signatures.h" | 9 #include "test/cctest/wasm/test-signatures.h" |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 byte code[] = {kExprLoop, 0}; | 42 byte code[] = {kExprLoop, 0}; |
| 43 for (int i = 0; i < 5; i++) { | 43 for (int i = 0; i < 5; i++) { |
| 44 BitVector* assigned = Analyze(code, code + arraysize(code)); | 44 BitVector* assigned = Analyze(code, code + arraysize(code)); |
| 45 for (int j = 0; j < assigned->length(); j++) { | 45 for (int j = 0; j < assigned->length(); j++) { |
| 46 CHECK_EQ(false, assigned->Contains(j)); | 46 CHECK_EQ(false, assigned->Contains(j)); |
| 47 } | 47 } |
| 48 num_locals++; | 48 num_locals++; |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 | 51 |
| 52 TEST_F(WasmLoopAssignmentAnalyzerTest, regress_642867) { |
| 53 static const byte code[] = { |
| 54 WASM_LOOP(WASM_ZERO, kExprSetLocal, 0xfa, 0xff, 0xff, 0xff, |
| 55 0x0f)}; // local index LEB128 0xfffffffa |
| 56 BitVector* assigned = Analyze(code, code + arraysize(code)); |
| 57 CHECK_NULL(assigned); |
| 58 } |
| 59 |
| 52 TEST_F(WasmLoopAssignmentAnalyzerTest, One) { | 60 TEST_F(WasmLoopAssignmentAnalyzerTest, One) { |
| 53 num_locals = 5; | 61 num_locals = 5; |
| 54 for (int i = 0; i < 5; i++) { | 62 for (int i = 0; i < 5; i++) { |
| 55 byte code[] = {WASM_LOOP(WASM_SET_ZERO(i))}; | 63 byte code[] = {WASM_LOOP(WASM_SET_ZERO(i))}; |
| 56 BitVector* assigned = Analyze(code, code + arraysize(code)); | 64 BitVector* assigned = Analyze(code, code + arraysize(code)); |
| 57 for (int j = 0; j < assigned->length(); j++) { | 65 for (int j = 0; j < assigned->length(); j++) { |
| 58 CHECK_EQ(j == i, assigned->Contains(j)); | 66 CHECK_EQ(j == i, assigned->Contains(j)); |
| 59 } | 67 } |
| 60 } | 68 } |
| 61 } | 69 } |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 byte code[] = {kExprLoop, kExprF32Neg, kExprBrTable, 0x0e, 'h', 'e', | 191 byte code[] = {kExprLoop, kExprF32Neg, kExprBrTable, 0x0e, 'h', 'e', |
| 184 'l', 'l', 'o', ',', ' ', 'w', | 192 'l', 'l', 'o', ',', ' ', 'w', |
| 185 'o', 'r', 'l', 'd', '!'}; | 193 'o', 'r', 'l', 'd', '!'}; |
| 186 BitVector* assigned = Analyze(code, code + arraysize(code)); | 194 BitVector* assigned = Analyze(code, code + arraysize(code)); |
| 187 CHECK_NULL(assigned); | 195 CHECK_NULL(assigned); |
| 188 } | 196 } |
| 189 | 197 |
| 190 } // namespace wasm | 198 } // namespace wasm |
| 191 } // namespace internal | 199 } // namespace internal |
| 192 } // namespace v8 | 200 } // namespace v8 |
| OLD | NEW |