| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool EqualsCanonicalized(const InstructionOperand& that) const { | 89 bool EqualsCanonicalized(const InstructionOperand& that) const { |
| 90 return this->GetCanonicalizedValue() == that.GetCanonicalizedValue(); | 90 return this->GetCanonicalizedValue() == that.GetCanonicalizedValue(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 bool CompareCanonicalized(const InstructionOperand& that) const { | 93 bool CompareCanonicalized(const InstructionOperand& that) const { |
| 94 return this->GetCanonicalizedValue() < that.GetCanonicalizedValue(); | 94 return this->GetCanonicalizedValue() < that.GetCanonicalizedValue(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void Print(const RegisterConfiguration* config) const; |
| 98 void Print() const; |
| 99 |
| 97 protected: | 100 protected: |
| 98 explicit InstructionOperand(Kind kind) : value_(KindField::encode(kind)) {} | 101 explicit InstructionOperand(Kind kind) : value_(KindField::encode(kind)) {} |
| 99 | 102 |
| 100 inline uint64_t GetCanonicalizedValue() const; | 103 inline uint64_t GetCanonicalizedValue() const; |
| 101 | 104 |
| 102 class KindField : public BitField64<Kind, 0, 3> {}; | 105 class KindField : public BitField64<Kind, 0, 3> {}; |
| 103 | 106 |
| 104 uint64_t value_; | 107 uint64_t value_; |
| 105 }; | 108 }; |
| 106 | 109 |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 return IsEliminated() || source_.EqualsCanonicalized(destination_); | 584 return IsEliminated() || source_.EqualsCanonicalized(destination_); |
| 582 } | 585 } |
| 583 | 586 |
| 584 // We clear both operands to indicate move that's been eliminated. | 587 // We clear both operands to indicate move that's been eliminated. |
| 585 void Eliminate() { source_ = destination_ = InstructionOperand(); } | 588 void Eliminate() { source_ = destination_ = InstructionOperand(); } |
| 586 bool IsEliminated() const { | 589 bool IsEliminated() const { |
| 587 DCHECK_IMPLIES(source_.IsInvalid(), destination_.IsInvalid()); | 590 DCHECK_IMPLIES(source_.IsInvalid(), destination_.IsInvalid()); |
| 588 return source_.IsInvalid(); | 591 return source_.IsInvalid(); |
| 589 } | 592 } |
| 590 | 593 |
| 594 void Print(const RegisterConfiguration* config) const; |
| 595 void Print() const; |
| 596 |
| 591 private: | 597 private: |
| 592 InstructionOperand source_; | 598 InstructionOperand source_; |
| 593 InstructionOperand destination_; | 599 InstructionOperand destination_; |
| 594 | 600 |
| 595 DISALLOW_COPY_AND_ASSIGN(MoveOperands); | 601 DISALLOW_COPY_AND_ASSIGN(MoveOperands); |
| 596 }; | 602 }; |
| 597 | 603 |
| 598 | 604 |
| 599 struct PrintableMoveOperands { | 605 struct PrintableMoveOperands { |
| 600 const RegisterConfiguration* register_configuration_; | 606 const RegisterConfiguration* register_configuration_; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 | 790 |
| 785 const ParallelMove* GetParallelMove(GapPosition pos) const { | 791 const ParallelMove* GetParallelMove(GapPosition pos) const { |
| 786 return parallel_moves_[pos]; | 792 return parallel_moves_[pos]; |
| 787 } | 793 } |
| 788 | 794 |
| 789 bool AreMovesRedundant() const; | 795 bool AreMovesRedundant() const; |
| 790 | 796 |
| 791 ParallelMove* const* parallel_moves() const { return ¶llel_moves_[0]; } | 797 ParallelMove* const* parallel_moves() const { return ¶llel_moves_[0]; } |
| 792 ParallelMove** parallel_moves() { return ¶llel_moves_[0]; } | 798 ParallelMove** parallel_moves() { return ¶llel_moves_[0]; } |
| 793 | 799 |
| 800 void Print(const RegisterConfiguration* config) const; |
| 801 void Print() const; |
| 802 |
| 794 private: | 803 private: |
| 795 explicit Instruction(InstructionCode opcode); | 804 explicit Instruction(InstructionCode opcode); |
| 796 | 805 |
| 797 Instruction(InstructionCode opcode, size_t output_count, | 806 Instruction(InstructionCode opcode, size_t output_count, |
| 798 InstructionOperand* outputs, size_t input_count, | 807 InstructionOperand* outputs, size_t input_count, |
| 799 InstructionOperand* inputs, size_t temp_count, | 808 InstructionOperand* inputs, size_t temp_count, |
| 800 InstructionOperand* temps); | 809 InstructionOperand* temps); |
| 801 | 810 |
| 802 typedef BitField<size_t, 0, 8> OutputCountField; | 811 typedef BitField<size_t, 0, 8> OutputCountField; |
| 803 typedef BitField<size_t, 8, 16> InputCountField; | 812 typedef BitField<size_t, 8, 16> InputCountField; |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1239 bool GetSourcePosition(const Instruction* instr, | 1248 bool GetSourcePosition(const Instruction* instr, |
| 1240 SourcePosition* result) const; | 1249 SourcePosition* result) const; |
| 1241 void SetSourcePosition(const Instruction* instr, SourcePosition value); | 1250 void SetSourcePosition(const Instruction* instr, SourcePosition value); |
| 1242 | 1251 |
| 1243 bool ContainsCall() const { | 1252 bool ContainsCall() const { |
| 1244 for (Instruction* instr : instructions_) { | 1253 for (Instruction* instr : instructions_) { |
| 1245 if (instr->IsCall()) return true; | 1254 if (instr->IsCall()) return true; |
| 1246 } | 1255 } |
| 1247 return false; | 1256 return false; |
| 1248 } | 1257 } |
| 1258 void Print(const RegisterConfiguration* config) const; |
| 1259 void Print() const; |
| 1249 | 1260 |
| 1250 private: | 1261 private: |
| 1251 friend std::ostream& operator<<(std::ostream& os, | 1262 friend std::ostream& operator<<(std::ostream& os, |
| 1252 const PrintableInstructionSequence& code); | 1263 const PrintableInstructionSequence& code); |
| 1253 | 1264 |
| 1254 typedef ZoneMap<const Instruction*, SourcePosition> SourcePositionMap; | 1265 typedef ZoneMap<const Instruction*, SourcePosition> SourcePositionMap; |
| 1255 | 1266 |
| 1256 Isolate* isolate_; | 1267 Isolate* isolate_; |
| 1257 Zone* const zone_; | 1268 Zone* const zone_; |
| 1258 InstructionBlocks* const instruction_blocks_; | 1269 InstructionBlocks* const instruction_blocks_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1277 | 1288 |
| 1278 | 1289 |
| 1279 std::ostream& operator<<(std::ostream& os, | 1290 std::ostream& operator<<(std::ostream& os, |
| 1280 const PrintableInstructionSequence& code); | 1291 const PrintableInstructionSequence& code); |
| 1281 | 1292 |
| 1282 } // namespace compiler | 1293 } // namespace compiler |
| 1283 } // namespace internal | 1294 } // namespace internal |
| 1284 } // namespace v8 | 1295 } // namespace v8 |
| 1285 | 1296 |
| 1286 #endif // V8_COMPILER_INSTRUCTION_H_ | 1297 #endif // V8_COMPILER_INSTRUCTION_H_ |
| OLD | NEW |