OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 "test/unittests/test-utils.h" | 9 #include "test/unittests/test-utils.h" |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 builder.LoadLiteral(heap_num_0) | 39 builder.LoadLiteral(heap_num_0) |
40 .LoadLiteral(heap_num_1) | 40 .LoadLiteral(heap_num_1) |
41 .LoadLiteral(zero) | 41 .LoadLiteral(zero) |
42 .LoadLiteral(smi_0) | 42 .LoadLiteral(smi_0) |
43 .LoadLiteral(smi_1) | 43 .LoadLiteral(smi_1) |
44 .LoadAccumulatorWithRegister(reg_0) | 44 .LoadAccumulatorWithRegister(reg_0) |
45 .LoadNamedProperty(reg_1, name, feedback_slot, LanguageMode::SLOPPY) | 45 .LoadNamedProperty(reg_1, name, feedback_slot, LanguageMode::SLOPPY) |
46 .StoreAccumulatorInRegister(reg_2) | 46 .StoreAccumulatorInRegister(reg_2) |
47 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) | 47 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) |
| 48 .Debugger() |
48 .Return(); | 49 .Return(); |
49 | 50 |
50 // Test iterator sees the expected output from the builder. | 51 // Test iterator sees the expected output from the builder. |
51 BytecodeArrayIterator iterator(builder.ToBytecodeArray()); | 52 BytecodeArrayIterator iterator(builder.ToBytecodeArray()); |
52 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant); | 53 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant); |
53 CHECK(iterator.GetConstantForIndexOperand(0).is_identical_to(heap_num_0)); | 54 CHECK(iterator.GetConstantForIndexOperand(0).is_identical_to(heap_num_0)); |
54 CHECK(!iterator.done()); | 55 CHECK(!iterator.done()); |
55 iterator.Advance(); | 56 iterator.Advance(); |
56 | 57 |
57 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant); | 58 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaConstant); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 iterator.Advance(); | 92 iterator.Advance(); |
92 | 93 |
93 CHECK_EQ(iterator.current_bytecode(), Bytecode::kCallRuntime); | 94 CHECK_EQ(iterator.current_bytecode(), Bytecode::kCallRuntime); |
94 CHECK_EQ(static_cast<Runtime::FunctionId>(iterator.GetIndexOperand(0)), | 95 CHECK_EQ(static_cast<Runtime::FunctionId>(iterator.GetIndexOperand(0)), |
95 Runtime::kLoadIC_Miss); | 96 Runtime::kLoadIC_Miss); |
96 CHECK_EQ(iterator.GetRegisterOperand(1).index(), reg_0.index()); | 97 CHECK_EQ(iterator.GetRegisterOperand(1).index(), reg_0.index()); |
97 CHECK_EQ(iterator.GetCountOperand(2), 1); | 98 CHECK_EQ(iterator.GetCountOperand(2), 1); |
98 CHECK(!iterator.done()); | 99 CHECK(!iterator.done()); |
99 iterator.Advance(); | 100 iterator.Advance(); |
100 | 101 |
| 102 CHECK_EQ(iterator.current_bytecode(), Bytecode::kDebugger); |
| 103 CHECK(!iterator.done()); |
| 104 iterator.Advance(); |
| 105 |
101 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 106 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
102 CHECK(!iterator.done()); | 107 CHECK(!iterator.done()); |
103 iterator.Advance(); | 108 iterator.Advance(); |
104 CHECK(iterator.done()); | 109 CHECK(iterator.done()); |
105 } | 110 } |
106 | 111 |
107 } // namespace interpreter | 112 } // namespace interpreter |
108 } // namespace internal | 113 } // namespace internal |
109 } // namespace v8 | 114 } // namespace v8 |
OLD | NEW |