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

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

Issue 513213002: Generate some intrinsics using our IR. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_FLOW_GRAPH_BUILDER_H_ 5 #ifndef VM_FLOW_GRAPH_BUILDER_H_
6 #define VM_FLOW_GRAPH_BUILDER_H_ 6 #define VM_FLOW_GRAPH_BUILDER_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 139
140 // Build a flow graph from a parsed function's AST. 140 // Build a flow graph from a parsed function's AST.
141 class FlowGraphBuilder: public ValueObject { 141 class FlowGraphBuilder: public ValueObject {
142 public: 142 public:
143 // The inlining context is NULL if not inlining. The osr_id is the deopt 143 // The inlining context is NULL if not inlining. The osr_id is the deopt
144 // id of the OSR entry or Isolate::kNoDeoptId if not compiling for OSR. 144 // id of the OSR entry or Isolate::kNoDeoptId if not compiling for OSR.
145 FlowGraphBuilder(ParsedFunction* parsed_function, 145 FlowGraphBuilder(ParsedFunction* parsed_function,
146 const ZoneGrowableArray<const ICData*>& ic_data_array, 146 const ZoneGrowableArray<const ICData*>& ic_data_array,
147 InlineExitCollector* exit_collector, 147 InlineExitCollector* exit_collector,
148 intptr_t osr_id, 148 intptr_t osr_id);
149 bool is_optimizing);
150 149
151 FlowGraph* BuildGraph(); 150 FlowGraph* BuildGraph();
152 151
153 ParsedFunction* parsed_function() const { return parsed_function_; } 152 ParsedFunction* parsed_function() const { return parsed_function_; }
154 const ZoneGrowableArray<const ICData*>& ic_data_array() const { 153 const ZoneGrowableArray<const ICData*>& ic_data_array() const {
155 return ic_data_array_; 154 return ic_data_array_;
156 } 155 }
157 156
158 // Return true if a Javascript compatibility warning should be emitted at 157 // Return true if a Javascript compatibility warning should be emitted at
159 // runtime for this type test. 158 // runtime for this type test.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 intptr_t num_non_copied_params() const { 193 intptr_t num_non_copied_params() const {
195 return num_non_copied_params_; 194 return num_non_copied_params_;
196 } 195 }
197 intptr_t num_stack_locals() const { 196 intptr_t num_stack_locals() const {
198 return num_stack_locals_; 197 return num_stack_locals_;
199 } 198 }
200 199
201 bool IsInlining() const { return (exit_collector_ != NULL); } 200 bool IsInlining() const { return (exit_collector_ != NULL); }
202 InlineExitCollector* exit_collector() const { return exit_collector_; } 201 InlineExitCollector* exit_collector() const { return exit_collector_; }
203 202
204 bool is_optimizing() const { return is_optimizing_; }
205
206 ZoneGrowableArray<const Field*>* guarded_fields() const { 203 ZoneGrowableArray<const Field*>* guarded_fields() const {
207 return guarded_fields_; 204 return guarded_fields_;
208 } 205 }
209 206
210 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes() const { 207 ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes() const {
211 return parsed_function_->deferred_prefixes(); 208 return parsed_function_->deferred_prefixes();
212 } 209 }
213 210
214 intptr_t temp_count() const { return temp_count_; } 211 intptr_t temp_count() const { return temp_count_; }
215 intptr_t AllocateTemp() { return temp_count_++; } 212 intptr_t AllocateTemp() { return temp_count_++; }
(...skipping 11 matching lines...) Expand all
227 // OSR entry point. 224 // OSR entry point.
228 void PruneUnreachable(); 225 void PruneUnreachable();
229 226
230 // Returns address where the constant 'value' is stored or 0 if not found. 227 // Returns address where the constant 'value' is stored or 0 if not found.
231 static uword FindDoubleConstant(double value); 228 static uword FindDoubleConstant(double value);
232 229
233 Isolate* isolate() const { return parsed_function()->isolate(); } 230 Isolate* isolate() const { return parsed_function()->isolate(); }
234 231
235 private: 232 private:
236 friend class NestedStatement; // Explicit access to nesting_stack_. 233 friend class NestedStatement; // Explicit access to nesting_stack_.
234 friend class Intrinsifier;
237 235
238 intptr_t parameter_count() const { 236 intptr_t parameter_count() const {
239 return num_copied_params_ + num_non_copied_params_; 237 return num_copied_params_ + num_non_copied_params_;
240 } 238 }
241 intptr_t variable_count() const { 239 intptr_t variable_count() const {
242 return parameter_count() + num_stack_locals_; 240 return parameter_count() + num_stack_locals_;
243 } 241 }
244 242
245 ParsedFunction* parsed_function_; 243 ParsedFunction* parsed_function_;
246 const ZoneGrowableArray<const ICData*>& ic_data_array_; 244 const ZoneGrowableArray<const ICData*>& ic_data_array_;
(...skipping 16 matching lines...) Expand all
263 // Outgoing argument stack height. 261 // Outgoing argument stack height.
264 intptr_t args_pushed_; 262 intptr_t args_pushed_;
265 263
266 // A stack of enclosing nested statements. 264 // A stack of enclosing nested statements.
267 NestedStatement* nesting_stack_; 265 NestedStatement* nesting_stack_;
268 266
269 // The deopt id of the OSR entry or Isolate::kNoDeoptId if not compiling 267 // The deopt id of the OSR entry or Isolate::kNoDeoptId if not compiling
270 // for OSR. 268 // for OSR.
271 const intptr_t osr_id_; 269 const intptr_t osr_id_;
272 270
273 // The graph is being rebuilt for the optimizing compiler.
274 // Do not generate a different graph based on this flag.
275 const bool is_optimizing_;
276
277 intptr_t jump_cnt_; 271 intptr_t jump_cnt_;
278 ZoneGrowableArray<JoinEntryInstr*>* await_joins_; 272 ZoneGrowableArray<JoinEntryInstr*>* await_joins_;
279 ZoneGrowableArray<intptr_t>* await_levels_; 273 ZoneGrowableArray<intptr_t>* await_levels_;
280 274
281 DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder); 275 DISALLOW_IMPLICIT_CONSTRUCTORS(FlowGraphBuilder);
282 }; 276 };
283 277
284 278
285 // Translate an AstNode to a control-flow graph fragment for its effects 279 // Translate an AstNode to a control-flow graph fragment for its effects
286 // (e.g., a statement or an expression in an effect context). Implements a 280 // (e.g., a statement or an expression in an effect context). Implements a
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 // Output parameters. 597 // Output parameters.
604 GrowableArray<TargetEntryInstr**> true_successor_addresses_; 598 GrowableArray<TargetEntryInstr**> true_successor_addresses_;
605 GrowableArray<TargetEntryInstr**> false_successor_addresses_; 599 GrowableArray<TargetEntryInstr**> false_successor_addresses_;
606 600
607 intptr_t condition_token_pos_; 601 intptr_t condition_token_pos_;
608 }; 602 };
609 603
610 } // namespace dart 604 } // namespace dart
611 605
612 #endif // VM_FLOW_GRAPH_BUILDER_H_ 606 #endif // VM_FLOW_GRAPH_BUILDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698