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