| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 Handle<BytecodeArray> output = | 70 Handle<BytecodeArray> output = |
| 71 factory->NewBytecodeArray(bytecode_size, &bytecodes_.front(), frame_size, | 71 factory->NewBytecodeArray(bytecode_size, &bytecodes_.front(), frame_size, |
| 72 parameter_count_, constant_pool); | 72 parameter_count_, constant_pool); |
| 73 bytecode_generated_ = true; | 73 bytecode_generated_ = true; |
| 74 return output; | 74 return output; |
| 75 } | 75 } |
| 76 | 76 |
| 77 | 77 |
| 78 template <size_t N> | 78 template <size_t N> |
| 79 void BytecodeArrayBuilder::Output(Bytecode bytecode, uint32_t(&operands)[N]) { | 79 void BytecodeArrayBuilder::Output(Bytecode bytecode, uint32_t(&operands)[N]) { |
| 80 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), N); | 80 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), static_cast<int>(N)); |
| 81 last_bytecode_start_ = bytecodes()->size(); | 81 last_bytecode_start_ = bytecodes()->size(); |
| 82 bytecodes()->push_back(Bytecodes::ToByte(bytecode)); | 82 bytecodes()->push_back(Bytecodes::ToByte(bytecode)); |
| 83 for (int i = 0; i < static_cast<int>(N); i++) { | 83 for (int i = 0; i < static_cast<int>(N); i++) { |
| 84 DCHECK(OperandIsValid(bytecode, i, operands[i])); | 84 DCHECK(OperandIsValid(bytecode, i, operands[i])); |
| 85 switch (Bytecodes::GetOperandSize(bytecode, i)) { | 85 switch (Bytecodes::GetOperandSize(bytecode, i)) { |
| 86 case OperandSize::kNone: | 86 case OperandSize::kNone: |
| 87 UNREACHABLE(); | 87 UNREACHABLE(); |
| 88 case OperandSize::kByte: | 88 case OperandSize::kByte: |
| 89 bytecodes()->push_back(static_cast<uint8_t>(operands[i])); | 89 bytecodes()->push_back(static_cast<uint8_t>(operands[i])); |
| 90 break; | 90 break; |
| (...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 | 627 |
| 628 Register TemporaryRegisterScope::NewRegister() { | 628 Register TemporaryRegisterScope::NewRegister() { |
| 629 count_++; | 629 count_++; |
| 630 last_register_index_ = builder_->BorrowTemporaryRegister(); | 630 last_register_index_ = builder_->BorrowTemporaryRegister(); |
| 631 return Register(last_register_index_); | 631 return Register(last_register_index_); |
| 632 } | 632 } |
| 633 | 633 |
| 634 } // namespace interpreter | 634 } // namespace interpreter |
| 635 } // namespace internal | 635 } // namespace internal |
| 636 } // namespace v8 | 636 } // namespace v8 |
| OLD | NEW |