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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 for (int i = 0; i < static_cast<int>(N); i++) { | 116 for (int i = 0; i < static_cast<int>(N); i++) { |
117 DCHECK(OperandIsValid(bytecode, i, operands[i])); | 117 DCHECK(OperandIsValid(bytecode, i, operands[i])); |
118 switch (Bytecodes::GetOperandSize(bytecode, i)) { | 118 switch (Bytecodes::GetOperandSize(bytecode, i)) { |
119 case OperandSize::kNone: | 119 case OperandSize::kNone: |
120 UNREACHABLE(); | 120 UNREACHABLE(); |
121 case OperandSize::kByte: | 121 case OperandSize::kByte: |
122 bytecodes()->push_back(static_cast<uint8_t>(operands[i])); | 122 bytecodes()->push_back(static_cast<uint8_t>(operands[i])); |
123 break; | 123 break; |
124 case OperandSize::kShort: { | 124 case OperandSize::kShort: { |
125 uint8_t operand_bytes[2]; | 125 uint8_t operand_bytes[2]; |
126 Bytecodes::ShortOperandToBytes(operands[i], operand_bytes); | 126 WriteUnalignedUInt16(operand_bytes, operands[i]); |
127 bytecodes()->insert(bytecodes()->end(), operand_bytes, | 127 bytecodes()->insert(bytecodes()->end(), operand_bytes, |
128 operand_bytes + 2); | 128 operand_bytes + 2); |
129 break; | 129 break; |
130 } | 130 } |
131 } | 131 } |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 | 135 |
136 void BytecodeArrayBuilder::Output(Bytecode bytecode, uint32_t operand0, | 136 void BytecodeArrayBuilder::Output(Bytecode bytecode, uint32_t operand0, |
(...skipping 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1151 DCHECK_GT(next_consecutive_count_, 0); | 1151 DCHECK_GT(next_consecutive_count_, 0); |
1152 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_); | 1152 builder_->BorrowConsecutiveTemporaryRegister(next_consecutive_register_); |
1153 allocated_.push_back(next_consecutive_register_); | 1153 allocated_.push_back(next_consecutive_register_); |
1154 next_consecutive_count_--; | 1154 next_consecutive_count_--; |
1155 return Register(next_consecutive_register_++); | 1155 return Register(next_consecutive_register_++); |
1156 } | 1156 } |
1157 | 1157 |
1158 } // namespace interpreter | 1158 } // namespace interpreter |
1159 } // namespace internal | 1159 } // namespace internal |
1160 } // namespace v8 | 1160 } // namespace v8 |
OLD | NEW |