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/interpreter/bytecode-array-builder.h" | 5 #include "src/interpreter/bytecode-array-builder.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace interpreter { | 9 namespace interpreter { |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 | 31 |
32 void BytecodeArrayBuilder::set_parameter_count(int number_of_parameters) { | 32 void BytecodeArrayBuilder::set_parameter_count(int number_of_parameters) { |
33 parameter_count_ = number_of_parameters; | 33 parameter_count_ = number_of_parameters; |
34 } | 34 } |
35 | 35 |
36 | 36 |
37 int BytecodeArrayBuilder::parameter_count() const { return parameter_count_; } | 37 int BytecodeArrayBuilder::parameter_count() const { return parameter_count_; } |
38 | 38 |
39 | 39 |
| 40 bool BytecodeArrayBuilder::HasExplicitReturn() { |
| 41 // TODO(rmcilroy): When we have control flow we should return false here if |
| 42 // there is an outstanding jump target, even if the last bytecode is kReturn. |
| 43 return !bytecodes_.empty() && |
| 44 bytecodes_.back() == Bytecodes::ToByte(Bytecode::kReturn); |
| 45 } |
| 46 |
| 47 |
40 Register BytecodeArrayBuilder::Parameter(int parameter_index) { | 48 Register BytecodeArrayBuilder::Parameter(int parameter_index) { |
41 DCHECK_GE(parameter_index, 0); | 49 DCHECK_GE(parameter_index, 0); |
42 DCHECK_LT(parameter_index, parameter_count_); | 50 DCHECK_LT(parameter_index, parameter_count_); |
43 return Register::FromParameterIndex(parameter_index, parameter_count_); | 51 return Register::FromParameterIndex(parameter_index, parameter_count_); |
44 } | 52 } |
45 | 53 |
46 | 54 |
47 Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() { | 55 Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() { |
48 DCHECK_EQ(bytecode_generated_, false); | 56 DCHECK_EQ(bytecode_generated_, false); |
49 DCHECK_GE(parameter_count_, 0); | 57 DCHECK_GE(parameter_count_, 0); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 334 |
327 Register TemporaryRegisterScope::NewRegister() { | 335 Register TemporaryRegisterScope::NewRegister() { |
328 count_++; | 336 count_++; |
329 last_register_index_ = builder_->BorrowTemporaryRegister(); | 337 last_register_index_ = builder_->BorrowTemporaryRegister(); |
330 return Register(last_register_index_); | 338 return Register(last_register_index_); |
331 } | 339 } |
332 | 340 |
333 } // namespace interpreter | 341 } // namespace interpreter |
334 } // namespace internal | 342 } // namespace internal |
335 } // namespace v8 | 343 } // namespace v8 |
OLD | NEW |