OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/interpreter/bytecode-array-builder.h" | 7 #include "src/interpreter/bytecode-array-builder.h" |
8 #include "src/interpreter/bytecode-array-iterator.h" | 8 #include "src/interpreter/bytecode-array-iterator.h" |
9 #include "src/interpreter/bytecode-register-allocator.h" | 9 #include "src/interpreter/bytecode-register-allocator.h" |
10 #include "test/unittests/test-utils.h" | 10 #include "test/unittests/test-utils.h" |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 uint8_t code = the_array->get(i); | 290 uint8_t code = the_array->get(i); |
291 scorecard[code] += 1; | 291 scorecard[code] += 1; |
292 final_bytecode = Bytecodes::FromByte(code); | 292 final_bytecode = Bytecodes::FromByte(code); |
293 i += Bytecodes::Size(Bytecodes::FromByte(code)); | 293 i += Bytecodes::Size(Bytecodes::FromByte(code)); |
294 } | 294 } |
295 | 295 |
296 // Check return occurs at the end and only once in the BytecodeArray. | 296 // Check return occurs at the end and only once in the BytecodeArray. |
297 CHECK_EQ(final_bytecode, Bytecode::kReturn); | 297 CHECK_EQ(final_bytecode, Bytecode::kReturn); |
298 CHECK_EQ(scorecard[Bytecodes::ToByte(final_bytecode)], 1); | 298 CHECK_EQ(scorecard[Bytecodes::ToByte(final_bytecode)], 1); |
299 | 299 |
300 #define CHECK_BYTECODE_PRESENT(Name, ...) \ | 300 #define CHECK_BYTECODE_PRESENT(Name, ...) \ |
301 /* Check Bytecode is marked in scorecard */ \ | 301 /* Check Bytecode is marked in scorecard, unless it's a debug break */ \ |
302 CHECK_GE(scorecard[Bytecodes::ToByte(Bytecode::k##Name)], 1); | 302 if (!Bytecodes::IsDebugBreak(Bytecode::k##Name)) { \ |
| 303 CHECK_GE(scorecard[Bytecodes::ToByte(Bytecode::k##Name)], 1); \ |
| 304 } |
303 BYTECODE_LIST(CHECK_BYTECODE_PRESENT) | 305 BYTECODE_LIST(CHECK_BYTECODE_PRESENT) |
304 #undef CHECK_BYTECODE_PRESENT | 306 #undef CHECK_BYTECODE_PRESENT |
305 } | 307 } |
306 | 308 |
307 | 309 |
308 TEST_F(BytecodeArrayBuilderTest, FrameSizesLookGood) { | 310 TEST_F(BytecodeArrayBuilderTest, FrameSizesLookGood) { |
309 for (int locals = 0; locals < 5; locals++) { | 311 for (int locals = 0; locals < 5; locals++) { |
310 for (int contexts = 0; contexts < 4; contexts++) { | 312 for (int contexts = 0; contexts < 4; contexts++) { |
311 for (int temps = 0; temps < 3; temps++) { | 313 for (int temps = 0; temps < 3; temps++) { |
312 BytecodeArrayBuilder builder(isolate(), zone(), 0, contexts, locals); | 314 BytecodeArrayBuilder builder(isolate(), zone(), 0, contexts, locals); |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 iterator.Advance(); | 648 iterator.Advance(); |
647 } | 649 } |
648 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 650 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
649 iterator.Advance(); | 651 iterator.Advance(); |
650 CHECK(iterator.done()); | 652 CHECK(iterator.done()); |
651 } | 653 } |
652 | 654 |
653 } // namespace interpreter | 655 } // namespace interpreter |
654 } // namespace internal | 656 } // namespace internal |
655 } // namespace v8 | 657 } // namespace v8 |
OLD | NEW |