| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef V8_COMPILER_INSTRUCTION_H_ | 5 #ifndef V8_COMPILER_INSTRUCTION_H_ |
| 6 #define V8_COMPILER_INSTRUCTION_H_ | 6 #define V8_COMPILER_INSTRUCTION_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 AddressingMode addressing_mode() const { | 723 AddressingMode addressing_mode() const { |
| 724 return AddressingModeField::decode(opcode()); | 724 return AddressingModeField::decode(opcode()); |
| 725 } | 725 } |
| 726 FlagsMode flags_mode() const { return FlagsModeField::decode(opcode()); } | 726 FlagsMode flags_mode() const { return FlagsModeField::decode(opcode()); } |
| 727 FlagsCondition flags_condition() const { | 727 FlagsCondition flags_condition() const { |
| 728 return FlagsConditionField::decode(opcode()); | 728 return FlagsConditionField::decode(opcode()); |
| 729 } | 729 } |
| 730 | 730 |
| 731 // TODO(titzer): make call into a flags. | 731 // TODO(titzer): make call into a flags. |
| 732 static Instruction* New(Zone* zone, InstructionCode opcode) { | 732 static Instruction* New(Zone* zone, InstructionCode opcode) { |
| 733 return New(zone, opcode, 0, NULL, 0, NULL, 0, NULL); | 733 return New(zone, opcode, 0, nullptr, 0, nullptr, 0, nullptr); |
| 734 } | 734 } |
| 735 | 735 |
| 736 static Instruction* New(Zone* zone, InstructionCode opcode, | 736 static Instruction* New(Zone* zone, InstructionCode opcode, |
| 737 size_t output_count, InstructionOperand* outputs, | 737 size_t output_count, InstructionOperand* outputs, |
| 738 size_t input_count, InstructionOperand* inputs, | 738 size_t input_count, InstructionOperand* inputs, |
| 739 size_t temp_count, InstructionOperand* temps) { | 739 size_t temp_count, InstructionOperand* temps) { |
| 740 DCHECK(opcode >= 0); | 740 DCHECK(opcode >= 0); |
| 741 DCHECK(output_count == 0 || outputs != NULL); | 741 DCHECK(output_count == 0 || outputs != nullptr); |
| 742 DCHECK(input_count == 0 || inputs != NULL); | 742 DCHECK(input_count == 0 || inputs != nullptr); |
| 743 DCHECK(temp_count == 0 || temps != NULL); | 743 DCHECK(temp_count == 0 || temps != nullptr); |
| 744 size_t total_extra_ops = output_count + input_count + temp_count; | 744 size_t total_extra_ops = output_count + input_count + temp_count; |
| 745 if (total_extra_ops != 0) total_extra_ops--; | 745 if (total_extra_ops != 0) total_extra_ops--; |
| 746 int size = static_cast<int>( | 746 int size = static_cast<int>( |
| 747 RoundUp(sizeof(Instruction), sizeof(InstructionOperand)) + | 747 RoundUp(sizeof(Instruction), sizeof(InstructionOperand)) + |
| 748 total_extra_ops * sizeof(InstructionOperand)); | 748 total_extra_ops * sizeof(InstructionOperand)); |
| 749 return new (zone->New(size)) Instruction( | 749 return new (zone->New(size)) Instruction( |
| 750 opcode, output_count, outputs, input_count, inputs, temp_count, temps); | 750 opcode, output_count, outputs, input_count, inputs, temp_count, temps); |
| 751 } | 751 } |
| 752 | 752 |
| 753 Instruction* MarkAsCall() { | 753 Instruction* MarkAsCall() { |
| 754 bit_field_ = IsCallField::update(bit_field_, true); | 754 bit_field_ = IsCallField::update(bit_field_, true); |
| 755 return this; | 755 return this; |
| 756 } | 756 } |
| 757 bool IsCall() const { return IsCallField::decode(bit_field_); } | 757 bool IsCall() const { return IsCallField::decode(bit_field_); } |
| 758 bool NeedsReferenceMap() const { return IsCall(); } | 758 bool NeedsReferenceMap() const { return IsCall(); } |
| 759 bool HasReferenceMap() const { return reference_map_ != NULL; } | 759 bool HasReferenceMap() const { return reference_map_ != nullptr; } |
| 760 | 760 |
| 761 bool ClobbersRegisters() const { return IsCall(); } | 761 bool ClobbersRegisters() const { return IsCall(); } |
| 762 bool ClobbersTemps() const { return IsCall(); } | 762 bool ClobbersTemps() const { return IsCall(); } |
| 763 bool ClobbersDoubleRegisters() const { return IsCall(); } | 763 bool ClobbersDoubleRegisters() const { return IsCall(); } |
| 764 ReferenceMap* reference_map() const { return reference_map_; } | 764 ReferenceMap* reference_map() const { return reference_map_; } |
| 765 | 765 |
| 766 void set_reference_map(ReferenceMap* map) { | 766 void set_reference_map(ReferenceMap* map) { |
| 767 DCHECK(NeedsReferenceMap()); | 767 DCHECK(NeedsReferenceMap()); |
| 768 DCHECK(!reference_map_); | 768 DCHECK(!reference_map_); |
| 769 reference_map_ = map; | 769 reference_map_ = map; |
| 770 } | 770 } |
| 771 | 771 |
| 772 void OverwriteWithNop() { | 772 void OverwriteWithNop() { |
| 773 opcode_ = ArchOpcodeField::encode(kArchNop); | 773 opcode_ = ArchOpcodeField::encode(kArchNop); |
| 774 bit_field_ = 0; | 774 bit_field_ = 0; |
| 775 reference_map_ = NULL; | 775 reference_map_ = nullptr; |
| 776 } | 776 } |
| 777 | 777 |
| 778 bool IsNop() const { | 778 bool IsNop() const { |
| 779 return arch_opcode() == kArchNop && InputCount() == 0 && | 779 return arch_opcode() == kArchNop && InputCount() == 0 && |
| 780 OutputCount() == 0 && TempCount() == 0; | 780 OutputCount() == 0 && TempCount() == 0; |
| 781 } | 781 } |
| 782 | 782 |
| 783 enum GapPosition { | 783 enum GapPosition { |
| 784 START, | 784 START, |
| 785 END, | 785 END, |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 | 1349 |
| 1350 | 1350 |
| 1351 std::ostream& operator<<(std::ostream& os, | 1351 std::ostream& operator<<(std::ostream& os, |
| 1352 const PrintableInstructionSequence& code); | 1352 const PrintableInstructionSequence& code); |
| 1353 | 1353 |
| 1354 } // namespace compiler | 1354 } // namespace compiler |
| 1355 } // namespace internal | 1355 } // namespace internal |
| 1356 } // namespace v8 | 1356 } // namespace v8 |
| 1357 | 1357 |
| 1358 #endif // V8_COMPILER_INSTRUCTION_H_ | 1358 #endif // V8_COMPILER_INSTRUCTION_H_ |
| OLD | NEW |