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 2690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2701 | 2701 |
2702 virtual EffectSet Effects() const { return EffectSet::None(); } | 2702 virtual EffectSet Effects() const { return EffectSet::None(); } |
2703 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 2703 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
2704 virtual bool AttributesEqual(Instruction* other) const { return true; } | 2704 virtual bool AttributesEqual(Instruction* other) const { return true; } |
2705 | 2705 |
2706 private: | 2706 private: |
2707 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); | 2707 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); |
2708 }; | 2708 }; |
2709 | 2709 |
2710 | 2710 |
2711 class ClosureCallInstr : public TemplateDefinition<1, Throws> { | 2711 struct ArgumentsInfo { |
| 2712 public: |
| 2713 ArgumentsInfo(intptr_t type_args_len, |
| 2714 intptr_t pushed_argc, |
| 2715 const Array& argument_names) |
| 2716 : type_args_len_(type_args_len), |
| 2717 pushed_argc_(pushed_argc), |
| 2718 argument_names_(argument_names) {} |
| 2719 |
| 2720 intptr_t pushed_argc() const { return pushed_argc_; } |
| 2721 |
| 2722 const Array& ToArgumentsDescriptor(Zone* zone) const { |
| 2723 return Array::ZoneHandle( |
| 2724 zone, ArgumentsDescriptor::New( |
| 2725 type_args_len_, pushed_argc_ - (type_args_len_ > 0 ? 1 : 0), |
| 2726 argument_names_)); |
| 2727 } |
| 2728 |
| 2729 private: |
| 2730 intptr_t type_args_len_; |
| 2731 intptr_t pushed_argc_; |
| 2732 const Array& argument_names_; |
| 2733 }; |
| 2734 |
| 2735 |
| 2736 template <intptr_t kInputCount> |
| 2737 class TemplateDartCall : public TemplateDefinition<kInputCount, Throws> { |
| 2738 public: |
| 2739 TemplateDartCall(intptr_t deopt_id, |
| 2740 intptr_t type_args_len, |
| 2741 const Array& argument_names, |
| 2742 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
| 2743 TokenPosition token_pos) |
| 2744 : TemplateDefinition<kInputCount, Throws>(deopt_id), |
| 2745 type_args_len_(type_args_len), |
| 2746 argument_names_(argument_names), |
| 2747 arguments_(arguments), |
| 2748 token_pos_(token_pos) { |
| 2749 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); |
| 2750 } |
| 2751 |
| 2752 virtual intptr_t ArgumentCountWithoutTypeArgs() const { |
| 2753 return arguments_->length() - (type_args_len() > 0 ? 1 : 0); |
| 2754 } |
| 2755 // ArgumentCount() includes the type argument vector if any. |
| 2756 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 2757 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| 2758 return (*arguments_)[index]; |
| 2759 } |
| 2760 virtual intptr_t type_args_len() const { return type_args_len_; } |
| 2761 virtual const Array& argument_names() const { return argument_names_; } |
| 2762 virtual TokenPosition token_pos() const { return token_pos_; } |
| 2763 virtual const Array& GetArgumentsDescriptor(Zone* zone) const { |
| 2764 return Array::ZoneHandle( |
| 2765 zone, |
| 2766 ArgumentsDescriptor::New( |
| 2767 type_args_len(), ArgumentCountWithoutTypeArgs(), argument_names())); |
| 2768 } |
| 2769 |
| 2770 private: |
| 2771 intptr_t type_args_len_; |
| 2772 const Array& argument_names_; |
| 2773 ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
| 2774 TokenPosition token_pos_; |
| 2775 |
| 2776 DISALLOW_COPY_AND_ASSIGN(TemplateDartCall); |
| 2777 }; |
| 2778 |
| 2779 |
| 2780 class ClosureCallInstr : public TemplateDartCall<1> { |
2712 public: | 2781 public: |
2713 ClosureCallInstr(Value* function, | 2782 ClosureCallInstr(Value* function, |
2714 ClosureCallNode* node, | 2783 ClosureCallNode* node, |
2715 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 2784 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
2716 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 2785 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), |
2717 argument_names_(node->arguments()->names()), | 2786 node->arguments()->type_args_len(), |
2718 token_pos_(node->token_pos()), | 2787 node->arguments()->names(), |
2719 arguments_(arguments) { | 2788 arguments, |
| 2789 node->token_pos()) { |
| 2790 ASSERT(!arguments->is_empty()); |
2720 SetInputAt(0, function); | 2791 SetInputAt(0, function); |
2721 } | 2792 } |
2722 | 2793 |
2723 ClosureCallInstr(Value* function, | 2794 ClosureCallInstr(Value* function, |
2724 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 2795 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
| 2796 intptr_t type_args_len, |
2725 const Array& argument_names, | 2797 const Array& argument_names, |
2726 TokenPosition token_pos) | 2798 TokenPosition token_pos) |
2727 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 2799 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), |
2728 argument_names_(argument_names), | 2800 type_args_len, |
2729 token_pos_(token_pos), | 2801 argument_names, |
2730 arguments_(arguments) { | 2802 arguments, |
| 2803 token_pos) { |
| 2804 ASSERT(!arguments->is_empty()); |
2731 SetInputAt(0, function); | 2805 SetInputAt(0, function); |
2732 } | 2806 } |
2733 | 2807 |
2734 DECLARE_INSTRUCTION(ClosureCall) | 2808 DECLARE_INSTRUCTION(ClosureCall) |
2735 | 2809 |
2736 const Array& argument_names() const { return argument_names_; } | |
2737 virtual TokenPosition token_pos() const { return token_pos_; } | |
2738 | |
2739 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | |
2740 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | |
2741 return (*arguments_)[index]; | |
2742 } | |
2743 | |
2744 // TODO(kmillikin): implement exact call counts for closure calls. | 2810 // TODO(kmillikin): implement exact call counts for closure calls. |
2745 virtual intptr_t CallCount() const { return 1; } | 2811 virtual intptr_t CallCount() const { return 1; } |
2746 | 2812 |
2747 virtual bool ComputeCanDeoptimize() const { return true; } | 2813 virtual bool ComputeCanDeoptimize() const { return true; } |
2748 | 2814 |
2749 virtual EffectSet Effects() const { return EffectSet::All(); } | 2815 virtual EffectSet Effects() const { return EffectSet::All(); } |
2750 | 2816 |
2751 PRINT_OPERANDS_TO_SUPPORT | 2817 PRINT_OPERANDS_TO_SUPPORT |
2752 | 2818 |
2753 private: | 2819 private: |
2754 const Array& argument_names_; | |
2755 TokenPosition token_pos_; | |
2756 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | |
2757 | |
2758 DISALLOW_COPY_AND_ASSIGN(ClosureCallInstr); | 2820 DISALLOW_COPY_AND_ASSIGN(ClosureCallInstr); |
2759 }; | 2821 }; |
2760 | 2822 |
2761 | 2823 |
2762 class InstanceCallInstr : public TemplateDefinition<0, Throws> { | 2824 class InstanceCallInstr : public TemplateDartCall<0> { |
2763 public: | 2825 public: |
2764 InstanceCallInstr(TokenPosition token_pos, | 2826 InstanceCallInstr(TokenPosition token_pos, |
2765 const String& function_name, | 2827 const String& function_name, |
2766 Token::Kind token_kind, | 2828 Token::Kind token_kind, |
2767 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 2829 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
| 2830 intptr_t type_args_len, |
2768 const Array& argument_names, | 2831 const Array& argument_names, |
2769 intptr_t checked_argument_count, | 2832 intptr_t checked_argument_count, |
2770 const ZoneGrowableArray<const ICData*>& ic_data_array) | 2833 const ZoneGrowableArray<const ICData*>& ic_data_array) |
2771 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 2834 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), |
| 2835 type_args_len, |
| 2836 argument_names, |
| 2837 arguments, |
| 2838 token_pos), |
2772 ic_data_(NULL), | 2839 ic_data_(NULL), |
2773 token_pos_(token_pos), | |
2774 function_name_(function_name), | 2840 function_name_(function_name), |
2775 token_kind_(token_kind), | 2841 token_kind_(token_kind), |
2776 arguments_(arguments), | |
2777 argument_names_(argument_names), | |
2778 checked_argument_count_(checked_argument_count), | 2842 checked_argument_count_(checked_argument_count), |
2779 has_unique_selector_(false) { | 2843 has_unique_selector_(false) { |
2780 ic_data_ = GetICData(ic_data_array); | 2844 ic_data_ = GetICData(ic_data_array); |
2781 ASSERT(function_name.IsNotTemporaryScopedHandle()); | 2845 ASSERT(function_name.IsNotTemporaryScopedHandle()); |
2782 ASSERT(!arguments->is_empty()); | 2846 ASSERT(!arguments->is_empty()); |
2783 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); | |
2784 ASSERT(Token::IsBinaryOperator(token_kind) || | 2847 ASSERT(Token::IsBinaryOperator(token_kind) || |
2785 Token::IsEqualityOperator(token_kind) || | 2848 Token::IsEqualityOperator(token_kind) || |
2786 Token::IsRelationalOperator(token_kind) || | 2849 Token::IsRelationalOperator(token_kind) || |
2787 Token::IsUnaryOperator(token_kind) || | 2850 Token::IsUnaryOperator(token_kind) || |
2788 Token::IsIndexOperator(token_kind) || | 2851 Token::IsIndexOperator(token_kind) || |
2789 Token::IsTypeTestOperator(token_kind) || | 2852 Token::IsTypeTestOperator(token_kind) || |
2790 Token::IsTypeCastOperator(token_kind) || token_kind == Token::kGET || | 2853 Token::IsTypeCastOperator(token_kind) || token_kind == Token::kGET || |
2791 token_kind == Token::kSET || token_kind == Token::kILLEGAL); | 2854 token_kind == Token::kSET || token_kind == Token::kILLEGAL); |
2792 } | 2855 } |
2793 | 2856 |
2794 DECLARE_INSTRUCTION(InstanceCall) | 2857 DECLARE_INSTRUCTION(InstanceCall) |
2795 | 2858 |
2796 const ICData* ic_data() const { return ic_data_; } | 2859 const ICData* ic_data() const { return ic_data_; } |
2797 bool HasICData() const { return (ic_data() != NULL) && !ic_data()->IsNull(); } | 2860 bool HasICData() const { return (ic_data() != NULL) && !ic_data()->IsNull(); } |
2798 | 2861 |
2799 // ICData can be replaced by optimizer. | 2862 // ICData can be replaced by optimizer. |
2800 void set_ic_data(const ICData* value) { ic_data_ = value; } | 2863 void set_ic_data(const ICData* value) { ic_data_ = value; } |
2801 | 2864 |
2802 virtual TokenPosition token_pos() const { return token_pos_; } | |
2803 const String& function_name() const { return function_name_; } | 2865 const String& function_name() const { return function_name_; } |
2804 Token::Kind token_kind() const { return token_kind_; } | 2866 Token::Kind token_kind() const { return token_kind_; } |
2805 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | |
2806 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | |
2807 return (*arguments_)[index]; | |
2808 } | |
2809 const Array& argument_names() const { return argument_names_; } | |
2810 intptr_t checked_argument_count() const { return checked_argument_count_; } | 2867 intptr_t checked_argument_count() const { return checked_argument_count_; } |
2811 | 2868 |
2812 bool has_unique_selector() const { return has_unique_selector_; } | 2869 bool has_unique_selector() const { return has_unique_selector_; } |
2813 void set_has_unique_selector(bool b) { has_unique_selector_ = b; } | 2870 void set_has_unique_selector(bool b) { has_unique_selector_ = b; } |
2814 | 2871 |
2815 virtual bool ComputeCanDeoptimize() const { return true; } | 2872 virtual bool ComputeCanDeoptimize() const { return true; } |
2816 | 2873 |
2817 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 2874 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
2818 | 2875 |
2819 virtual bool CanBecomeDeoptimizationTarget() const { | 2876 virtual bool CanBecomeDeoptimizationTarget() const { |
2820 // Instance calls that are specialized by the optimizer need a | 2877 // Instance calls that are specialized by the optimizer need a |
2821 // deoptimization descriptor before the call. | 2878 // deoptimization descriptor before the call. |
2822 return true; | 2879 return true; |
2823 } | 2880 } |
2824 | 2881 |
2825 virtual EffectSet Effects() const { return EffectSet::All(); } | 2882 virtual EffectSet Effects() const { return EffectSet::All(); } |
2826 | 2883 |
2827 PRINT_OPERANDS_TO_SUPPORT | 2884 PRINT_OPERANDS_TO_SUPPORT |
2828 | 2885 |
2829 bool MatchesCoreName(const String& name); | 2886 bool MatchesCoreName(const String& name); |
2830 | 2887 |
2831 protected: | 2888 protected: |
2832 friend class JitOptimizer; | 2889 friend class JitOptimizer; |
2833 void set_ic_data(ICData* value) { ic_data_ = value; } | 2890 void set_ic_data(ICData* value) { ic_data_ = value; } |
2834 | 2891 |
2835 private: | 2892 private: |
2836 const ICData* ic_data_; | 2893 const ICData* ic_data_; |
2837 const TokenPosition token_pos_; | |
2838 const String& function_name_; | 2894 const String& function_name_; |
2839 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. | 2895 const Token::Kind token_kind_; // Binary op, unary op, kGET or kILLEGAL. |
2840 ZoneGrowableArray<PushArgumentInstr*>* const arguments_; | |
2841 const Array& argument_names_; | |
2842 const intptr_t checked_argument_count_; | 2896 const intptr_t checked_argument_count_; |
2843 bool has_unique_selector_; | 2897 bool has_unique_selector_; |
2844 | 2898 |
2845 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr); | 2899 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr); |
2846 }; | 2900 }; |
2847 | 2901 |
2848 | 2902 |
2849 class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> { | 2903 class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> { |
2850 public: | 2904 public: |
2851 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, | 2905 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, |
(...skipping 30 matching lines...) Expand all Loading... |
2882 bool HasOnlyDispatcherOrImplicitAccessorTargets() const; | 2936 bool HasOnlyDispatcherOrImplicitAccessorTargets() const; |
2883 | 2937 |
2884 const CallTargets& targets() const { return targets_; } | 2938 const CallTargets& targets() const { return targets_; } |
2885 intptr_t NumberOfChecks() const { return targets_.length(); } | 2939 intptr_t NumberOfChecks() const { return targets_.length(); } |
2886 | 2940 |
2887 bool IsSureToCallSingleRecognizedTarget() const; | 2941 bool IsSureToCallSingleRecognizedTarget() const; |
2888 | 2942 |
2889 virtual intptr_t CallCount() const; | 2943 virtual intptr_t CallCount() const; |
2890 | 2944 |
2891 // If this polymophic call site was created to cover the remaining cids after | 2945 // If this polymophic call site was created to cover the remaining cids after |
2892 // inlinng then we need to keep track of the total number of calls including | 2946 // inlining then we need to keep track of the total number of calls including |
2893 // the ones that wer inlined. This is different from the CallCount above: Eg | 2947 // the ones that we inlined. This is different from the CallCount above: Eg |
2894 // if there were 100 calls originally, distributed across three class-ids in | 2948 // if there were 100 calls originally, distributed across three class-ids in |
2895 // the ratio 50, 40, 7, 3. The first two were inlined, so now we have only | 2949 // the ratio 50, 40, 7, 3. The first two were inlined, so now we have only |
2896 // 10 calls in the CallCount above, but the heuristics need to know that the | 2950 // 10 calls in the CallCount above, but the heuristics need to know that the |
2897 // last two cids cover 7% and 3% of the calls, not 70% and 30%. | 2951 // last two cids cover 7% and 3% of the calls, not 70% and 30%. |
2898 intptr_t total_call_count() { return total_call_count_; } | 2952 intptr_t total_call_count() { return total_call_count_; } |
2899 | 2953 |
2900 void set_total_call_count(intptr_t count) { total_call_count_ = count; } | 2954 void set_total_call_count(intptr_t count) { total_call_count_ = count; } |
2901 | 2955 |
2902 DECLARE_INSTRUCTION(PolymorphicInstanceCall) | 2956 DECLARE_INSTRUCTION(PolymorphicInstanceCall) |
2903 | 2957 |
2904 virtual bool ComputeCanDeoptimize() const { return true; } | 2958 virtual bool ComputeCanDeoptimize() const { return true; } |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3211 } | 3265 } |
3212 | 3266 |
3213 ComparisonInstr* comparison_; | 3267 ComparisonInstr* comparison_; |
3214 const intptr_t if_true_; | 3268 const intptr_t if_true_; |
3215 const intptr_t if_false_; | 3269 const intptr_t if_false_; |
3216 | 3270 |
3217 DISALLOW_COPY_AND_ASSIGN(IfThenElseInstr); | 3271 DISALLOW_COPY_AND_ASSIGN(IfThenElseInstr); |
3218 }; | 3272 }; |
3219 | 3273 |
3220 | 3274 |
3221 class StaticCallInstr : public TemplateDefinition<0, Throws> { | 3275 class StaticCallInstr : public TemplateDartCall<0> { |
3222 public: | 3276 public: |
3223 StaticCallInstr(TokenPosition token_pos, | 3277 StaticCallInstr(TokenPosition token_pos, |
3224 const Function& function, | 3278 const Function& function, |
| 3279 intptr_t type_args_len, |
3225 const Array& argument_names, | 3280 const Array& argument_names, |
3226 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 3281 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
3227 const ZoneGrowableArray<const ICData*>& ic_data_array) | 3282 const ZoneGrowableArray<const ICData*>& ic_data_array) |
3228 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 3283 : TemplateDartCall(Thread::Current()->GetNextDeoptId(), |
| 3284 type_args_len, |
| 3285 argument_names, |
| 3286 arguments, |
| 3287 token_pos), |
3229 ic_data_(NULL), | 3288 ic_data_(NULL), |
3230 token_pos_(token_pos), | |
3231 function_(function), | 3289 function_(function), |
3232 argument_names_(argument_names), | |
3233 arguments_(arguments), | |
3234 result_cid_(kDynamicCid), | 3290 result_cid_(kDynamicCid), |
3235 is_known_list_constructor_(false), | 3291 is_known_list_constructor_(false), |
3236 identity_(AliasIdentity::Unknown()) { | 3292 identity_(AliasIdentity::Unknown()) { |
3237 ic_data_ = GetICData(ic_data_array); | 3293 ic_data_ = GetICData(ic_data_array); |
3238 ASSERT(function.IsZoneHandle()); | 3294 ASSERT(function.IsZoneHandle()); |
3239 ASSERT(!function.IsNull()); | 3295 ASSERT(!function.IsNull()); |
3240 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); | |
3241 } | 3296 } |
3242 | 3297 |
3243 StaticCallInstr(TokenPosition token_pos, | 3298 StaticCallInstr(TokenPosition token_pos, |
3244 const Function& function, | 3299 const Function& function, |
| 3300 intptr_t type_args_len, |
3245 const Array& argument_names, | 3301 const Array& argument_names, |
3246 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 3302 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
3247 intptr_t deopt_id) | 3303 intptr_t deopt_id) |
3248 : TemplateDefinition(deopt_id), | 3304 : TemplateDartCall(deopt_id, |
| 3305 type_args_len, |
| 3306 argument_names, |
| 3307 arguments, |
| 3308 token_pos), |
3249 ic_data_(NULL), | 3309 ic_data_(NULL), |
3250 token_pos_(token_pos), | |
3251 function_(function), | 3310 function_(function), |
3252 argument_names_(argument_names), | |
3253 arguments_(arguments), | |
3254 result_cid_(kDynamicCid), | 3311 result_cid_(kDynamicCid), |
3255 is_known_list_constructor_(false), | 3312 is_known_list_constructor_(false), |
3256 identity_(AliasIdentity::Unknown()) { | 3313 identity_(AliasIdentity::Unknown()) { |
3257 ASSERT(function.IsZoneHandle()); | 3314 ASSERT(function.IsZoneHandle()); |
3258 ASSERT(!function.IsNull()); | 3315 ASSERT(!function.IsNull()); |
3259 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); | |
3260 } | 3316 } |
3261 | 3317 |
3262 // ICData for static calls carries call count. | 3318 // ICData for static calls carries call count. |
3263 const ICData* ic_data() const { return ic_data_; } | 3319 const ICData* ic_data() const { return ic_data_; } |
3264 bool HasICData() const { return (ic_data() != NULL) && !ic_data()->IsNull(); } | 3320 bool HasICData() const { return (ic_data() != NULL) && !ic_data()->IsNull(); } |
3265 | 3321 |
3266 void set_ic_data(const ICData* value) { ic_data_ = value; } | 3322 void set_ic_data(const ICData* value) { ic_data_ = value; } |
3267 | 3323 |
3268 DECLARE_INSTRUCTION(StaticCall) | 3324 DECLARE_INSTRUCTION(StaticCall) |
3269 virtual CompileType ComputeType() const; | 3325 virtual CompileType ComputeType() const; |
3270 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 3326 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
3271 | 3327 |
3272 // Accessors forwarded to the AST node. | 3328 // Accessors forwarded to the AST node. |
3273 const Function& function() const { return function_; } | 3329 const Function& function() const { return function_; } |
3274 const Array& argument_names() const { return argument_names_; } | |
3275 virtual TokenPosition token_pos() const { return token_pos_; } | |
3276 | |
3277 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | |
3278 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | |
3279 return (*arguments_)[index]; | |
3280 } | |
3281 | 3330 |
3282 virtual intptr_t CallCount() const { | 3331 virtual intptr_t CallCount() const { |
3283 return ic_data() == NULL ? 0 : ic_data()->AggregateCount(); | 3332 return ic_data() == NULL ? 0 : ic_data()->AggregateCount(); |
3284 } | 3333 } |
3285 | 3334 |
3286 virtual bool ComputeCanDeoptimize() const { return true; } | 3335 virtual bool ComputeCanDeoptimize() const { return true; } |
3287 | 3336 |
3288 virtual bool CanBecomeDeoptimizationTarget() const { | 3337 virtual bool CanBecomeDeoptimizationTarget() const { |
3289 // Static calls that are specialized by the optimizer (e.g. sqrt) need a | 3338 // Static calls that are specialized by the optimizer (e.g. sqrt) need a |
3290 // deoptimization descriptor before the call. | 3339 // deoptimization descriptor before the call. |
(...skipping 11 matching lines...) Expand all Loading... |
3302 | 3351 |
3303 bool IsRecognizedFactory() const { return is_known_list_constructor(); } | 3352 bool IsRecognizedFactory() const { return is_known_list_constructor(); } |
3304 | 3353 |
3305 virtual AliasIdentity Identity() const { return identity_; } | 3354 virtual AliasIdentity Identity() const { return identity_; } |
3306 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } | 3355 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } |
3307 | 3356 |
3308 PRINT_OPERANDS_TO_SUPPORT | 3357 PRINT_OPERANDS_TO_SUPPORT |
3309 | 3358 |
3310 private: | 3359 private: |
3311 const ICData* ic_data_; | 3360 const ICData* ic_data_; |
3312 const TokenPosition token_pos_; | |
3313 const Function& function_; | 3361 const Function& function_; |
3314 const Array& argument_names_; | |
3315 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | |
3316 intptr_t result_cid_; // For some library functions we know the result. | 3362 intptr_t result_cid_; // For some library functions we know the result. |
3317 | 3363 |
3318 // 'True' for recognized list constructors. | 3364 // 'True' for recognized list constructors. |
3319 bool is_known_list_constructor_; | 3365 bool is_known_list_constructor_; |
3320 | 3366 |
3321 AliasIdentity identity_; | 3367 AliasIdentity identity_; |
3322 | 3368 |
3323 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); | 3369 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); |
3324 }; | 3370 }; |
3325 | 3371 |
(...skipping 3402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6728 }; | 6774 }; |
6729 | 6775 |
6730 | 6776 |
6731 class CheckedSmiOpInstr : public TemplateDefinition<2, Throws> { | 6777 class CheckedSmiOpInstr : public TemplateDefinition<2, Throws> { |
6732 public: | 6778 public: |
6733 CheckedSmiOpInstr(Token::Kind op_kind, | 6779 CheckedSmiOpInstr(Token::Kind op_kind, |
6734 Value* left, | 6780 Value* left, |
6735 Value* right, | 6781 Value* right, |
6736 InstanceCallInstr* call) | 6782 InstanceCallInstr* call) |
6737 : TemplateDefinition(call->deopt_id()), call_(call), op_kind_(op_kind) { | 6783 : TemplateDefinition(call->deopt_id()), call_(call), op_kind_(op_kind) { |
| 6784 ASSERT(call->type_args_len() == 0); |
6738 SetInputAt(0, left); | 6785 SetInputAt(0, left); |
6739 SetInputAt(1, right); | 6786 SetInputAt(1, right); |
6740 } | 6787 } |
6741 | 6788 |
6742 InstanceCallInstr* call() const { return call_; } | 6789 InstanceCallInstr* call() const { return call_; } |
6743 Token::Kind op_kind() const { return op_kind_; } | 6790 Token::Kind op_kind() const { return op_kind_; } |
6744 Value* left() const { return inputs_[0]; } | 6791 Value* left() const { return inputs_[0]; } |
6745 Value* right() const { return inputs_[1]; } | 6792 Value* right() const { return inputs_[1]; } |
6746 | 6793 |
6747 virtual bool ComputeCanDeoptimize() const { return false; } | 6794 virtual bool ComputeCanDeoptimize() const { return false; } |
(...skipping 15 matching lines...) Expand all Loading... |
6763 | 6810 |
6764 class CheckedSmiComparisonInstr : public TemplateComparison<2, Throws> { | 6811 class CheckedSmiComparisonInstr : public TemplateComparison<2, Throws> { |
6765 public: | 6812 public: |
6766 CheckedSmiComparisonInstr(Token::Kind op_kind, | 6813 CheckedSmiComparisonInstr(Token::Kind op_kind, |
6767 Value* left, | 6814 Value* left, |
6768 Value* right, | 6815 Value* right, |
6769 InstanceCallInstr* call) | 6816 InstanceCallInstr* call) |
6770 : TemplateComparison(call->token_pos(), op_kind, call->deopt_id()), | 6817 : TemplateComparison(call->token_pos(), op_kind, call->deopt_id()), |
6771 call_(call), | 6818 call_(call), |
6772 is_negated_(false) { | 6819 is_negated_(false) { |
| 6820 ASSERT(call->type_args_len() == 0); |
6773 SetInputAt(0, left); | 6821 SetInputAt(0, left); |
6774 SetInputAt(1, right); | 6822 SetInputAt(1, right); |
6775 } | 6823 } |
6776 | 6824 |
6777 InstanceCallInstr* call() const { return call_; } | 6825 InstanceCallInstr* call() const { return call_; } |
6778 | 6826 |
6779 virtual bool ComputeCanDeoptimize() const { return false; } | 6827 virtual bool ComputeCanDeoptimize() const { return false; } |
6780 | 6828 |
6781 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 6829 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
6782 | 6830 |
(...skipping 1331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8114 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8162 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
8115 UNIMPLEMENTED(); \ | 8163 UNIMPLEMENTED(); \ |
8116 return NULL; \ | 8164 return NULL; \ |
8117 } \ | 8165 } \ |
8118 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8166 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
8119 | 8167 |
8120 | 8168 |
8121 } // namespace dart | 8169 } // namespace dart |
8122 | 8170 |
8123 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 8171 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |