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 RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 5 #ifndef RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
6 #define RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 6 #define RUNTIME_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 2735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2746 | 2746 |
2747 virtual EffectSet Effects() const { return EffectSet::None(); } | 2747 virtual EffectSet Effects() const { return EffectSet::None(); } |
2748 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 2748 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
2749 virtual bool AttributesEqual(Instruction* other) const { return true; } | 2749 virtual bool AttributesEqual(Instruction* other) const { return true; } |
2750 | 2750 |
2751 private: | 2751 private: |
2752 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); | 2752 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); |
2753 }; | 2753 }; |
2754 | 2754 |
2755 | 2755 |
2756 class ClosureCallInstr : public TemplateDefinition<1, Throws> { | 2756 struct ArgumentsInfo { |
| 2757 ArgumentsInfo(intptr_t type_args_len, |
| 2758 intptr_t pushed_argc, |
| 2759 const Array& argument_names) |
| 2760 : type_args_len(type_args_len), |
| 2761 pushed_argc(pushed_argc), |
| 2762 argument_names(argument_names) {} |
| 2763 |
| 2764 RawArray* ToArgumentsDescriptor() const { |
| 2765 return ArgumentsDescriptor::New(type_args_len, |
| 2766 pushed_argc - (type_args_len > 0 ? 1 : 0), |
| 2767 argument_names); |
| 2768 } |
| 2769 |
| 2770 intptr_t type_args_len; |
| 2771 intptr_t pushed_argc; |
| 2772 const Array& argument_names; |
| 2773 }; |
| 2774 |
| 2775 |
| 2776 template <intptr_t kInputCount> |
| 2777 class TemplateDartCall : public TemplateDefinition<kInputCount, Throws> { |
| 2778 public: |
| 2779 TemplateDartCall(intptr_t deopt_id, |
| 2780 intptr_t type_args_len, |
| 2781 const Array& argument_names, |
| 2782 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
| 2783 TokenPosition token_pos) |
| 2784 : TemplateDefinition<kInputCount, Throws>(deopt_id), |
| 2785 type_args_len_(type_args_len), |
| 2786 argument_names_(argument_names), |
| 2787 arguments_(arguments), |
| 2788 token_pos_(token_pos) { |
| 2789 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); |
| 2790 } |
| 2791 |
| 2792 intptr_t FirstParamIndex() const { return type_args_len() > 0 ? 1 : 0; } |
| 2793 intptr_t ArgumentCountWithoutTypeArgs() const { |
| 2794 return arguments_->length() - FirstParamIndex(); |
| 2795 } |
| 2796 // ArgumentCount() includes the type argument vector if any. |
| 2797 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 2798 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| 2799 return (*arguments_)[index]; |
| 2800 } |
| 2801 intptr_t type_args_len() const { return type_args_len_; } |
| 2802 const Array& argument_names() const { return argument_names_; } |
| 2803 virtual TokenPosition token_pos() const { return token_pos_; } |
| 2804 RawArray* GetArgumentsDescriptor() const { |
| 2805 return ArgumentsDescriptor::New( |
| 2806 type_args_len(), ArgumentCountWithoutTypeArgs(), argument_names()); |
| 2807 } |
| 2808 |
| 2809 private: |
| 2810 intptr_t type_args_len_; |
| 2811 const Array& argument_names_; |
| 2812 ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
| 2813 TokenPosition token_pos_; |
| 2814 |
| 2815 DISALLOW_COPY_AND_ASSIGN(TemplateDartCall); |
| 2816 }; |
| 2817 |
| 2818 |
| 2819 class ClosureCallInstr : public TemplateDartCall<1> { |
2757 public: | 2820 public: |
2758 ClosureCallInstr(Value* function, | 2821 ClosureCallInstr(Value* function, |
2759 ClosureCallNode* node, | 2822 ClosureCallNode* node, |
2760 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 2823 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
2761 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 2824 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), |
2762 argument_names_(node->arguments()->names()), | 2825 node->arguments()->type_args_len(), |
2763 token_pos_(node->token_pos()), | 2826 node->arguments()->names(), |
2764 arguments_(arguments) { | 2827 arguments, |
| 2828 node->token_pos()) { |
| 2829 ASSERT(!arguments->is_empty()); |
2765 SetInputAt(0, function); | 2830 SetInputAt(0, function); |
2766 } | 2831 } |
2767 | 2832 |
2768 ClosureCallInstr(Value* function, | 2833 ClosureCallInstr(Value* function, |
2769 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 2834 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
| 2835 intptr_t type_args_len, |
2770 const Array& argument_names, | 2836 const Array& argument_names, |
2771 TokenPosition token_pos) | 2837 TokenPosition token_pos) |
2772 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 2838 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), |
2773 argument_names_(argument_names), | 2839 type_args_len, |
2774 token_pos_(token_pos), | 2840 argument_names, |
2775 arguments_(arguments) { | 2841 arguments, |
| 2842 token_pos) { |
| 2843 ASSERT(!arguments->is_empty()); |
2776 SetInputAt(0, function); | 2844 SetInputAt(0, function); |
2777 } | 2845 } |
2778 | 2846 |
2779 DECLARE_INSTRUCTION(ClosureCall) | 2847 DECLARE_INSTRUCTION(ClosureCall) |
2780 | 2848 |
2781 const Array& argument_names() const { return argument_names_; } | |
2782 virtual TokenPosition token_pos() const { return token_pos_; } | |
2783 | |
2784 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | |
2785 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | |
2786 return (*arguments_)[index]; | |
2787 } | |
2788 | |
2789 // TODO(kmillikin): implement exact call counts for closure calls. | 2849 // TODO(kmillikin): implement exact call counts for closure calls. |
2790 virtual intptr_t CallCount() const { return 1; } | 2850 virtual intptr_t CallCount() const { return 1; } |
2791 | 2851 |
2792 virtual bool ComputeCanDeoptimize() const { return true; } | 2852 virtual bool ComputeCanDeoptimize() const { return true; } |
2793 | 2853 |
2794 virtual EffectSet Effects() const { return EffectSet::All(); } | 2854 virtual EffectSet Effects() const { return EffectSet::All(); } |
2795 | 2855 |
2796 PRINT_OPERANDS_TO_SUPPORT | 2856 PRINT_OPERANDS_TO_SUPPORT |
2797 | 2857 |
2798 private: | 2858 private: |
2799 const Array& argument_names_; | |
2800 TokenPosition token_pos_; | |
2801 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | |
2802 | |
2803 DISALLOW_COPY_AND_ASSIGN(ClosureCallInstr); | 2859 DISALLOW_COPY_AND_ASSIGN(ClosureCallInstr); |
2804 }; | 2860 }; |
2805 | 2861 |
2806 | 2862 |
2807 class InstanceCallInstr : public TemplateDefinition<0, Throws> { | 2863 class InstanceCallInstr : public TemplateDartCall<0> { |
2808 public: | 2864 public: |
2809 InstanceCallInstr(TokenPosition token_pos, | 2865 InstanceCallInstr(TokenPosition token_pos, |
2810 const String& function_name, | 2866 const String& function_name, |
2811 Token::Kind token_kind, | 2867 Token::Kind token_kind, |
2812 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 2868 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
| 2869 intptr_t type_args_len, |
2813 const Array& argument_names, | 2870 const Array& argument_names, |
2814 intptr_t checked_argument_count, | 2871 intptr_t checked_argument_count, |
2815 const ZoneGrowableArray<const ICData*>& ic_data_array) | 2872 const ZoneGrowableArray<const ICData*>& ic_data_array) |
2816 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 2873 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), |
| 2874 type_args_len, |
| 2875 argument_names, |
| 2876 arguments, |
| 2877 token_pos), |
2817 ic_data_(NULL), | 2878 ic_data_(NULL), |
2818 token_pos_(token_pos), | |
2819 function_name_(function_name), | 2879 function_name_(function_name), |
2820 token_kind_(token_kind), | 2880 token_kind_(token_kind), |
2821 arguments_(arguments), | |
2822 argument_names_(argument_names), | |
2823 checked_argument_count_(checked_argument_count), | 2881 checked_argument_count_(checked_argument_count), |
2824 has_unique_selector_(false) { | 2882 has_unique_selector_(false) { |
2825 ic_data_ = GetICData(ic_data_array); | 2883 ic_data_ = GetICData(ic_data_array); |
2826 ASSERT(function_name.IsNotTemporaryScopedHandle()); | 2884 ASSERT(function_name.IsNotTemporaryScopedHandle()); |
2827 ASSERT(!arguments->is_empty()); | 2885 ASSERT(!arguments->is_empty()); |
2828 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); | |
2829 ASSERT(Token::IsBinaryOperator(token_kind) || | 2886 ASSERT(Token::IsBinaryOperator(token_kind) || |
2830 Token::IsEqualityOperator(token_kind) || | 2887 Token::IsEqualityOperator(token_kind) || |
2831 Token::IsRelationalOperator(token_kind) || | 2888 Token::IsRelationalOperator(token_kind) || |
2832 Token::IsUnaryOperator(token_kind) || | 2889 Token::IsUnaryOperator(token_kind) || |
2833 Token::IsIndexOperator(token_kind) || | 2890 Token::IsIndexOperator(token_kind) || |
2834 Token::IsTypeTestOperator(token_kind) || | 2891 Token::IsTypeTestOperator(token_kind) || |
2835 Token::IsTypeCastOperator(token_kind) || token_kind == Token::kGET || | 2892 Token::IsTypeCastOperator(token_kind) || token_kind == Token::kGET || |
2836 token_kind == Token::kSET || token_kind == Token::kILLEGAL); | 2893 token_kind == Token::kSET || token_kind == Token::kILLEGAL); |
2837 } | 2894 } |
2838 | 2895 |
2839 DECLARE_INSTRUCTION(InstanceCall) | 2896 DECLARE_INSTRUCTION(InstanceCall) |
2840 | 2897 |
2841 const ICData* ic_data() const { return ic_data_; } | 2898 const ICData* ic_data() const { return ic_data_; } |
2842 bool HasICData() const { return (ic_data() != NULL) && !ic_data()->IsNull(); } | 2899 bool HasICData() const { return (ic_data() != NULL) && !ic_data()->IsNull(); } |
2843 | 2900 |
2844 // ICData can be replaced by optimizer. | 2901 // ICData can be replaced by optimizer. |
2845 void set_ic_data(const ICData* value) { ic_data_ = value; } | 2902 void set_ic_data(const ICData* value) { ic_data_ = value; } |
2846 | 2903 |
2847 virtual TokenPosition token_pos() const { return token_pos_; } | |
2848 const String& function_name() const { return function_name_; } | 2904 const String& function_name() const { return function_name_; } |
2849 Token::Kind token_kind() const { return token_kind_; } | 2905 Token::Kind token_kind() const { return token_kind_; } |
2850 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | |
2851 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | |
2852 return (*arguments_)[index]; | |
2853 } | |
2854 const Array& argument_names() const { return argument_names_; } | |
2855 intptr_t checked_argument_count() const { return checked_argument_count_; } | 2906 intptr_t checked_argument_count() const { return checked_argument_count_; } |
2856 | 2907 |
2857 bool has_unique_selector() const { return has_unique_selector_; } | 2908 bool has_unique_selector() const { return has_unique_selector_; } |
2858 void set_has_unique_selector(bool b) { has_unique_selector_ = b; } | 2909 void set_has_unique_selector(bool b) { has_unique_selector_ = b; } |
2859 | 2910 |
2860 virtual bool ComputeCanDeoptimize() const { return true; } | 2911 virtual bool ComputeCanDeoptimize() const { return true; } |
2861 | 2912 |
2862 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 2913 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
2863 | 2914 |
2864 virtual bool CanBecomeDeoptimizationTarget() const { | 2915 virtual bool CanBecomeDeoptimizationTarget() const { |
2865 // Instance calls that are specialized by the optimizer need a | 2916 // Instance calls that are specialized by the optimizer need a |
2866 // deoptimization descriptor before the call. | 2917 // deoptimization descriptor before the call. |
2867 return true; | 2918 return true; |
2868 } | 2919 } |
2869 | 2920 |
2870 virtual EffectSet Effects() const { return EffectSet::All(); } | 2921 virtual EffectSet Effects() const { return EffectSet::All(); } |
2871 | 2922 |
2872 PRINT_OPERANDS_TO_SUPPORT | 2923 PRINT_OPERANDS_TO_SUPPORT |
2873 | 2924 |
2874 bool MatchesCoreName(const String& name); | 2925 bool MatchesCoreName(const String& name); |
2875 | 2926 |
| 2927 RawFunction* ResolveForReceiverClass(const Class& cls); |
| 2928 |
2876 protected: | 2929 protected: |
2877 friend class JitOptimizer; | 2930 friend class JitOptimizer; |
2878 void set_ic_data(ICData* value) { ic_data_ = value; } | 2931 void set_ic_data(ICData* value) { ic_data_ = value; } |
2879 | 2932 |
2880 private: | 2933 private: |
2881 const ICData* ic_data_; | 2934 const ICData* ic_data_; |
2882 const TokenPosition token_pos_; | |
2883 const String& function_name_; | 2935 const String& function_name_; |
2884 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. | 2936 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. |
2885 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; | |
2886 const Array& argument_names_; | |
2887 const intptr_t checked_argument_count_; | 2937 const intptr_t checked_argument_count_; |
2888 bool has_unique_selector_; | 2938 bool has_unique_selector_; |
2889 | 2939 |
2890 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr); | 2940 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr); |
2891 }; | 2941 }; |
2892 | 2942 |
2893 | 2943 |
2894 class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> { | 2944 class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> { |
2895 public: | 2945 public: |
2896 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, | 2946 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, |
(...skipping 30 matching lines...) Expand all Loading... |
2927 bool HasOnlyDispatcherOrImplicitAccessorTargets() const; | 2977 bool HasOnlyDispatcherOrImplicitAccessorTargets() const; |
2928 | 2978 |
2929 const CallTargets& targets() const { return targets_; } | 2979 const CallTargets& targets() const { return targets_; } |
2930 intptr_t NumberOfChecks() const { return targets_.length(); } | 2980 intptr_t NumberOfChecks() const { return targets_.length(); } |
2931 | 2981 |
2932 bool IsSureToCallSingleRecognizedTarget() const; | 2982 bool IsSureToCallSingleRecognizedTarget() const; |
2933 | 2983 |
2934 virtual intptr_t CallCount() const; | 2984 virtual intptr_t CallCount() const; |
2935 | 2985 |
2936 // If this polymophic call site was created to cover the remaining cids after | 2986 // If this polymophic call site was created to cover the remaining cids after |
2937 // inlinng then we need to keep track of the total number of calls including | 2987 // inlining then we need to keep track of the total number of calls including |
2938 // the ones that wer inlined. This is different from the CallCount above: Eg | 2988 // the ones that we inlined. This is different from the CallCount above: Eg |
2939 // if there were 100 calls originally, distributed across three class-ids in | 2989 // if there were 100 calls originally, distributed across three class-ids in |
2940 // the ratio 50, 40, 7, 3. The first two were inlined, so now we have only | 2990 // the ratio 50, 40, 7, 3. The first two were inlined, so now we have only |
2941 // 10 calls in the CallCount above, but the heuristics need to know that the | 2991 // 10 calls in the CallCount above, but the heuristics need to know that the |
2942 // last two cids cover 7% and 3% of the calls, not 70% and 30%. | 2992 // last two cids cover 7% and 3% of the calls, not 70% and 30%. |
2943 intptr_t total_call_count() { return total_call_count_; } | 2993 intptr_t total_call_count() { return total_call_count_; } |
2944 | 2994 |
2945 void set_total_call_count(intptr_t count) { total_call_count_ = count; } | 2995 void set_total_call_count(intptr_t count) { total_call_count_ = count; } |
2946 | 2996 |
2947 DECLARE_INSTRUCTION(PolymorphicInstanceCall) | 2997 DECLARE_INSTRUCTION(PolymorphicInstanceCall) |
2948 | 2998 |
2949 virtual bool ComputeCanDeoptimize() const { return true; } | 2999 virtual bool ComputeCanDeoptimize() const { return true; } |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3256 } | 3306 } |
3257 | 3307 |
3258 ComparisonInstr* comparison_; | 3308 ComparisonInstr* comparison_; |
3259 const intptr_t if_true_; | 3309 const intptr_t if_true_; |
3260 const intptr_t if_false_; | 3310 const intptr_t if_false_; |
3261 | 3311 |
3262 DISALLOW_COPY_AND_ASSIGN(IfThenElseInstr); | 3312 DISALLOW_COPY_AND_ASSIGN(IfThenElseInstr); |
3263 }; | 3313 }; |
3264 | 3314 |
3265 | 3315 |
3266 class StaticCallInstr : public TemplateDefinition<0, Throws> { | 3316 class StaticCallInstr : public TemplateDartCall<0> { |
3267 public: | 3317 public: |
3268 StaticCallInstr(TokenPosition token_pos, | 3318 StaticCallInstr(TokenPosition token_pos, |
3269 const Function& function, | 3319 const Function& function, |
| 3320 intptr_t type_args_len, |
3270 const Array& argument_names, | 3321 const Array& argument_names, |
3271 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 3322 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
3272 const ZoneGrowableArray<const ICData*>& ic_data_array) | 3323 const ZoneGrowableArray<const ICData*>& ic_data_array) |
3273 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 3324 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), |
| 3325 type_args_len, |
| 3326 argument_names, |
| 3327 arguments, |
| 3328 token_pos), |
3274 ic_data_(NULL), | 3329 ic_data_(NULL), |
3275 token_pos_(token_pos), | |
3276 function_(function), | 3330 function_(function), |
3277 argument_names_(argument_names), | |
3278 arguments_(arguments), | |
3279 result_cid_(kDynamicCid), | 3331 result_cid_(kDynamicCid), |
3280 is_known_list_constructor_(false), | 3332 is_known_list_constructor_(false), |
3281 identity_(AliasIdentity::Unknown()) { | 3333 identity_(AliasIdentity::Unknown()) { |
3282 ic_data_ = GetICData(ic_data_array); | 3334 ic_data_ = GetICData(ic_data_array); |
3283 ASSERT(function.IsZoneHandle()); | 3335 ASSERT(function.IsZoneHandle()); |
3284 ASSERT(!function.IsNull()); | 3336 ASSERT(!function.IsNull()); |
3285 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); | |
3286 } | 3337 } |
3287 | 3338 |
3288 StaticCallInstr(TokenPosition token_pos, | 3339 StaticCallInstr(TokenPosition token_pos, |
3289 const Function& function, | 3340 const Function& function, |
| 3341 intptr_t type_args_len, |
3290 const Array& argument_names, | 3342 const Array& argument_names, |
3291 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 3343 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
3292 intptr_t deopt_id) | 3344 intptr_t deopt_id) |
3293 : TemplateDefinition(deopt_id), | 3345 : TemplateDartCall(deopt_id, |
| 3346 type_args_len, |
| 3347 argument_names, |
| 3348 arguments, |
| 3349 token_pos), |
3294 ic_data_(NULL), | 3350 ic_data_(NULL), |
3295 token_pos_(token_pos), | |
3296 function_(function), | 3351 function_(function), |
3297 argument_names_(argument_names), | |
3298 arguments_(arguments), | |
3299 result_cid_(kDynamicCid), | 3352 result_cid_(kDynamicCid), |
3300 is_known_list_constructor_(false), | 3353 is_known_list_constructor_(false), |
3301 identity_(AliasIdentity::Unknown()) { | 3354 identity_(AliasIdentity::Unknown()) { |
3302 ASSERT(function.IsZoneHandle()); | 3355 ASSERT(function.IsZoneHandle()); |
3303 ASSERT(!function.IsNull()); | 3356 ASSERT(!function.IsNull()); |
3304 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); | |
3305 } | 3357 } |
3306 | 3358 |
3307 // ICData for static calls carries call count. | 3359 // ICData for static calls carries call count. |
3308 const ICData* ic_data() const { return ic_data_; } | 3360 const ICData* ic_data() const { return ic_data_; } |
3309 bool HasICData() const { return (ic_data() != NULL) && !ic_data()->IsNull(); } | 3361 bool HasICData() const { return (ic_data() != NULL) && !ic_data()->IsNull(); } |
3310 | 3362 |
3311 void set_ic_data(const ICData* value) { ic_data_ = value; } | 3363 void set_ic_data(const ICData* value) { ic_data_ = value; } |
3312 | 3364 |
3313 DECLARE_INSTRUCTION(StaticCall) | 3365 DECLARE_INSTRUCTION(StaticCall) |
3314 virtual CompileType ComputeType() const; | 3366 virtual CompileType ComputeType() const; |
3315 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 3367 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
3316 | 3368 |
3317 // Accessors forwarded to the AST node. | 3369 // Accessors forwarded to the AST node. |
3318 const Function& function() const { return function_; } | 3370 const Function& function() const { return function_; } |
3319 const Array& argument_names() const { return argument_names_; } | |
3320 virtual TokenPosition token_pos() const { return token_pos_; } | |
3321 | |
3322 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | |
3323 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | |
3324 return (*arguments_)[index]; | |
3325 } | |
3326 | 3371 |
3327 virtual intptr_t CallCount() const { | 3372 virtual intptr_t CallCount() const { |
3328 return ic_data() == NULL ? 0 : ic_data()->AggregateCount(); | 3373 return ic_data() == NULL ? 0 : ic_data()->AggregateCount(); |
3329 } | 3374 } |
3330 | 3375 |
3331 virtual bool ComputeCanDeoptimize() const { return true; } | 3376 virtual bool ComputeCanDeoptimize() const { return true; } |
3332 | 3377 |
3333 virtual bool CanBecomeDeoptimizationTarget() const { | 3378 virtual bool CanBecomeDeoptimizationTarget() const { |
3334 // Static calls that are specialized by the optimizer (e.g. sqrt) need a | 3379 // Static calls that are specialized by the optimizer (e.g. sqrt) need a |
3335 // deoptimization descriptor before the call. | 3380 // deoptimization descriptor before the call. |
(...skipping 11 matching lines...) Expand all Loading... |
3347 | 3392 |
3348 bool IsRecognizedFactory() const { return is_known_list_constructor(); } | 3393 bool IsRecognizedFactory() const { return is_known_list_constructor(); } |
3349 | 3394 |
3350 virtual AliasIdentity Identity() const { return identity_; } | 3395 virtual AliasIdentity Identity() const { return identity_; } |
3351 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } | 3396 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } |
3352 | 3397 |
3353 PRINT_OPERANDS_TO_SUPPORT | 3398 PRINT_OPERANDS_TO_SUPPORT |
3354 | 3399 |
3355 private: | 3400 private: |
3356 const ICData* ic_data_; | 3401 const ICData* ic_data_; |
3357 const TokenPosition token_pos_; | |
3358 const Function& function_; | 3402 const Function& function_; |
3359 const Array& argument_names_; | |
3360 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | |
3361 intptr_t result_cid_; // For some library functions we know the result. | 3403 intptr_t result_cid_; // For some library functions we know the result. |
3362 | 3404 |
3363 // 'True' for recognized list constructors. | 3405 // 'True' for recognized list constructors. |
3364 bool is_known_list_constructor_; | 3406 bool is_known_list_constructor_; |
3365 | 3407 |
3366 AliasIdentity identity_; | 3408 AliasIdentity identity_; |
3367 | 3409 |
3368 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); | 3410 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); |
3369 }; | 3411 }; |
3370 | 3412 |
(...skipping 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6773 }; | 6815 }; |
6774 | 6816 |
6775 | 6817 |
6776 class CheckedSmiOpInstr : public TemplateDefinition<2, Throws> { | 6818 class CheckedSmiOpInstr : public TemplateDefinition<2, Throws> { |
6777 public: | 6819 public: |
6778 CheckedSmiOpInstr(Token::Kind op_kind, | 6820 CheckedSmiOpInstr(Token::Kind op_kind, |
6779 Value* left, | 6821 Value* left, |
6780 Value* right, | 6822 Value* right, |
6781 InstanceCallInstr* call) | 6823 InstanceCallInstr* call) |
6782 : TemplateDefinition(call->deopt_id()), call_(call), op_kind_(op_kind) { | 6824 : TemplateDefinition(call->deopt_id()), call_(call), op_kind_(op_kind) { |
| 6825 ASSERT(call->type_args_len() == 0); |
6783 SetInputAt(0, left); | 6826 SetInputAt(0, left); |
6784 SetInputAt(1, right); | 6827 SetInputAt(1, right); |
6785 } | 6828 } |
6786 | 6829 |
6787 InstanceCallInstr* call() const { return call_; } | 6830 InstanceCallInstr* call() const { return call_; } |
6788 Token::Kind op_kind() const { return op_kind_; } | 6831 Token::Kind op_kind() const { return op_kind_; } |
6789 Value* left() const { return inputs_[0]; } | 6832 Value* left() const { return inputs_[0]; } |
6790 Value* right() const { return inputs_[1]; } | 6833 Value* right() const { return inputs_[1]; } |
6791 | 6834 |
6792 virtual bool ComputeCanDeoptimize() const { return false; } | 6835 virtual bool ComputeCanDeoptimize() const { return false; } |
(...skipping 15 matching lines...) Expand all Loading... |
6808 | 6851 |
6809 class CheckedSmiComparisonInstr : public TemplateComparison<2, Throws> { | 6852 class CheckedSmiComparisonInstr : public TemplateComparison<2, Throws> { |
6810 public: | 6853 public: |
6811 CheckedSmiComparisonInstr(Token::Kind op_kind, | 6854 CheckedSmiComparisonInstr(Token::Kind op_kind, |
6812 Value* left, | 6855 Value* left, |
6813 Value* right, | 6856 Value* right, |
6814 InstanceCallInstr* call) | 6857 InstanceCallInstr* call) |
6815 : TemplateComparison(call->token_pos(), op_kind, call->deopt_id()), | 6858 : TemplateComparison(call->token_pos(), op_kind, call->deopt_id()), |
6816 call_(call), | 6859 call_(call), |
6817 is_negated_(false) { | 6860 is_negated_(false) { |
| 6861 ASSERT(call->type_args_len() == 0); |
6818 SetInputAt(0, left); | 6862 SetInputAt(0, left); |
6819 SetInputAt(1, right); | 6863 SetInputAt(1, right); |
6820 } | 6864 } |
6821 | 6865 |
6822 InstanceCallInstr* call() const { return call_; } | 6866 InstanceCallInstr* call() const { return call_; } |
6823 | 6867 |
6824 virtual bool ComputeCanDeoptimize() const { return false; } | 6868 virtual bool ComputeCanDeoptimize() const { return false; } |
6825 | 6869 |
6826 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 6870 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
6827 | 6871 |
(...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8170 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8214 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
8171 UNIMPLEMENTED(); \ | 8215 UNIMPLEMENTED(); \ |
8172 return NULL; \ | 8216 return NULL; \ |
8173 } \ | 8217 } \ |
8174 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8218 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
8175 | 8219 |
8176 | 8220 |
8177 } // namespace dart | 8221 } // namespace dart |
8178 | 8222 |
8179 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 8223 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |