| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ |
| 6 #define VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define VM_INTERMEDIATE_LANGUAGE_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/ast.h" | 9 #include "vm/ast.h" |
| 10 #include "vm/growable_array.h" | 10 #include "vm/growable_array.h" |
| (...skipping 6649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6660 kSinCos, | 6660 kSinCos, |
| 6661 }; | 6661 }; |
| 6662 | 6662 |
| 6663 MergedMathInstr(ZoneGrowableArray<Value*>* inputs, | 6663 MergedMathInstr(ZoneGrowableArray<Value*>* inputs, |
| 6664 intptr_t original_deopt_id, | 6664 intptr_t original_deopt_id, |
| 6665 MergedMathInstr::Kind kind); | 6665 MergedMathInstr::Kind kind); |
| 6666 | 6666 |
| 6667 static intptr_t InputCountFor(MergedMathInstr::Kind kind) { | 6667 static intptr_t InputCountFor(MergedMathInstr::Kind kind) { |
| 6668 if (kind == kTruncDivMod) { | 6668 if (kind == kTruncDivMod) { |
| 6669 return 2; | 6669 return 2; |
| 6670 } else if (kind == kSinCos) { |
| 6671 return 1; |
| 6670 } else { | 6672 } else { |
| 6671 UNIMPLEMENTED(); | 6673 UNIMPLEMENTED(); |
| 6672 return -1; | 6674 return -1; |
| 6673 } | 6675 } |
| 6674 } | 6676 } |
| 6675 | 6677 |
| 6676 MergedMathInstr::Kind kind() const { return kind_; } | 6678 MergedMathInstr::Kind kind() const { return kind_; } |
| 6677 | 6679 |
| 6678 virtual intptr_t InputCount() const { return inputs_->length(); } | 6680 virtual intptr_t InputCount() const { return inputs_->length(); } |
| 6679 | 6681 |
| 6680 virtual Value* InputAt(intptr_t i) const { | 6682 virtual Value* InputAt(intptr_t i) const { |
| 6681 return (*inputs_)[i]; | 6683 return (*inputs_)[i]; |
| 6682 } | 6684 } |
| 6683 | 6685 |
| 6684 virtual CompileType ComputeType() const; | 6686 virtual CompileType ComputeType() const; |
| 6685 virtual void PrintOperandsTo(BufferFormatter* f) const; | 6687 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 6686 | 6688 |
| 6687 virtual bool CanDeoptimize() const { | 6689 virtual bool CanDeoptimize() const { |
| 6688 if (kind_ == kTruncDivMod) { | 6690 if (kind_ == kTruncDivMod) { |
| 6689 return true; | 6691 return true; |
| 6692 } else if (kind_ == kSinCos) { |
| 6693 return false; |
| 6690 } else { | 6694 } else { |
| 6691 UNIMPLEMENTED(); | 6695 UNIMPLEMENTED(); |
| 6692 return false; | 6696 return false; |
| 6693 } | 6697 } |
| 6694 } | 6698 } |
| 6695 | 6699 |
| 6696 virtual Representation representation() const { | 6700 virtual Representation representation() const { |
| 6697 if (kind_ == kTruncDivMod) { | 6701 if (kind_ == kTruncDivMod) { |
| 6698 return kTagged; | 6702 return kTagged; |
| 6703 } else if (kind_ == kSinCos) { |
| 6704 return kTagged; |
| 6699 } else { | 6705 } else { |
| 6700 UNIMPLEMENTED(); | 6706 UNIMPLEMENTED(); |
| 6701 return kTagged; | 6707 return kTagged; |
| 6702 } | 6708 } |
| 6703 } | 6709 } |
| 6704 | 6710 |
| 6705 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 6711 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 6712 ASSERT((0 <= idx) && (idx < InputCount())); |
| 6706 if (kind_ == kTruncDivMod) { | 6713 if (kind_ == kTruncDivMod) { |
| 6707 ASSERT((0 <= idx) && (idx < InputCount())); | |
| 6708 return kTagged; | 6714 return kTagged; |
| 6715 } else if (kind_ == kSinCos) { |
| 6716 return kUnboxedDouble; |
| 6709 } else { | 6717 } else { |
| 6710 UNIMPLEMENTED(); | 6718 UNIMPLEMENTED(); |
| 6711 return kTagged; | 6719 return kTagged; |
| 6712 } | 6720 } |
| 6713 } | 6721 } |
| 6714 | 6722 |
| 6715 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } | 6723 virtual intptr_t DeoptimizationTarget() const { return deopt_id_; } |
| 6716 | 6724 |
| 6717 DECLARE_INSTRUCTION(MergedMath) | 6725 DECLARE_INSTRUCTION(MergedMath) |
| 6718 | 6726 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 6730 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 6738 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
| 6731 virtual bool AttributesEqual(Instruction* other) const { | 6739 virtual bool AttributesEqual(Instruction* other) const { |
| 6732 MergedMathInstr* other_invoke = other->AsMergedMath(); | 6740 MergedMathInstr* other_invoke = other->AsMergedMath(); |
| 6733 return other_invoke->kind() == kind(); | 6741 return other_invoke->kind() == kind(); |
| 6734 } | 6742 } |
| 6735 | 6743 |
| 6736 virtual bool MayThrow() const { return false; } | 6744 virtual bool MayThrow() const { return false; } |
| 6737 | 6745 |
| 6738 static const char* KindToCString(MergedMathInstr::Kind kind) { | 6746 static const char* KindToCString(MergedMathInstr::Kind kind) { |
| 6739 if (kind == kTruncDivMod) return "TruncDivMod"; | 6747 if (kind == kTruncDivMod) return "TruncDivMod"; |
| 6748 if (kind == kSinCos) return "SinCos"; |
| 6740 UNIMPLEMENTED(); | 6749 UNIMPLEMENTED(); |
| 6741 return ""; | 6750 return ""; |
| 6742 } | 6751 } |
| 6743 | 6752 |
| 6744 private: | 6753 private: |
| 6745 virtual void RawSetInputAt(intptr_t i, Value* value) { | 6754 virtual void RawSetInputAt(intptr_t i, Value* value) { |
| 6746 (*inputs_)[i] = value; | 6755 (*inputs_)[i] = value; |
| 6747 } | 6756 } |
| 6748 | 6757 |
| 6749 ZoneGrowableArray<Value*>* inputs_; | 6758 ZoneGrowableArray<Value*>* inputs_; |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7083 ForwardInstructionIterator* current_iterator_; | 7092 ForwardInstructionIterator* current_iterator_; |
| 7084 | 7093 |
| 7085 private: | 7094 private: |
| 7086 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 7095 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 7087 }; | 7096 }; |
| 7088 | 7097 |
| 7089 | 7098 |
| 7090 } // namespace dart | 7099 } // namespace dart |
| 7091 | 7100 |
| 7092 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7101 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |