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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 PatchJumpWith32BitOperand(jump_location + prefix_offset, delta); | 266 PatchJumpWith32BitOperand(jump_location + prefix_offset, delta); |
267 break; | 267 break; |
268 default: | 268 default: |
269 UNREACHABLE(); | 269 UNREACHABLE(); |
270 } | 270 } |
271 unbound_jumps_--; | 271 unbound_jumps_--; |
272 } | 272 } |
273 | 273 |
274 void BytecodeArrayWriter::EmitJump(BytecodeNode* node, BytecodeLabel* label) { | 274 void BytecodeArrayWriter::EmitJump(BytecodeNode* node, BytecodeLabel* label) { |
275 DCHECK(Bytecodes::IsJump(node->bytecode())); | 275 DCHECK(Bytecodes::IsJump(node->bytecode())); |
276 DCHECK_EQ(0, node->operand(0)); | 276 DCHECK_EQ(0u, node->operand(0)); |
277 | 277 |
278 size_t current_offset = bytecodes()->size(); | 278 size_t current_offset = bytecodes()->size(); |
279 | 279 |
280 if (label->is_bound()) { | 280 if (label->is_bound()) { |
281 CHECK_GE(current_offset, label->offset()); | 281 CHECK_GE(current_offset, label->offset()); |
282 CHECK_LE(current_offset, static_cast<size_t>(kMaxInt)); | 282 CHECK_LE(current_offset, static_cast<size_t>(kMaxInt)); |
283 // Label has been bound already so this is a backwards jump. | 283 // Label has been bound already so this is a backwards jump. |
284 size_t abs_delta = current_offset - label->offset(); | 284 size_t abs_delta = current_offset - label->offset(); |
285 int delta = -static_cast<int>(abs_delta); | 285 int delta = -static_cast<int>(abs_delta); |
286 OperandScale operand_scale = Bytecodes::ScaleForSignedOperand(delta); | 286 OperandScale operand_scale = Bytecodes::ScaleForSignedOperand(delta); |
(...skipping 30 matching lines...) Expand all Loading... |
317 node->set_bytecode(node->bytecode(), k32BitJumpPlaceholder); | 317 node->set_bytecode(node->bytecode(), k32BitJumpPlaceholder); |
318 break; | 318 break; |
319 } | 319 } |
320 } | 320 } |
321 EmitBytecode(node); | 321 EmitBytecode(node); |
322 } | 322 } |
323 | 323 |
324 } // namespace interpreter | 324 } // namespace interpreter |
325 } // namespace internal | 325 } // namespace internal |
326 } // namespace v8 | 326 } // namespace v8 |
OLD | NEW |