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

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, 5 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
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3054 matching lines...) Expand 10 before | Expand all | Expand 10 after
3065 3065
3066 DISALLOW_COPY_AND_ASSIGN(IfThenElseInstr); 3066 DISALLOW_COPY_AND_ASSIGN(IfThenElseInstr);
3067 }; 3067 };
3068 3068
3069 3069
3070 class StaticCallInstr : public TemplateDefinition<0> { 3070 class StaticCallInstr : public TemplateDefinition<0> {
3071 public: 3071 public:
3072 StaticCallInstr(intptr_t token_pos, 3072 StaticCallInstr(intptr_t token_pos,
3073 const Function& function, 3073 const Function& function,
3074 const Array& argument_names, 3074 const Array& argument_names,
3075 ZoneGrowableArray<PushArgumentInstr*>* arguments) 3075 ZoneGrowableArray<PushArgumentInstr*>* arguments,
3076 : token_pos_(token_pos), 3076 const Array& ic_data_array)
3077 : ic_data_(GetICData(ic_data_array)),
3078 token_pos_(token_pos),
3077 function_(function), 3079 function_(function),
3078 argument_names_(argument_names), 3080 argument_names_(argument_names),
3079 arguments_(arguments), 3081 arguments_(arguments),
3080 result_cid_(kDynamicCid), 3082 result_cid_(kDynamicCid),
3081 is_known_list_constructor_(false) { 3083 is_known_list_constructor_(false) {
3082 ASSERT(function.IsZoneHandle()); 3084 ASSERT(function.IsZoneHandle());
3083 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap()); 3085 ASSERT(argument_names.IsZoneHandle() || argument_names.InVMHeap());
3084 } 3086 }
3085 3087
3088 // ICData for static calls carries call count.
3089 const ICData* ic_data() const { return ic_data_; }
3090 bool HasICData() const {
3091 return (ic_data() != NULL) && !ic_data()->IsNull();
3092 }
3093
3086 DECLARE_INSTRUCTION(StaticCall) 3094 DECLARE_INSTRUCTION(StaticCall)
3087 virtual CompileType ComputeType() const; 3095 virtual CompileType ComputeType() const;
3088 3096
3089 // Accessors forwarded to the AST node. 3097 // Accessors forwarded to the AST node.
3090 const Function& function() const { return function_; } 3098 const Function& function() const { return function_; }
3091 const Array& argument_names() const { return argument_names_; } 3099 const Array& argument_names() const { return argument_names_; }
3092 intptr_t token_pos() const { return token_pos_; } 3100 intptr_t token_pos() const { return token_pos_; }
3093 3101
3094 virtual intptr_t ArgumentCount() const { return arguments_->length(); } 3102 virtual intptr_t ArgumentCount() const { return arguments_->length(); }
3095 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { 3103 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const {
3096 return (*arguments_)[index]; 3104 return (*arguments_)[index];
3097 } 3105 }
3098 3106
3099 virtual void PrintOperandsTo(BufferFormatter* f) const; 3107 virtual void PrintOperandsTo(BufferFormatter* f) const;
3100 3108
3101 virtual bool CanDeoptimize() const { return true; } 3109 virtual bool CanDeoptimize() const { return true; }
3102 3110
3103 virtual EffectSet Effects() const { return EffectSet::All(); } 3111 virtual EffectSet Effects() const { return EffectSet::All(); }
3104 3112
3105 void set_result_cid(intptr_t value) { result_cid_ = value; } 3113 void set_result_cid(intptr_t value) { result_cid_ = value; }
3106 3114
3107 bool is_known_list_constructor() const { return is_known_list_constructor_; } 3115 bool is_known_list_constructor() const { return is_known_list_constructor_; }
3108 void set_is_known_list_constructor(bool value) { 3116 void set_is_known_list_constructor(bool value) {
3109 is_known_list_constructor_ = value; 3117 is_known_list_constructor_ = value;
3110 } 3118 }
3111 3119
3112 virtual bool MayThrow() const { return true; } 3120 virtual bool MayThrow() const { return true; }
3113 3121
3114 private: 3122 private:
3123 const ICData* ic_data_;
3115 const intptr_t token_pos_; 3124 const intptr_t token_pos_;
3116 const Function& function_; 3125 const Function& function_;
3117 const Array& argument_names_; 3126 const Array& argument_names_;
3118 ZoneGrowableArray<PushArgumentInstr*>* arguments_; 3127 ZoneGrowableArray<PushArgumentInstr*>* arguments_;
3119 intptr_t result_cid_; // For some library functions we know the result. 3128 intptr_t result_cid_; // For some library functions we know the result.
3120 3129
3121 // 'True' for recognized list constructors. 3130 // 'True' for recognized list constructors.
3122 bool is_known_list_constructor_; 3131 bool is_known_list_constructor_;
3123 3132
3124 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); 3133 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr);
(...skipping 3367 matching lines...) Expand 10 before | Expand all | Expand 10 after
6492 ForwardInstructionIterator* current_iterator_; 6501 ForwardInstructionIterator* current_iterator_;
6493 6502
6494 private: 6503 private:
6495 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 6504 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
6496 }; 6505 };
6497 6506
6498 6507
6499 } // namespace dart 6508 } // namespace dart
6500 6509
6501 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 6510 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698