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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO, WASM_GET_LOCAL(kSum)), | 173 WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO, WASM_GET_LOCAL(kSum)), |
174 WASM_GET_LOCAL(kIter))}; | 174 WASM_GET_LOCAL(kIter))}; |
175 | 175 |
176 BitVector* assigned = Analyze(code + 1, code + arraysize(code)); | 176 BitVector* assigned = Analyze(code + 1, code + arraysize(code)); |
177 for (int j = 0; j < assigned->length(); j++) { | 177 for (int j = 0; j < assigned->length(); j++) { |
178 bool expected = j == kIter || j == kSum; | 178 bool expected = j == kIter || j == kSum; |
179 CHECK_EQ(expected, assigned->Contains(j)); | 179 CHECK_EQ(expected, assigned->Contains(j)); |
180 } | 180 } |
181 } | 181 } |
182 | 182 |
| 183 TEST_F(WasmLoopAssignmentAnalyzerTest, Malformed) { |
| 184 byte code[] = {kExprLoop, kExprF32Neg, kExprBrTable, 0x0e, 'h', 'e', |
| 185 'l', 'l', 'o', ',', ' ', 'w', |
| 186 'o', 'r', 'l', 'd', '!'}; |
| 187 BitVector* assigned = Analyze(code, code + arraysize(code)); |
| 188 CHECK_NULL(assigned); |
| 189 } |
| 190 |
183 } // namespace wasm | 191 } // namespace wasm |
184 } // namespace internal | 192 } // namespace internal |
185 } // namespace v8 | 193 } // namespace v8 |
OLD | NEW |