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

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

Issue 10264031: Switch from AST node ids to computation ids (cid). In addition to computations,… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 7 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 | « no previous file | runtime/vm/flow_graph_builder.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) 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 "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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 // and index and loads the value. The receiver will be returned in the 128 // and index and loads the value. The receiver will be returned in the
129 // output parameter 'receiver' and the index will be returned in the 129 // output parameter 'receiver' and the index will be returned in the
130 // output parameter 'index'.. 130 // output parameter 'index'..
131 Definition* BuildIncrOpIndexedLoad(IncrOpIndexedNode* node, 131 Definition* BuildIncrOpIndexedLoad(IncrOpIndexedNode* node,
132 Value** receiver, 132 Value** receiver,
133 Value** index); 133 Value** index);
134 134
135 // Build the increment part of an increment operation (add or subtract 1). 135 // Build the increment part of an increment operation (add or subtract 1).
136 // Consumes the original value and produces the value +/- 1. 136 // Consumes the original value and produces the value +/- 1.
137 Definition* BuildIncrOpIncrement(Token::Kind kind, 137 Definition* BuildIncrOpIncrement(Token::Kind kind,
138 intptr_t node_id,
139 intptr_t token_index, 138 intptr_t token_index,
140 Value* original); 139 Value* original);
141 140
142 // Creates an instantiated type argument vector used in preparation of a 141 // Creates an instantiated type argument vector used in preparation of a
143 // factory call. 142 // factory call.
144 // May be called only if allocating an object of a parameterized class. 143 // May be called only if allocating an object of a parameterized class.
145 Definition* BuildFactoryTypeArguments(ConstructorCallNode* node); 144 Definition* BuildFactoryTypeArguments(ConstructorCallNode* node);
146 145
147 // Creates a possibly uninstantiated type argument vector and the type 146 // Creates a possibly uninstantiated type argument vector and the type
148 // argument vector of the instantiator (two values in 'args') used in 147 // argument vector of the instantiator (two values in 'args') used in
149 // preparation of a constructor call. 148 // preparation of a constructor call.
150 // May be called only if allocating an object of a parameterized class. 149 // May be called only if allocating an object of a parameterized class.
151 void BuildConstructorTypeArguments(ConstructorCallNode* node, 150 void BuildConstructorTypeArguments(ConstructorCallNode* node,
152 ZoneGrowableArray<Value*>* args); 151 ZoneGrowableArray<Value*>* args);
153 152
154 // Returns the value of the type arguments of the instantiator. 153 // Returns the value of the type arguments of the instantiator.
155 Value* BuildInstantiatorTypeArguments(intptr_t token_index, 154 Value* BuildInstantiatorTypeArguments(intptr_t token_index,
156 intptr_t start_index); 155 intptr_t start_index);
157 156
158 // Perform a type check on the given value. 157 // Perform a type check on the given value.
159 void BuildAssertAssignable(intptr_t node_id, 158 void BuildAssertAssignable(intptr_t token_index,
160 intptr_t token_index,
161 Value* value, 159 Value* value,
162 const AbstractType& dst_type, 160 const AbstractType& dst_type,
163 const String& dst_name, 161 const String& dst_name,
164 intptr_t start_index); 162 intptr_t start_index);
165 163
166 // Perform a type check on the given value and return it. 164 // Perform a type check on the given value and return it.
167 Value* BuildAssignableValue(intptr_t assignment_node_id, 165 Value* BuildAssignableValue(AstNode* value_node,
168 AstNode* value_node,
169 Value* value, 166 Value* value,
170 const AbstractType& dst_type, 167 const AbstractType& dst_type,
171 const String& dst_name, 168 const String& dst_name,
172 intptr_t start_index); 169 intptr_t start_index);
173 170
174 virtual void BuildInstanceOf(ComparisonNode* node); 171 virtual void BuildInstanceOf(ComparisonNode* node);
175 172
176 bool MustSaveRestoreContext(SequenceNode* node) const; 173 bool MustSaveRestoreContext(SequenceNode* node) const;
177 174
178 // Moves parent context into the context register. 175 // Moves parent context into the context register.
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 // 269 //
273 // To distinguish between the graphs with only nonlocal exits and graphs 270 // To distinguish between the graphs with only nonlocal exits and graphs
274 // with both true and false exits, there are a pair of TargetEntryInstr**: 271 // with both true and false exits, there are a pair of TargetEntryInstr**:
275 // 272 //
276 // - Both NULL: only non-local exits, truly closed 273 // - Both NULL: only non-local exits, truly closed
277 // - Neither NULL: true and false successors at the given addresses 274 // - Neither NULL: true and false successors at the given addresses
278 // 275 //
279 // We expect that AstNode in test contexts either have only nonlocal exits 276 // We expect that AstNode in test contexts either have only nonlocal exits
280 // or else control flow has both true and false successors. 277 // or else control flow has both true and false successors.
281 // 278 //
282 // The node_id and token_index are used in checked mode to verify that the 279 // The cis and token_index are used in checked mode to verify that the
283 // condition of the test is of type bool. 280 // condition of the test is of type bool.
284 class TestGraphVisitor : public ValueGraphVisitor { 281 class TestGraphVisitor : public ValueGraphVisitor {
285 public: 282 public:
286 TestGraphVisitor(FlowGraphBuilder* owner, 283 TestGraphVisitor(FlowGraphBuilder* owner,
287 intptr_t temp_index, 284 intptr_t temp_index,
288 intptr_t condition_node_id,
289 intptr_t condition_token_index) 285 intptr_t condition_token_index)
290 : ValueGraphVisitor(owner, temp_index), 286 : ValueGraphVisitor(owner, temp_index),
291 true_successor_address_(NULL), 287 true_successor_address_(NULL),
292 false_successor_address_(NULL), 288 false_successor_address_(NULL),
293 condition_node_id_(condition_node_id),
294 condition_token_index_(condition_token_index) { 289 condition_token_index_(condition_token_index) {
295 } 290 }
296 291
297 TargetEntryInstr** true_successor_address() const { 292 TargetEntryInstr** true_successor_address() const {
298 ASSERT(true_successor_address_ != NULL); 293 ASSERT(true_successor_address_ != NULL);
299 return true_successor_address_; 294 return true_successor_address_;
300 } 295 }
301 TargetEntryInstr** false_successor_address() const { 296 TargetEntryInstr** false_successor_address() const {
302 ASSERT(false_successor_address_ != NULL); 297 ASSERT(false_successor_address_ != NULL);
303 return false_successor_address_; 298 return false_successor_address_;
304 } 299 }
305 300
306 intptr_t condition_node_id() const { return condition_node_id_; }
307 intptr_t condition_token_index() const { return condition_token_index_; } 301 intptr_t condition_token_index() const { return condition_token_index_; }
308 302
309 private: 303 private:
310 // Construct and concatenate a Branch instruction to this graph fragment. 304 // Construct and concatenate a Branch instruction to this graph fragment.
311 // Closes the fragment and sets the output parameters. 305 // Closes the fragment and sets the output parameters.
312 virtual void ReturnValue(Value* value); 306 virtual void ReturnValue(Value* value);
313 307
314 // Specify a computation as the final result. Adds a Bind instruction to 308 // Specify a computation as the final result. Adds a Bind instruction to
315 // the graph and branches on its value. 309 // the graph and branches on its value.
316 virtual void ReturnComputation(Computation* computation) { 310 virtual void ReturnComputation(Computation* computation) {
317 BindInstr* defn = new BindInstr(temp_index(), computation); 311 BindInstr* defn = new BindInstr(temp_index(), computation);
318 AddInstruction(defn); 312 AddInstruction(defn);
319 ReturnValue(new UseVal(defn)); 313 ReturnValue(new UseVal(defn));
320 } 314 }
321 315
322 // Output parameters. 316 // Output parameters.
323 TargetEntryInstr** true_successor_address_; 317 TargetEntryInstr** true_successor_address_;
324 TargetEntryInstr** false_successor_address_; 318 TargetEntryInstr** false_successor_address_;
325 319
326 intptr_t condition_node_id_;
327 intptr_t condition_token_index_; 320 intptr_t condition_token_index_;
328 }; 321 };
329 322
330 } // namespace dart 323 } // namespace dart
331 324
332 #endif // VM_FLOW_GRAPH_BUILDER_H_ 325 #endif // VM_FLOW_GRAPH_BUILDER_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698