| 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 2809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2820 const Array& argument_names, | 2820 const Array& argument_names, |
| 2821 intptr_t checked_argument_count, | 2821 intptr_t checked_argument_count, |
| 2822 const ZoneGrowableArray<const ICData*>& ic_data_array) | 2822 const ZoneGrowableArray<const ICData*>& ic_data_array) |
| 2823 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 2823 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), |
| 2824 ic_data_(NULL), | 2824 ic_data_(NULL), |
| 2825 token_pos_(token_pos), | 2825 token_pos_(token_pos), |
| 2826 function_name_(function_name), | 2826 function_name_(function_name), |
| 2827 token_kind_(token_kind), | 2827 token_kind_(token_kind), |
| 2828 arguments_(arguments), | 2828 arguments_(arguments), |
| 2829 argument_names_(argument_names), | 2829 argument_names_(argument_names), |
| 2830 checked_argument_count_(checked_argument_count) { | 2830 checked_argument_count_(checked_argument_count), |
| 2831 has_unique_selector_(false) { |
| 2831 ic_data_ = GetICData(ic_data_array); | 2832 ic_data_ = GetICData(ic_data_array); |
| 2832 ASSERT(function_name.IsNotTemporaryScopedHandle()); | 2833 ASSERT(function_name.IsNotTemporaryScopedHandle()); |
| 2833 ASSERT(!arguments->is_empty()); | 2834 ASSERT(!arguments->is_empty()); |
| 2834 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); | 2835 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); |
| 2835 ASSERT(Token::IsBinaryOperator(token_kind) || | 2836 ASSERT(Token::IsBinaryOperator(token_kind) || |
| 2836 Token::IsEqualityOperator(token_kind) || | 2837 Token::IsEqualityOperator(token_kind) || |
| 2837 Token::IsRelationalOperator(token_kind) || | 2838 Token::IsRelationalOperator(token_kind) || |
| 2838 Token::IsUnaryOperator(token_kind) || | 2839 Token::IsUnaryOperator(token_kind) || |
| 2839 Token::IsIndexOperator(token_kind) || | 2840 Token::IsIndexOperator(token_kind) || |
| 2840 Token::IsTypeTestOperator(token_kind) || | 2841 Token::IsTypeTestOperator(token_kind) || |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2857 virtual TokenPosition token_pos() const { return token_pos_; } | 2858 virtual TokenPosition token_pos() const { return token_pos_; } |
| 2858 const String& function_name() const { return function_name_; } | 2859 const String& function_name() const { return function_name_; } |
| 2859 Token::Kind token_kind() const { return token_kind_; } | 2860 Token::Kind token_kind() const { return token_kind_; } |
| 2860 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 2861 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 2861 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 2862 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| 2862 return (*arguments_)[index]; | 2863 return (*arguments_)[index]; |
| 2863 } | 2864 } |
| 2864 const Array& argument_names() const { return argument_names_; } | 2865 const Array& argument_names() const { return argument_names_; } |
| 2865 intptr_t checked_argument_count() const { return checked_argument_count_; } | 2866 intptr_t checked_argument_count() const { return checked_argument_count_; } |
| 2866 | 2867 |
| 2868 bool has_unique_selector() const { return has_unique_selector_; } |
| 2869 void set_has_unique_selector(bool b) { |
| 2870 has_unique_selector_ = b; |
| 2871 } |
| 2872 |
| 2867 virtual bool CanDeoptimize() const { return true; } | 2873 virtual bool CanDeoptimize() const { return true; } |
| 2868 | 2874 |
| 2869 virtual bool CanBecomeDeoptimizationTarget() const { | 2875 virtual bool CanBecomeDeoptimizationTarget() const { |
| 2870 // Instance calls that are specialized by the optimizer need a | 2876 // Instance calls that are specialized by the optimizer need a |
| 2871 // deoptimization descriptor before the call. | 2877 // deoptimization descriptor before the call. |
| 2872 return true; | 2878 return true; |
| 2873 } | 2879 } |
| 2874 | 2880 |
| 2875 virtual EffectSet Effects() const { return EffectSet::All(); } | 2881 virtual EffectSet Effects() const { return EffectSet::All(); } |
| 2876 | 2882 |
| 2877 PRINT_OPERANDS_TO_SUPPORT | 2883 PRINT_OPERANDS_TO_SUPPORT |
| 2878 | 2884 |
| 2879 protected: | 2885 protected: |
| 2880 friend class JitOptimizer; | 2886 friend class JitOptimizer; |
| 2881 void set_ic_data(ICData* value) { ic_data_ = value; } | 2887 void set_ic_data(ICData* value) { ic_data_ = value; } |
| 2882 | 2888 |
| 2883 private: | 2889 private: |
| 2884 const ICData* ic_data_; | 2890 const ICData* ic_data_; |
| 2885 const TokenPosition token_pos_; | 2891 const TokenPosition token_pos_; |
| 2886 const String& function_name_; | 2892 const String& function_name_; |
| 2887 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. | 2893 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. |
| 2888 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; | 2894 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; |
| 2889 const Array& argument_names_; | 2895 const Array& argument_names_; |
| 2890 const intptr_t checked_argument_count_; | 2896 const intptr_t checked_argument_count_; |
| 2897 bool has_unique_selector_; |
| 2891 | 2898 |
| 2892 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr); | 2899 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr); |
| 2893 }; | 2900 }; |
| 2894 | 2901 |
| 2895 | 2902 |
| 2896 class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> { | 2903 class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> { |
| 2897 public: | 2904 public: |
| 2898 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, | 2905 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, |
| 2899 const ICData& ic_data, | 2906 const ICData& ic_data, |
| 2900 bool with_checks, | 2907 bool with_checks, |
| 2901 bool complete) | 2908 bool complete) |
| 2902 : TemplateDefinition(instance_call->deopt_id()), | 2909 : TemplateDefinition(instance_call->deopt_id()), |
| 2903 instance_call_(instance_call), | 2910 instance_call_(instance_call), |
| 2904 ic_data_(ic_data), | 2911 ic_data_(ic_data), |
| 2905 with_checks_(with_checks), | 2912 with_checks_(with_checks), |
| 2906 complete_(complete) { | 2913 complete_(complete) { |
| 2907 ASSERT(instance_call_ != NULL); | 2914 ASSERT(instance_call_ != NULL); |
| 2908 ASSERT(ic_data.NumberOfChecks() > 0); | 2915 ASSERT(ic_data.NumberOfChecks() > 0); |
| 2909 } | 2916 } |
| 2910 | 2917 |
| 2911 InstanceCallInstr* instance_call() const { return instance_call_; } | 2918 InstanceCallInstr* instance_call() const { return instance_call_; } |
| 2912 bool with_checks() const { return with_checks_; } | 2919 bool with_checks() const { return with_checks_; } |
| 2920 void set_with_checks(bool b) { with_checks_ = b; } |
| 2913 bool complete() const { return complete_; } | 2921 bool complete() const { return complete_; } |
| 2914 virtual TokenPosition token_pos() const { | 2922 virtual TokenPosition token_pos() const { |
| 2915 return instance_call_->token_pos(); | 2923 return instance_call_->token_pos(); |
| 2916 } | 2924 } |
| 2917 | 2925 |
| 2918 virtual CompileType ComputeType() const; | 2926 virtual CompileType ComputeType() const; |
| 2919 | 2927 |
| 2920 virtual intptr_t ArgumentCount() const { | 2928 virtual intptr_t ArgumentCount() const { |
| 2921 return instance_call()->ArgumentCount(); | 2929 return instance_call()->ArgumentCount(); |
| 2922 } | 2930 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2934 | 2942 |
| 2935 virtual bool CanDeoptimize() const { return true; } | 2943 virtual bool CanDeoptimize() const { return true; } |
| 2936 | 2944 |
| 2937 virtual EffectSet Effects() const { return EffectSet::All(); } | 2945 virtual EffectSet Effects() const { return EffectSet::All(); } |
| 2938 | 2946 |
| 2939 PRINT_OPERANDS_TO_SUPPORT | 2947 PRINT_OPERANDS_TO_SUPPORT |
| 2940 | 2948 |
| 2941 private: | 2949 private: |
| 2942 InstanceCallInstr* instance_call_; | 2950 InstanceCallInstr* instance_call_; |
| 2943 const ICData& ic_data_; | 2951 const ICData& ic_data_; |
| 2944 const bool with_checks_; | 2952 bool with_checks_; |
| 2945 const bool complete_; | 2953 const bool complete_; |
| 2946 | 2954 |
| 2947 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); | 2955 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); |
| 2948 }; | 2956 }; |
| 2949 | 2957 |
| 2950 | 2958 |
| 2951 class StrictCompareInstr : public ComparisonInstr { | 2959 class StrictCompareInstr : public ComparisonInstr { |
| 2952 public: | 2960 public: |
| 2953 StrictCompareInstr(TokenPosition token_pos, | 2961 StrictCompareInstr(TokenPosition token_pos, |
| 2954 Token::Kind kind, | 2962 Token::Kind kind, |
| (...skipping 5345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8300 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8308 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
| 8301 UNIMPLEMENTED(); \ | 8309 UNIMPLEMENTED(); \ |
| 8302 return NULL; \ | 8310 return NULL; \ |
| 8303 } \ | 8311 } \ |
| 8304 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8312 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
| 8305 | 8313 |
| 8306 | 8314 |
| 8307 } // namespace dart | 8315 } // namespace dart |
| 8308 | 8316 |
| 8309 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 8317 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |