Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 15946002: Allow breakpoints on strict equal (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2686 matching lines...) Expand 10 before | Expand all | Expand 10 after
2697 InstanceCallInstr* instance_call_; 2697 InstanceCallInstr* instance_call_;
2698 const ICData& ic_data_; 2698 const ICData& ic_data_;
2699 const bool with_checks_; 2699 const bool with_checks_;
2700 2700
2701 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); 2701 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr);
2702 }; 2702 };
2703 2703
2704 2704
2705 class ComparisonInstr : public TemplateDefinition<2> { 2705 class ComparisonInstr : public TemplateDefinition<2> {
2706 public: 2706 public:
2707 ComparisonInstr(Token::Kind kind, Value* left, Value* right) 2707 ComparisonInstr(intptr_t token_pos,
2708 : kind_(kind) { 2708 Token::Kind kind,
2709 Value* left,
2710 Value* right)
2711 : token_pos_(token_pos), kind_(kind) {
2709 SetInputAt(0, left); 2712 SetInputAt(0, left);
2710 SetInputAt(1, right); 2713 SetInputAt(1, right);
2711 } 2714 }
2712 2715
2713 Value* left() const { return inputs_[0]; } 2716 Value* left() const { return inputs_[0]; }
2714 Value* right() const { return inputs_[1]; } 2717 Value* right() const { return inputs_[1]; }
2715 2718
2716 virtual ComparisonInstr* AsComparison() { return this; } 2719 virtual ComparisonInstr* AsComparison() { return this; }
2717 2720
2721 intptr_t token_pos() const { return token_pos_; }
2718 Token::Kind kind() const { return kind_; } 2722 Token::Kind kind() const { return kind_; }
2719 2723
2720 virtual void EmitBranchCode(FlowGraphCompiler* compiler, 2724 virtual void EmitBranchCode(FlowGraphCompiler* compiler,
2721 BranchInstr* branch) = 0; 2725 BranchInstr* branch) = 0;
2722 2726
2723 void SetDeoptId(intptr_t deopt_id) { 2727 void SetDeoptId(intptr_t deopt_id) {
2724 deopt_id_ = deopt_id; 2728 deopt_id_ = deopt_id;
2725 } 2729 }
2726 2730
2727 protected: 2731 protected:
2732 intptr_t token_pos_;
2728 Token::Kind kind_; 2733 Token::Kind kind_;
2729 }; 2734 };
2730 2735
2731 2736
2732 // Inlined functions from class BranchInstr that forward to their comparison. 2737 // Inlined functions from class BranchInstr that forward to their comparison.
2733 inline intptr_t BranchInstr::ArgumentCount() const { 2738 inline intptr_t BranchInstr::ArgumentCount() const {
2734 return comparison()->ArgumentCount(); 2739 return comparison()->ArgumentCount();
2735 } 2740 }
2736 2741
2737 2742
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
2784 } 2789 }
2785 2790
2786 2791
2787 inline bool BranchInstr::MayThrow() const { 2792 inline bool BranchInstr::MayThrow() const {
2788 return comparison()->MayThrow(); 2793 return comparison()->MayThrow();
2789 } 2794 }
2790 2795
2791 2796
2792 class StrictCompareInstr : public ComparisonInstr { 2797 class StrictCompareInstr : public ComparisonInstr {
2793 public: 2798 public:
2794 StrictCompareInstr(Token::Kind kind, Value* left, Value* right); 2799 StrictCompareInstr(intptr_t token_pos,
2800 Token::Kind kind,
2801 Value* left,
2802 Value* right);
2795 2803
2796 DECLARE_INSTRUCTION(StrictCompare) 2804 DECLARE_INSTRUCTION(StrictCompare)
2797 virtual CompileType ComputeType() const; 2805 virtual CompileType ComputeType() const;
2798 2806
2799 virtual void PrintOperandsTo(BufferFormatter* f) const; 2807 virtual void PrintOperandsTo(BufferFormatter* f) const;
2800 2808
2801 virtual bool CanBeDeoptimizationTarget() const { 2809 virtual bool CanBeDeoptimizationTarget() const {
2802 // StrictCompare can be merged into Branch and thus needs an environment. 2810 // StrictCompare can be merged into Branch and thus needs an environment.
2803 return true; 2811 return true;
2804 } 2812 }
(...skipping 25 matching lines...) Expand all
2830 }; 2838 };
2831 2839
2832 2840
2833 class EqualityCompareInstr : public ComparisonInstr { 2841 class EqualityCompareInstr : public ComparisonInstr {
2834 public: 2842 public:
2835 EqualityCompareInstr(intptr_t token_pos, 2843 EqualityCompareInstr(intptr_t token_pos,
2836 Token::Kind kind, 2844 Token::Kind kind,
2837 Value* left, 2845 Value* left,
2838 Value* right, 2846 Value* right,
2839 const Array& ic_data_array) 2847 const Array& ic_data_array)
2840 : ComparisonInstr(kind, left, right), 2848 : ComparisonInstr(token_pos, kind, left, right),
2841 ic_data_(GetICData(ic_data_array)), 2849 ic_data_(GetICData(ic_data_array)),
2842 token_pos_(token_pos),
2843 receiver_class_id_(kIllegalCid) { 2850 receiver_class_id_(kIllegalCid) {
2844 ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); 2851 ASSERT((kind == Token::kEQ) || (kind == Token::kNE));
2845 } 2852 }
2846 2853
2847 DECLARE_INSTRUCTION(EqualityCompare) 2854 DECLARE_INSTRUCTION(EqualityCompare)
2848 virtual CompileType ComputeType() const; 2855 virtual CompileType ComputeType() const;
2849 virtual bool RecomputeType(); 2856 virtual bool RecomputeType();
2850 2857
2851 const ICData* ic_data() const { return ic_data_; } 2858 const ICData* ic_data() const { return ic_data_; }
2852 bool HasICData() const { 2859 bool HasICData() const {
2853 return (ic_data() != NULL) && !ic_data()->IsNull(); 2860 return (ic_data() != NULL) && !ic_data()->IsNull();
2854 } 2861 }
2855 void set_ic_data(const ICData* value) { ic_data_ = value; } 2862 void set_ic_data(const ICData* value) { ic_data_ = value; }
2856 2863
2857 intptr_t token_pos() const { return token_pos_; }
2858
2859 // Receiver class id is computed from collected ICData. 2864 // Receiver class id is computed from collected ICData.
2860 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; } 2865 void set_receiver_class_id(intptr_t value) { receiver_class_id_ = value; }
2861 intptr_t receiver_class_id() const { return receiver_class_id_; } 2866 intptr_t receiver_class_id() const { return receiver_class_id_; }
2862 2867
2863 bool IsInlinedNumericComparison() const { 2868 bool IsInlinedNumericComparison() const {
2864 return (receiver_class_id() == kDoubleCid) 2869 return (receiver_class_id() == kDoubleCid)
2865 || (receiver_class_id() == kMintCid) 2870 || (receiver_class_id() == kMintCid)
2866 || (receiver_class_id() == kSmiCid); 2871 || (receiver_class_id() == kSmiCid);
2867 } 2872 }
2868 2873
(...skipping 26 matching lines...) Expand all
2895 virtual EffectSet Effects() const { 2900 virtual EffectSet Effects() const {
2896 return IsInlinedNumericComparison() ? EffectSet::None() : EffectSet::All(); 2901 return IsInlinedNumericComparison() ? EffectSet::None() : EffectSet::All();
2897 } 2902 }
2898 2903
2899 virtual bool MayThrow() const { 2904 virtual bool MayThrow() const {
2900 return !IsInlinedNumericComparison() && !is_checked_strict_equal(); 2905 return !IsInlinedNumericComparison() && !is_checked_strict_equal();
2901 } 2906 }
2902 2907
2903 private: 2908 private:
2904 const ICData* ic_data_; 2909 const ICData* ic_data_;
2905 const intptr_t token_pos_;
2906 intptr_t receiver_class_id_; // Set by optimizer. 2910 intptr_t receiver_class_id_; // Set by optimizer.
2907 2911
2908 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); 2912 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr);
2909 }; 2913 };
2910 2914
2911 2915
2912 class RelationalOpInstr : public ComparisonInstr { 2916 class RelationalOpInstr : public ComparisonInstr {
2913 public: 2917 public:
2914 RelationalOpInstr(intptr_t token_pos, 2918 RelationalOpInstr(intptr_t token_pos,
2915 Token::Kind kind, 2919 Token::Kind kind,
2916 Value* left, 2920 Value* left,
2917 Value* right, 2921 Value* right,
2918 const Array& ic_data_array) 2922 const Array& ic_data_array)
2919 : ComparisonInstr(kind, left, right), 2923 : ComparisonInstr(token_pos, kind, left, right),
2920 ic_data_(GetICData(ic_data_array)), 2924 ic_data_(GetICData(ic_data_array)),
2921 token_pos_(token_pos),
2922 operands_class_id_(kIllegalCid) { 2925 operands_class_id_(kIllegalCid) {
2923 ASSERT(Token::IsRelationalOperator(kind)); 2926 ASSERT(Token::IsRelationalOperator(kind));
2924 } 2927 }
2925 2928
2926 DECLARE_INSTRUCTION(RelationalOp) 2929 DECLARE_INSTRUCTION(RelationalOp)
2927 virtual CompileType ComputeType() const; 2930 virtual CompileType ComputeType() const;
2928 virtual bool RecomputeType(); 2931 virtual bool RecomputeType();
2929 2932
2930 const ICData* ic_data() const { return ic_data_; } 2933 const ICData* ic_data() const { return ic_data_; }
2931 bool HasICData() const { 2934 bool HasICData() const {
2932 return (ic_data() != NULL) && !ic_data()->IsNull(); 2935 return (ic_data() != NULL) && !ic_data()->IsNull();
2933 } 2936 }
2934 void set_ic_data(const ICData* value) { ic_data_ = value; } 2937 void set_ic_data(const ICData* value) { ic_data_ = value; }
2935 2938
2936 intptr_t token_pos() const { return token_pos_; }
2937
2938 // TODO(srdjan): instead of class-id pass an enum that can differentiate 2939 // TODO(srdjan): instead of class-id pass an enum that can differentiate
2939 // between boxed and unboxed doubles and integers. 2940 // between boxed and unboxed doubles and integers.
2940 void set_operands_class_id(intptr_t value) { 2941 void set_operands_class_id(intptr_t value) {
2941 operands_class_id_ = value; 2942 operands_class_id_ = value;
2942 } 2943 }
2943 2944
2944 intptr_t operands_class_id() const { return operands_class_id_; } 2945 intptr_t operands_class_id() const { return operands_class_id_; }
2945 2946
2946 bool IsInlinedNumericComparison() const { 2947 bool IsInlinedNumericComparison() const {
2947 return (operands_class_id() == kDoubleCid) 2948 return (operands_class_id() == kDoubleCid)
(...skipping 23 matching lines...) Expand all
2971 } 2972 }
2972 2973
2973 virtual EffectSet Effects() const { 2974 virtual EffectSet Effects() const {
2974 return IsInlinedNumericComparison() ? EffectSet::None() : EffectSet::All(); 2975 return IsInlinedNumericComparison() ? EffectSet::None() : EffectSet::All();
2975 } 2976 }
2976 2977
2977 virtual bool MayThrow() const { return !IsInlinedNumericComparison(); } 2978 virtual bool MayThrow() const { return !IsInlinedNumericComparison(); }
2978 2979
2979 private: 2980 private:
2980 const ICData* ic_data_; 2981 const ICData* ic_data_;
2981 const intptr_t token_pos_;
2982 intptr_t operands_class_id_; // class id of both operands. 2982 intptr_t operands_class_id_; // class id of both operands.
2983 2983
2984 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr); 2984 DISALLOW_COPY_AND_ASSIGN(RelationalOpInstr);
2985 }; 2985 };
2986 2986
2987 2987
2988 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for 2988 // TODO(vegorov): ComparisonInstr should be switched to use IfTheElseInstr for
2989 // materialization of true and false constants. 2989 // materialization of true and false constants.
2990 class IfThenElseInstr : public TemplateDefinition<2> { 2990 class IfThenElseInstr : public TemplateDefinition<2> {
2991 public: 2991 public:
(...skipping 3413 matching lines...) Expand 10 before | Expand all | Expand 10 after
6405 ForwardInstructionIterator* current_iterator_; 6405 ForwardInstructionIterator* current_iterator_;
6406 6406
6407 private: 6407 private:
6408 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 6408 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
6409 }; 6409 };
6410 6410
6411 6411
6412 } // namespace dart 6412 } // namespace dart
6413 6413
6414 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 6414 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698