| 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 2812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2823 | 2823 |
| 2824 class EqualityCompareInstr : public ComparisonInstr { | 2824 class EqualityCompareInstr : public ComparisonInstr { |
| 2825 public: | 2825 public: |
| 2826 EqualityCompareInstr(intptr_t token_pos, | 2826 EqualityCompareInstr(intptr_t token_pos, |
| 2827 Token::Kind kind, | 2827 Token::Kind kind, |
| 2828 Value* left, | 2828 Value* left, |
| 2829 Value* right, | 2829 Value* right, |
| 2830 const Array& ic_data_array) | 2830 const Array& ic_data_array) |
| 2831 : ComparisonInstr(token_pos, kind, left, right), | 2831 : ComparisonInstr(token_pos, kind, left, right), |
| 2832 ic_data_(GetICData(ic_data_array)), | 2832 ic_data_(GetICData(ic_data_array)), |
| 2833 unary_ic_data_(NULL), |
| 2833 receiver_class_id_(kIllegalCid) { | 2834 receiver_class_id_(kIllegalCid) { |
| 2834 ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); | 2835 ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); |
| 2836 if (HasICData()) { |
| 2837 unary_ic_data_ = &ICData::ZoneHandle(ic_data_->AsUnaryClassChecks()); |
| 2838 } |
| 2835 } | 2839 } |
| 2836 | 2840 |
| 2837 DECLARE_INSTRUCTION(EqualityCompare) | 2841 DECLARE_INSTRUCTION(EqualityCompare) |
| 2838 virtual CompileType ComputeType() const; | 2842 virtual CompileType ComputeType() const; |
| 2839 virtual bool RecomputeType(); | 2843 virtual bool RecomputeType(); |
| 2840 | 2844 |
| 2841 const ICData* ic_data() const { return ic_data_; } | 2845 const ICData* ic_data() const { return ic_data_; } |
| 2842 bool HasICData() const { | 2846 bool HasICData() const { |
| 2843 return (ic_data() != NULL) && !ic_data()->IsNull(); | 2847 return (ic_data() != NULL) && !ic_data()->IsNull(); |
| 2844 } | 2848 } |
| 2845 void set_ic_data(const ICData* value) { ic_data_ = value; } | 2849 void set_ic_data(const ICData* value) { ic_data_ = value; } |
| 2846 | 2850 |
| 2847 // Receiver class id is computed from collected ICData. | 2851 // Receiver class id is computed from collected ICData. |
| 2848 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } | 2852 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } |
| 2849 intptr_t receiver_class_id() const { return receiver_class_id_; } | 2853 intptr_t receiver_class_id() const { return receiver_class_id_; } |
| 2850 | 2854 |
| 2851 bool IsInlinedNumericComparison() const { | 2855 bool IsInlinedNumericComparison() const { |
| 2852 return (receiver_class_id() == kDoubleCid) | 2856 return (receiver_class_id() == kDoubleCid) |
| 2853 || (receiver_class_id() == kMintCid) | 2857 || (receiver_class_id() == kMintCid) |
| 2854 || (receiver_class_id() == kSmiCid); | 2858 || (receiver_class_id() == kSmiCid); |
| 2855 } | 2859 } |
| 2856 | 2860 |
| 2857 bool is_checked_strict_equal() const { | 2861 bool IsCheckedStrictEqual() const; |
| 2858 return HasICData() && ic_data()->AllTargetsHaveSameOwner(kInstanceCid); | |
| 2859 } | |
| 2860 | 2862 |
| 2861 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2863 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 2862 | 2864 |
| 2863 virtual bool CanDeoptimize() const { | 2865 virtual bool CanDeoptimize() const { |
| 2864 return !IsInlinedNumericComparison(); | 2866 return !IsInlinedNumericComparison(); |
| 2865 } | 2867 } |
| 2866 | 2868 |
| 2867 virtual void EmitBranchCode(FlowGraphCompiler* compiler, | 2869 virtual void EmitBranchCode(FlowGraphCompiler* compiler, |
| 2868 BranchInstr* branch); | 2870 BranchInstr* branch); |
| 2869 | 2871 |
| 2870 virtual intptr_t DeoptimizationTarget() const { | 2872 virtual intptr_t DeoptimizationTarget() const { |
| 2871 return GetDeoptId(); | 2873 return GetDeoptId(); |
| 2872 } | 2874 } |
| 2873 | 2875 |
| 2874 virtual Representation RequiredInputRepresentation(intptr_t idx) const { | 2876 virtual Representation RequiredInputRepresentation(intptr_t idx) const { |
| 2875 ASSERT((idx == 0) || (idx == 1)); | 2877 ASSERT((idx == 0) || (idx == 1)); |
| 2876 if (receiver_class_id() == kDoubleCid) return kUnboxedDouble; | 2878 if (receiver_class_id() == kDoubleCid) return kUnboxedDouble; |
| 2877 if (receiver_class_id() == kMintCid) return kUnboxedMint; | 2879 if (receiver_class_id() == kMintCid) return kUnboxedMint; |
| 2878 return kTagged; | 2880 return kTagged; |
| 2879 } | 2881 } |
| 2880 | 2882 |
| 2881 bool IsPolymorphic() const; | 2883 bool IsPolymorphic() const; |
| 2882 | 2884 |
| 2883 virtual EffectSet Effects() const { | 2885 virtual EffectSet Effects() const { |
| 2884 return IsInlinedNumericComparison() ? EffectSet::None() : EffectSet::All(); | 2886 return IsInlinedNumericComparison() ? EffectSet::None() : EffectSet::All(); |
| 2885 } | 2887 } |
| 2886 | 2888 |
| 2887 virtual bool MayThrow() const { | 2889 virtual bool MayThrow() const { |
| 2888 return !IsInlinedNumericComparison() && !is_checked_strict_equal(); | 2890 return !IsInlinedNumericComparison() && !IsCheckedStrictEqual(); |
| 2889 } | 2891 } |
| 2890 | 2892 |
| 2891 private: | 2893 private: |
| 2892 const ICData* ic_data_; | 2894 const ICData* ic_data_; |
| 2895 ICData* unary_ic_data_; |
| 2893 intptr_t receiver_class_id_; // Set by optimizer. | 2896 intptr_t receiver_class_id_; // Set by optimizer. |
| 2894 | 2897 |
| 2895 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); | 2898 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); |
| 2896 }; | 2899 }; |
| 2897 | 2900 |
| 2898 | 2901 |
| 2899 class RelationalOpInstr : public ComparisonInstr { | 2902 class RelationalOpInstr : public ComparisonInstr { |
| 2900 public: | 2903 public: |
| 2901 RelationalOpInstr(intptr_t token_pos, | 2904 RelationalOpInstr(intptr_t token_pos, |
| 2902 Token::Kind kind, | 2905 Token::Kind kind, |
| (...skipping 3561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6464 ForwardInstructionIterator* current_iterator_; | 6467 ForwardInstructionIterator* current_iterator_; |
| 6465 | 6468 |
| 6466 private: | 6469 private: |
| 6467 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 6470 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 6468 }; | 6471 }; |
| 6469 | 6472 |
| 6470 | 6473 |
| 6471 } // namespace dart | 6474 } // namespace dart |
| 6472 | 6475 |
| 6473 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 6476 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |