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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 Handle<BytecodeArray> output = | 69 Handle<BytecodeArray> output = |
70 factory->NewBytecodeArray(bytecode_size, &bytecodes_.front(), frame_size, | 70 factory->NewBytecodeArray(bytecode_size, &bytecodes_.front(), frame_size, |
71 parameter_count_, constant_pool); | 71 parameter_count_, constant_pool); |
72 bytecode_generated_ = true; | 72 bytecode_generated_ = true; |
73 return output; | 73 return output; |
74 } | 74 } |
75 | 75 |
76 | 76 |
77 template <size_t N> | 77 template <size_t N> |
78 void BytecodeArrayBuilder::Output(uint8_t(&bytes)[N]) { | 78 void BytecodeArrayBuilder::Output(uint8_t(&bytes)[N]) { |
79 DCHECK_EQ(Bytecodes::NumberOfOperands(Bytecodes::FromByte(bytes[0])), N - 1); | 79 DCHECK_EQ(Bytecodes::NumberOfOperands(Bytecodes::FromByte(bytes[0])), |
| 80 static_cast<int>(N) - 1); |
80 last_bytecode_start_ = bytecodes()->size(); | 81 last_bytecode_start_ = bytecodes()->size(); |
81 for (int i = 1; i < static_cast<int>(N); i++) { | 82 for (int i = 1; i < static_cast<int>(N); i++) { |
82 DCHECK(OperandIsValid(Bytecodes::FromByte(bytes[0]), i - 1, bytes[i])); | 83 DCHECK(OperandIsValid(Bytecodes::FromByte(bytes[0]), i - 1, bytes[i])); |
83 } | 84 } |
84 bytecodes()->insert(bytecodes()->end(), bytes, bytes + N); | 85 bytecodes()->insert(bytecodes()->end(), bytes, bytes + N); |
85 } | 86 } |
86 | 87 |
87 | 88 |
88 void BytecodeArrayBuilder::Output(Bytecode bytecode, uint8_t operand0, | 89 void BytecodeArrayBuilder::Output(Bytecode bytecode, uint8_t operand0, |
89 uint8_t operand1, uint8_t operand2) { | 90 uint8_t operand1, uint8_t operand2) { |
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 | 605 |
605 Register TemporaryRegisterScope::NewRegister() { | 606 Register TemporaryRegisterScope::NewRegister() { |
606 count_++; | 607 count_++; |
607 last_register_index_ = builder_->BorrowTemporaryRegister(); | 608 last_register_index_ = builder_->BorrowTemporaryRegister(); |
608 return Register(last_register_index_); | 609 return Register(last_register_index_); |
609 } | 610 } |
610 | 611 |
611 } // namespace interpreter | 612 } // namespace interpreter |
612 } // namespace internal | 613 } // namespace internal |
613 } // namespace v8 | 614 } // namespace v8 |
OLD | NEW |