Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: runtime/vm/intermediate_language.h

Issue 17646002: Use call counts to determine which static calls to inline. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 3051 matching lines...) Expand 10 before | Expand all | Expand 10 after
3062 3062
3063 DISALLOW_COPY_AND_ASSIGN(IfThenElseInstr); 3063 DISALLOW_COPY_AND_ASSIGN(IfThenElseInstr);
3064 }; 3064 };
3065 3065
3066 3066
3067 class StaticCallInstr : public TemplateDefinition<0> { 3067 class StaticCallInstr : public TemplateDefinition<0> {
3068 public: 3068 public:
3069 StaticCallInstr(intptr_t token_pos, 3069 StaticCallInstr(intptr_t token_pos,
3070 const Function& function, 3070 const Function& function,
3071 const Array& argument_names, 3071 const Array& argument_names,
3072 ZoneGrowableArray<PushArgumentInstr*>* arguments) 3072 ZoneGrowableArray<PushArgumentInstr*>* arguments,
3073 : token_pos_(token_pos), 3073 const Array& ic_data_array)
3074 : ic_data_(GetICData(ic_data_array)),
3075 token_pos_(token_pos),
3074 function_(function), 3076 function_(function),
3075 argument_names_(argument_names), 3077 argument_names_(argument_names),
3076 arguments_(arguments), 3078 arguments_(arguments),
3077 result_cid_(kDynamicCid), 3079 result_cid_(kDynamicCid),
3078 is_known_list_constructor_(false) { 3080 is_known_list_constructor_(false) {
3079 ASSERT(function.IsZoneHandle()); 3081 ASSERT(function.IsZoneHandle());
3080 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); 3082 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap());
3081 } 3083 }
3082 3084
3085 // ICData for static calls carries call count.
3086 const ICData* ic_data() const { return ic_data_; }
3087 bool HasICData() const {
3088 return (ic_data() != NULL) && !ic_data()->IsNull();
3089 }
3090
3083 DECLARE_INSTRUCTION(StaticCall) 3091 DECLARE_INSTRUCTION(StaticCall)
3084 virtual CompileType ComputeType() const; 3092 virtual CompileType ComputeType() const;
3085 3093
3086 // Accessors forwarded to the AST node. 3094 // Accessors forwarded to the AST node.
3087 const Function& function() const { return function_; } 3095 const Function& function() const { return function_; }
3088 const Array& argument_names() const { return argument_names_; } 3096 const Array& argument_names() const { return argument_names_; }
3089 intptr_t token_pos() const { return token_pos_; } 3097 intptr_t token_pos() const { return token_pos_; }
3090 3098
3091 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 3099 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
3092 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { 3100 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
3093 return (*arguments_)[index]; 3101 return (*arguments_)[index];
3094 } 3102 }
3095 3103
3096 virtual void PrintOperandsTo(BufferFormatter* f) const; 3104 virtual void PrintOperandsTo(BufferFormatter* f) const;
3097 3105
3098 virtual bool CanDeoptimize() const { return true; } 3106 virtual bool CanDeoptimize() const { return true; }
3099 3107
3100 virtual EffectSet Effects() const { return EffectSet::All(); } 3108 virtual EffectSet Effects() const { return EffectSet::All(); }
3101 3109
3102 void set_result_cid(intptr_t value) { result_cid_ = value; } 3110 void set_result_cid(intptr_t value) { result_cid_ = value; }
3103 3111
3104 bool is_known_list_constructor() const { return is_known_list_constructor_; } 3112 bool is_known_list_constructor() const { return is_known_list_constructor_; }
3105 void set_is_known_list_constructor(bool value) { 3113 void set_is_known_list_constructor(bool value) {
3106 is_known_list_constructor_ = value; 3114 is_known_list_constructor_ = value;
3107 } 3115 }
3108 3116
3109 virtual bool MayThrow() const { return true; } 3117 virtual bool MayThrow() const { return true; }
3110 3118
3111 private: 3119 private:
3120 const ICData* ic_data_;
3112 const intptr_t token_pos_; 3121 const intptr_t token_pos_;
3113 const Function& function_; 3122 const Function& function_;
3114 const Array& argument_names_; 3123 const Array& argument_names_;
3115 ZoneGrowableArray<PushArgumentInstr*>* arguments_; 3124 ZoneGrowableArray<PushArgumentInstr*>* arguments_;
3116 intptr_t result_cid_; // For some library functions we know the result. 3125 intptr_t result_cid_; // For some library functions we know the result.
3117 3126
3118 // 'True' for recognized list constructors. 3127 // 'True' for recognized list constructors.
3119 bool is_known_list_constructor_; 3128 bool is_known_list_constructor_;
3120 3129
3121 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); 3130 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr);
(...skipping 3367 matching lines...) Expand 10 before | Expand all | Expand 10 after
6489 ForwardInstructionIterator* current_iterator_; 6498 ForwardInstructionIterator* current_iterator_;
6490 6499
6491 private: 6500 private:
6492 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 6501 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
6493 }; 6502 };
6494 6503
6495 6504
6496 } // namespace dart 6505 } // namespace dart
6497 6506
6498 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 6507 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698