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-writer.h" | 5 #include "src/interpreter/bytecode-array-writer.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/interpreter/bytecode-label.h" | 8 #include "src/interpreter/bytecode-label.h" |
9 #include "src/interpreter/bytecode-register.h" | 9 #include "src/interpreter/bytecode-register.h" |
10 #include "src/interpreter/constant-array-builder.h" | 10 #include "src/interpreter/constant-array-builder.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // The jump fits within the range of an Imm16 operand, so cancel | 204 // The jump fits within the range of an Imm16 operand, so cancel |
205 // the reservation and jump directly. | 205 // the reservation and jump directly. |
206 constant_array_builder()->DiscardReservedEntry(OperandSize::kShort); | 206 constant_array_builder()->DiscardReservedEntry(OperandSize::kShort); |
207 WriteUnalignedUInt16(operand_bytes, static_cast<uint16_t>(delta)); | 207 WriteUnalignedUInt16(operand_bytes, static_cast<uint16_t>(delta)); |
208 } else { | 208 } else { |
209 // The jump does not fit within the range of an Imm16 operand, so | 209 // The jump does not fit within the range of an Imm16 operand, so |
210 // commit reservation putting the offset into the constant pool, | 210 // commit reservation putting the offset into the constant pool, |
211 // and update the jump instruction and operand. | 211 // and update the jump instruction and operand. |
212 size_t entry = constant_array_builder()->CommitReservedEntry( | 212 size_t entry = constant_array_builder()->CommitReservedEntry( |
213 OperandSize::kShort, Smi::FromInt(delta)); | 213 OperandSize::kShort, Smi::FromInt(delta)); |
214 DCHECK_EQ(Bytecodes::SizeForUnsignedOperand(static_cast<uint32_t>(entry)), | |
215 OperandSize::kShort); | |
216 jump_bytecode = GetJumpWithConstantOperand(jump_bytecode); | 214 jump_bytecode = GetJumpWithConstantOperand(jump_bytecode); |
217 bytecodes()->at(jump_location) = Bytecodes::ToByte(jump_bytecode); | 215 bytecodes()->at(jump_location) = Bytecodes::ToByte(jump_bytecode); |
218 WriteUnalignedUInt16(operand_bytes, static_cast<uint16_t>(entry)); | 216 WriteUnalignedUInt16(operand_bytes, static_cast<uint16_t>(entry)); |
219 } | 217 } |
220 DCHECK(bytecodes()->at(operand_location) == k8BitJumpPlaceholder && | 218 DCHECK(bytecodes()->at(operand_location) == k8BitJumpPlaceholder && |
221 bytecodes()->at(operand_location + 1) == k8BitJumpPlaceholder); | 219 bytecodes()->at(operand_location + 1) == k8BitJumpPlaceholder); |
222 bytecodes()->at(operand_location++) = operand_bytes[0]; | 220 bytecodes()->at(operand_location++) = operand_bytes[0]; |
223 bytecodes()->at(operand_location) = operand_bytes[1]; | 221 bytecodes()->at(operand_location) = operand_bytes[1]; |
224 } | 222 } |
225 | 223 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 node->set_bytecode(node->bytecode(), k32BitJumpPlaceholder); | 317 node->set_bytecode(node->bytecode(), k32BitJumpPlaceholder); |
320 break; | 318 break; |
321 } | 319 } |
322 } | 320 } |
323 EmitBytecode(node); | 321 EmitBytecode(node); |
324 } | 322 } |
325 | 323 |
326 } // namespace interpreter | 324 } // namespace interpreter |
327 } // namespace internal | 325 } // namespace internal |
328 } // namespace v8 | 326 } // namespace v8 |
OLD | NEW |