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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 uint8_t code = the_array->get(i); | 300 uint8_t code = the_array->get(i); |
301 scorecard[code] += 1; | 301 scorecard[code] += 1; |
302 final_bytecode = Bytecodes::FromByte(code); | 302 final_bytecode = Bytecodes::FromByte(code); |
303 i += Bytecodes::Size(Bytecodes::FromByte(code)); | 303 i += Bytecodes::Size(Bytecodes::FromByte(code)); |
304 } | 304 } |
305 | 305 |
306 // Check return occurs at the end and only once in the BytecodeArray. | 306 // Check return occurs at the end and only once in the BytecodeArray. |
307 CHECK_EQ(final_bytecode, Bytecode::kReturn); | 307 CHECK_EQ(final_bytecode, Bytecode::kReturn); |
308 CHECK_EQ(scorecard[Bytecodes::ToByte(final_bytecode)], 1); | 308 CHECK_EQ(scorecard[Bytecodes::ToByte(final_bytecode)], 1); |
309 | 309 |
310 #define CHECK_BYTECODE_PRESENT(Name, ...) \ | 310 #define CHECK_BYTECODE_PRESENT(Name, ...) \ |
311 /* Check Bytecode is marked in scorecard */ \ | 311 /* Check Bytecode is marked in scorecard, unless it's a debug break */ \ |
312 CHECK_GE(scorecard[Bytecodes::ToByte(Bytecode::k##Name)], 1); | 312 if (!Bytecodes::IsDebugBreak(Bytecode::k##Name)) { \ |
| 313 CHECK_GE(scorecard[Bytecodes::ToByte(Bytecode::k##Name)], 1); \ |
| 314 } |
313 BYTECODE_LIST(CHECK_BYTECODE_PRESENT) | 315 BYTECODE_LIST(CHECK_BYTECODE_PRESENT) |
314 #undef CHECK_BYTECODE_PRESENT | 316 #undef CHECK_BYTECODE_PRESENT |
315 } | 317 } |
316 | 318 |
317 | 319 |
318 TEST_F(BytecodeArrayBuilderTest, FrameSizesLookGood) { | 320 TEST_F(BytecodeArrayBuilderTest, FrameSizesLookGood) { |
319 for (int locals = 0; locals < 5; locals++) { | 321 for (int locals = 0; locals < 5; locals++) { |
320 for (int contexts = 0; contexts < 4; contexts++) { | 322 for (int contexts = 0; contexts < 4; contexts++) { |
321 for (int temps = 0; temps < 3; temps++) { | 323 for (int temps = 0; temps < 3; temps++) { |
322 BytecodeArrayBuilder builder(isolate(), zone(), 0, contexts, locals); | 324 BytecodeArrayBuilder builder(isolate(), zone(), 0, contexts, locals); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 iterator.Advance(); | 662 iterator.Advance(); |
661 } | 663 } |
662 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 664 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
663 iterator.Advance(); | 665 iterator.Advance(); |
664 CHECK(iterator.done()); | 666 CHECK(iterator.done()); |
665 } | 667 } |
666 | 668 |
667 } // namespace interpreter | 669 } // namespace interpreter |
668 } // namespace internal | 670 } // namespace internal |
669 } // namespace v8 | 671 } // namespace v8 |
OLD | NEW |