| 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 "test/unittests/test-utils.h" | 9 #include "test/unittests/test-utils.h" |
| 10 | 10 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 // Insert dummy ops to force longer jumps | 127 // Insert dummy ops to force longer jumps |
| 128 for (int i = 0; i < 128; i++) { | 128 for (int i = 0; i < 128; i++) { |
| 129 builder.LoadTrue(); | 129 builder.LoadTrue(); |
| 130 } | 130 } |
| 131 // Longer jumps requiring Constant operand | 131 // Longer jumps requiring Constant operand |
| 132 builder.Jump(&start) | 132 builder.Jump(&start) |
| 133 .JumpIfTrue(&start) | 133 .JumpIfTrue(&start) |
| 134 .JumpIfFalse(&start) | 134 .JumpIfFalse(&start) |
| 135 .JumpIfToBooleanTrue(&start) | 135 .JumpIfToBooleanTrue(&start) |
| 136 .JumpIfToBooleanFalse(&start); | 136 .JumpIfToBooleanFalse(&start); |
| 137 |
| 138 builder.EnterBlock() |
| 139 .Throw() |
| 140 .LeaveBlock(); |
| 141 |
| 137 builder.Return(); | 142 builder.Return(); |
| 138 | 143 |
| 139 // Generate BytecodeArray. | 144 // Generate BytecodeArray. |
| 140 Handle<BytecodeArray> the_array = builder.ToBytecodeArray(); | 145 Handle<BytecodeArray> the_array = builder.ToBytecodeArray(); |
| 141 CHECK_EQ(the_array->frame_size(), | 146 CHECK_EQ(the_array->frame_size(), |
| 142 builder.fixed_register_count() * kPointerSize); | 147 builder.fixed_register_count() * kPointerSize); |
| 143 | 148 |
| 144 // Build scorecard of bytecodes encountered in the BytecodeArray. | 149 // Build scorecard of bytecodes encountered in the BytecodeArray. |
| 145 std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1); | 150 std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1); |
| 146 Bytecode final_bytecode = Bytecode::kLdaZero; | 151 Bytecode final_bytecode = Bytecode::kLdaZero; |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 | 500 |
| 496 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 501 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
| 497 iterator.Advance(); | 502 iterator.Advance(); |
| 498 CHECK(iterator.done()); | 503 CHECK(iterator.done()); |
| 499 } | 504 } |
| 500 | 505 |
| 501 | 506 |
| 502 } // namespace interpreter | 507 } // namespace interpreter |
| 503 } // namespace internal | 508 } // namespace internal |
| 504 } // namespace v8 | 509 } // namespace v8 |
| OLD | NEW |