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 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 | 42 |
43 | 43 |
44 Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() { | 44 Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() { |
45 DCHECK_EQ(bytecode_generated_, false); | 45 DCHECK_EQ(bytecode_generated_, false); |
46 DCHECK_GE(parameter_count_, 0); | 46 DCHECK_GE(parameter_count_, 0); |
47 DCHECK_GE(local_register_count_, 0); | 47 DCHECK_GE(local_register_count_, 0); |
48 int bytecode_size = static_cast<int>(bytecodes_.size()); | 48 int bytecode_size = static_cast<int>(bytecodes_.size()); |
49 int register_count = local_register_count_ + temporary_register_count_; | 49 int register_count = local_register_count_ + temporary_register_count_; |
50 int frame_size = register_count * kPointerSize; | 50 int frame_size = register_count * kPointerSize; |
51 Handle<BytecodeArray> output = isolate_->factory()->NewBytecodeArray( | 51 Factory* factory = isolate_->factory(); |
52 bytecode_size, &bytecodes_.front(), frame_size, parameter_count_); | 52 Handle<BytecodeArray> output = |
| 53 factory->NewBytecodeArray(bytecode_size, &bytecodes_.front(), frame_size, |
| 54 parameter_count_, factory->empty_fixed_array()); |
53 bytecode_generated_ = true; | 55 bytecode_generated_ = true; |
54 return output; | 56 return output; |
55 } | 57 } |
56 | 58 |
57 | 59 |
58 BytecodeArrayBuilder& BytecodeArrayBuilder::BinaryOperation(Token::Value binop, | 60 BytecodeArrayBuilder& BytecodeArrayBuilder::BinaryOperation(Token::Value binop, |
59 Register reg) { | 61 Register reg) { |
60 Output(BytecodeForBinaryOperation(binop), reg.ToOperand()); | 62 Output(BytecodeForBinaryOperation(binop), reg.ToOperand()); |
61 return *this; | 63 return *this; |
62 } | 64 } |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 237 |
236 Register TemporaryRegisterScope::NewRegister() { | 238 Register TemporaryRegisterScope::NewRegister() { |
237 count_++; | 239 count_++; |
238 last_register_index_ = builder_->BorrowTemporaryRegister(); | 240 last_register_index_ = builder_->BorrowTemporaryRegister(); |
239 return Register(last_register_index_); | 241 return Register(last_register_index_); |
240 } | 242 } |
241 | 243 |
242 } // namespace interpreter | 244 } // namespace interpreter |
243 } // namespace internal | 245 } // namespace internal |
244 } // namespace v8 | 246 } // namespace v8 |
OLD | NEW |