| 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 2794 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2805 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 2805 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 2806 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 2806 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| 2807 return (*arguments_)[index]; | 2807 return (*arguments_)[index]; |
| 2808 } | 2808 } |
| 2809 const Array& argument_names() const { return argument_names_; } | 2809 const Array& argument_names() const { return argument_names_; } |
| 2810 intptr_t checked_argument_count() const { return checked_argument_count_; } | 2810 intptr_t checked_argument_count() const { return checked_argument_count_; } |
| 2811 | 2811 |
| 2812 bool has_unique_selector() const { return has_unique_selector_; } | 2812 bool has_unique_selector() const { return has_unique_selector_; } |
| 2813 void set_has_unique_selector(bool b) { has_unique_selector_ = b; } | 2813 void set_has_unique_selector(bool b) { has_unique_selector_ = b; } |
| 2814 | 2814 |
| 2815 virtual intptr_t CallCount() const { |
| 2816 return ic_data() == NULL ? 0 : ic_data()->AggregateCount(); |
| 2817 } |
| 2818 |
| 2815 virtual bool ComputeCanDeoptimize() const { return true; } | 2819 virtual bool ComputeCanDeoptimize() const { return true; } |
| 2816 | 2820 |
| 2817 virtual Definition* Canonicalize(FlowGraph* flow_graph); | 2821 virtual Definition* Canonicalize(FlowGraph* flow_graph); |
| 2818 | 2822 |
| 2819 virtual bool CanBecomeDeoptimizationTarget() const { | 2823 virtual bool CanBecomeDeoptimizationTarget() const { |
| 2820 // Instance calls that are specialized by the optimizer need a | 2824 // Instance calls that are specialized by the optimizer need a |
| 2821 // deoptimization descriptor before the call. | 2825 // deoptimization descriptor before the call. |
| 2822 return true; | 2826 return true; |
| 2823 } | 2827 } |
| 2824 | 2828 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 2843 bool has_unique_selector_; | 2847 bool has_unique_selector_; |
| 2844 | 2848 |
| 2845 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr); | 2849 DISALLOW_COPY_AND_ASSIGN(InstanceCallInstr); |
| 2846 }; | 2850 }; |
| 2847 | 2851 |
| 2848 | 2852 |
| 2849 class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> { | 2853 class PolymorphicInstanceCallInstr : public TemplateDefinition<0, Throws> { |
| 2850 public: | 2854 public: |
| 2851 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, | 2855 PolymorphicInstanceCallInstr(InstanceCallInstr* instance_call, |
| 2852 const CallTargets& targets, | 2856 const CallTargets& targets, |
| 2853 bool with_checks, | |
| 2854 bool complete) | 2857 bool complete) |
| 2855 : TemplateDefinition(instance_call->deopt_id()), | 2858 : TemplateDefinition(instance_call->deopt_id()), |
| 2856 instance_call_(instance_call), | 2859 instance_call_(instance_call), |
| 2857 targets_(targets), | 2860 targets_(targets), |
| 2858 with_checks_(with_checks), | |
| 2859 complete_(complete) { | 2861 complete_(complete) { |
| 2860 ASSERT(instance_call_ != NULL); | 2862 ASSERT(instance_call_ != NULL); |
| 2861 ASSERT(targets.length() != 0); | 2863 ASSERT(targets.length() != 0); |
| 2862 total_call_count_ = CallCount(); | 2864 total_call_count_ = CallCount(); |
| 2863 } | 2865 } |
| 2864 | 2866 |
| 2865 InstanceCallInstr* instance_call() const { return instance_call_; } | 2867 InstanceCallInstr* instance_call() const { return instance_call_; } |
| 2866 bool with_checks() const { return with_checks_; } | |
| 2867 void set_with_checks(bool b) { with_checks_ = b; } | |
| 2868 bool complete() const { return complete_; } | 2868 bool complete() const { return complete_; } |
| 2869 virtual TokenPosition token_pos() const { | 2869 virtual TokenPosition token_pos() const { |
| 2870 return instance_call_->token_pos(); | 2870 return instance_call_->token_pos(); |
| 2871 } | 2871 } |
| 2872 | 2872 |
| 2873 virtual CompileType ComputeType() const; | 2873 virtual CompileType ComputeType() const; |
| 2874 | 2874 |
| 2875 virtual intptr_t ArgumentCount() const { | 2875 virtual intptr_t ArgumentCount() const { |
| 2876 return instance_call()->ArgumentCount(); | 2876 return instance_call()->ArgumentCount(); |
| 2877 } | 2877 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2907 | 2907 |
| 2908 virtual Definition* Canonicalize(FlowGraph* graph); | 2908 virtual Definition* Canonicalize(FlowGraph* graph); |
| 2909 | 2909 |
| 2910 static RawType* ComputeRuntimeType(const CallTargets& targets); | 2910 static RawType* ComputeRuntimeType(const CallTargets& targets); |
| 2911 | 2911 |
| 2912 PRINT_OPERANDS_TO_SUPPORT | 2912 PRINT_OPERANDS_TO_SUPPORT |
| 2913 | 2913 |
| 2914 private: | 2914 private: |
| 2915 InstanceCallInstr* instance_call_; | 2915 InstanceCallInstr* instance_call_; |
| 2916 const CallTargets& targets_; | 2916 const CallTargets& targets_; |
| 2917 bool with_checks_; | |
| 2918 const bool complete_; | 2917 const bool complete_; |
| 2919 intptr_t total_call_count_; | 2918 intptr_t total_call_count_; |
| 2920 | 2919 |
| 2921 friend class PolymorphicInliner; | 2920 friend class PolymorphicInliner; |
| 2922 | 2921 |
| 2923 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); | 2922 DISALLOW_COPY_AND_ASSIGN(PolymorphicInstanceCallInstr); |
| 2924 }; | 2923 }; |
| 2925 | 2924 |
| 2926 | 2925 |
| 2927 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> { | 2926 class StrictCompareInstr : public TemplateComparison<2, NoThrow, Pure> { |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3220 | 3219 |
| 3221 class StaticCallInstr : public TemplateDefinition<0, Throws> { | 3220 class StaticCallInstr : public TemplateDefinition<0, Throws> { |
| 3222 public: | 3221 public: |
| 3223 StaticCallInstr(TokenPosition token_pos, | 3222 StaticCallInstr(TokenPosition token_pos, |
| 3224 const Function& function, | 3223 const Function& function, |
| 3225 const Array& argument_names, | 3224 const Array& argument_names, |
| 3226 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 3225 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
| 3227 const ZoneGrowableArray<const ICData*>& ic_data_array) | 3226 const ZoneGrowableArray<const ICData*>& ic_data_array) |
| 3228 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), | 3227 : TemplateDefinition(Thread::Current()->GetNextDeoptId()), |
| 3229 ic_data_(NULL), | 3228 ic_data_(NULL), |
| 3229 call_count_(0), |
| 3230 token_pos_(token_pos), | 3230 token_pos_(token_pos), |
| 3231 function_(function), | 3231 function_(function), |
| 3232 argument_names_(argument_names), | 3232 argument_names_(argument_names), |
| 3233 arguments_(arguments), | 3233 arguments_(arguments), |
| 3234 result_cid_(kDynamicCid), | 3234 result_cid_(kDynamicCid), |
| 3235 is_known_list_constructor_(false), | 3235 is_known_list_constructor_(false), |
| 3236 identity_(AliasIdentity::Unknown()) { | 3236 identity_(AliasIdentity::Unknown()) { |
| 3237 ic_data_ = GetICData(ic_data_array); | 3237 ic_data_ = GetICData(ic_data_array); |
| 3238 ASSERT(function.IsZoneHandle()); | 3238 ASSERT(function.IsZoneHandle()); |
| 3239 ASSERT(!function.IsNull()); | 3239 ASSERT(!function.IsNull()); |
| 3240 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); | 3240 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); |
| 3241 } | 3241 } |
| 3242 | 3242 |
| 3243 StaticCallInstr(TokenPosition token_pos, | 3243 StaticCallInstr(TokenPosition token_pos, |
| 3244 const Function& function, | 3244 const Function& function, |
| 3245 const Array& argument_names, | 3245 const Array& argument_names, |
| 3246 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 3246 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
| 3247 intptr_t deopt_id) | 3247 intptr_t deopt_id, |
| 3248 intptr_t call_count) |
| 3248 : TemplateDefinition(deopt_id), | 3249 : TemplateDefinition(deopt_id), |
| 3249 ic_data_(NULL), | 3250 ic_data_(NULL), |
| 3251 call_count_(call_count), |
| 3250 token_pos_(token_pos), | 3252 token_pos_(token_pos), |
| 3251 function_(function), | 3253 function_(function), |
| 3252 argument_names_(argument_names), | 3254 argument_names_(argument_names), |
| 3253 arguments_(arguments), | 3255 arguments_(arguments), |
| 3254 result_cid_(kDynamicCid), | 3256 result_cid_(kDynamicCid), |
| 3255 is_known_list_constructor_(false), | 3257 is_known_list_constructor_(false), |
| 3256 identity_(AliasIdentity::Unknown()) { | 3258 identity_(AliasIdentity::Unknown()) { |
| 3257 ASSERT(function.IsZoneHandle()); | 3259 ASSERT(function.IsZoneHandle()); |
| 3258 ASSERT(!function.IsNull()); | 3260 ASSERT(!function.IsNull()); |
| 3259 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); | 3261 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3273 const Function& function() const { return function_; } | 3275 const Function& function() const { return function_; } |
| 3274 const Array& argument_names() const { return argument_names_; } | 3276 const Array& argument_names() const { return argument_names_; } |
| 3275 virtual TokenPosition token_pos() const { return token_pos_; } | 3277 virtual TokenPosition token_pos() const { return token_pos_; } |
| 3276 | 3278 |
| 3277 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 3279 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 3278 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 3280 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| 3279 return (*arguments_)[index]; | 3281 return (*arguments_)[index]; |
| 3280 } | 3282 } |
| 3281 | 3283 |
| 3282 virtual intptr_t CallCount() const { | 3284 virtual intptr_t CallCount() const { |
| 3283 return ic_data() == NULL ? 0 : ic_data()->AggregateCount(); | 3285 return ic_data() == NULL ? call_count_ : ic_data()->AggregateCount(); |
| 3284 } | 3286 } |
| 3285 | 3287 |
| 3286 virtual bool ComputeCanDeoptimize() const { return true; } | 3288 virtual bool ComputeCanDeoptimize() const { return true; } |
| 3287 | 3289 |
| 3288 virtual bool CanBecomeDeoptimizationTarget() const { | 3290 virtual bool CanBecomeDeoptimizationTarget() const { |
| 3289 // Static calls that are specialized by the optimizer (e.g. sqrt) need a | 3291 // Static calls that are specialized by the optimizer (e.g. sqrt) need a |
| 3290 // deoptimization descriptor before the call. | 3292 // deoptimization descriptor before the call. |
| 3291 return true; | 3293 return true; |
| 3292 } | 3294 } |
| 3293 | 3295 |
| 3294 virtual EffectSet Effects() const { return EffectSet::All(); } | 3296 virtual EffectSet Effects() const { return EffectSet::All(); } |
| 3295 | 3297 |
| 3296 void set_result_cid(intptr_t value) { result_cid_ = value; } | 3298 void set_result_cid(intptr_t value) { result_cid_ = value; } |
| 3297 | 3299 |
| 3298 bool is_known_list_constructor() const { return is_known_list_constructor_; } | 3300 bool is_known_list_constructor() const { return is_known_list_constructor_; } |
| 3299 void set_is_known_list_constructor(bool value) { | 3301 void set_is_known_list_constructor(bool value) { |
| 3300 is_known_list_constructor_ = value; | 3302 is_known_list_constructor_ = value; |
| 3301 } | 3303 } |
| 3302 | 3304 |
| 3303 bool IsRecognizedFactory() const { return is_known_list_constructor(); } | 3305 bool IsRecognizedFactory() const { return is_known_list_constructor(); } |
| 3304 | 3306 |
| 3305 virtual AliasIdentity Identity() const { return identity_; } | 3307 virtual AliasIdentity Identity() const { return identity_; } |
| 3306 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } | 3308 virtual void SetIdentity(AliasIdentity identity) { identity_ = identity; } |
| 3307 | 3309 |
| 3308 PRINT_OPERANDS_TO_SUPPORT | 3310 PRINT_OPERANDS_TO_SUPPORT |
| 3309 | 3311 |
| 3310 private: | 3312 private: |
| 3311 const ICData* ic_data_; | 3313 const ICData* ic_data_; |
| 3314 const intptr_t call_count_; |
| 3312 const TokenPosition token_pos_; | 3315 const TokenPosition token_pos_; |
| 3313 const Function& function_; | 3316 const Function& function_; |
| 3314 const Array& argument_names_; | 3317 const Array& argument_names_; |
| 3315 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | 3318 ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
| 3316 intptr_t result_cid_; // For some library functions we know the result. | 3319 intptr_t result_cid_; // For some library functions we know the result. |
| 3317 | 3320 |
| 3318 // 'True' for recognized list constructors. | 3321 // 'True' for recognized list constructors. |
| 3319 bool is_known_list_constructor_; | 3322 bool is_known_list_constructor_; |
| 3320 | 3323 |
| 3321 AliasIdentity identity_; | 3324 AliasIdentity identity_; |
| (...skipping 4792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8114 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ | 8117 LocationSummary* Name::MakeLocationSummary(Zone* zone, bool opt) const { \ |
| 8115 UNIMPLEMENTED(); \ | 8118 UNIMPLEMENTED(); \ |
| 8116 return NULL; \ | 8119 return NULL; \ |
| 8117 } \ | 8120 } \ |
| 8118 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8121 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
| 8119 | 8122 |
| 8120 | 8123 |
| 8121 } // namespace dart | 8124 } // namespace dart |
| 8122 | 8125 |
| 8123 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ | 8126 #endif // RUNTIME_VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |