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 #include "src/compiler.h" | 6 #include "src/compiler.h" |
7 | 7 |
8 namespace v8 { | 8 namespace v8 { |
9 namespace internal { | 9 namespace internal { |
10 namespace interpreter { | 10 namespace interpreter { |
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
713 label->bind_to(bytecodes()->size()); | 713 label->bind_to(bytecodes()->size()); |
714 LeaveBasicBlock(); | 714 LeaveBasicBlock(); |
715 return *this; | 715 return *this; |
716 } | 716 } |
717 | 717 |
718 | 718 |
719 BytecodeArrayBuilder& BytecodeArrayBuilder::Bind(const BytecodeLabel& target, | 719 BytecodeArrayBuilder& BytecodeArrayBuilder::Bind(const BytecodeLabel& target, |
720 BytecodeLabel* label) { | 720 BytecodeLabel* label) { |
721 DCHECK(!label->is_bound()); | 721 DCHECK(!label->is_bound()); |
722 DCHECK(target.is_bound()); | 722 DCHECK(target.is_bound()); |
723 PatchJump(bytecodes()->begin() + target.offset(), | 723 if (label->is_forward_target()) { |
724 bytecodes()->begin() + label->offset()); | 724 // An earlier jump instruction refers to this label. Update it's location. |
| 725 PatchJump(bytecodes()->begin() + target.offset(), |
| 726 bytecodes()->begin() + label->offset()); |
| 727 // Now treat as if the label will only be back referred to. |
| 728 } |
725 label->bind_to(target.offset()); | 729 label->bind_to(target.offset()); |
726 LeaveBasicBlock(); | 730 LeaveBasicBlock(); |
727 return *this; | 731 return *this; |
728 } | 732 } |
729 | 733 |
730 | 734 |
731 // static | 735 // static |
732 Bytecode BytecodeArrayBuilder::GetJumpWithConstantOperand( | 736 Bytecode BytecodeArrayBuilder::GetJumpWithConstantOperand( |
733 Bytecode jump_bytecode) { | 737 Bytecode jump_bytecode) { |
734 switch (jump_bytecode) { | 738 switch (jump_bytecode) { |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1634 } | 1638 } |
1635 | 1639 |
1636 // static | 1640 // static |
1637 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { | 1641 bool BytecodeArrayBuilder::FitsInReg16OperandUntranslated(Register value) { |
1638 return value.is_short_operand(); | 1642 return value.is_short_operand(); |
1639 } | 1643 } |
1640 | 1644 |
1641 } // namespace interpreter | 1645 } // namespace interpreter |
1642 } // namespace internal | 1646 } // namespace internal |
1643 } // namespace v8 | 1647 } // namespace v8 |
OLD | NEW |