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

Side by Side Diff: vm/flow_graph_builder.h

Issue 10632009: Make the parser agnostic to the TokenStream implementation. This is the first step towards compacti… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 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
« no previous file with comments | « vm/debugger.cc ('k') | 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 Computation* BuildLoadLocal(const LocalVariable& local); 130 Computation* BuildLoadLocal(const LocalVariable& local);
131 131
132 // Helpers for translating parts of the AST. 132 // Helpers for translating parts of the AST.
133 void TranslateArgumentList(const ArgumentListNode& node, 133 void TranslateArgumentList(const ArgumentListNode& node,
134 ZoneGrowableArray<Value*>* values); 134 ZoneGrowableArray<Value*>* values);
135 135
136 // Creates an instantiated type argument vector used in preparation of an 136 // Creates an instantiated type argument vector used in preparation of an
137 // allocation call. 137 // allocation call.
138 // May be called only if allocating an object of a parameterized class. 138 // May be called only if allocating an object of a parameterized class.
139 BindInstr* BuildInstantiatedTypeArguments( 139 BindInstr* BuildInstantiatedTypeArguments(
140 intptr_t token_index, 140 intptr_t token_pos,
141 const AbstractTypeArguments& type_arguments); 141 const AbstractTypeArguments& type_arguments);
142 142
143 // Creates a possibly uninstantiated type argument vector and the type 143 // Creates a possibly uninstantiated type argument vector and the type
144 // argument vector of the instantiator (two values in 'args') used in 144 // argument vector of the instantiator (two values in 'args') used in
145 // preparation of a constructor call. 145 // preparation of a constructor call.
146 // May be called only if allocating an object of a parameterized class. 146 // May be called only if allocating an object of a parameterized class.
147 void BuildConstructorTypeArguments(ConstructorCallNode* node, 147 void BuildConstructorTypeArguments(ConstructorCallNode* node,
148 ZoneGrowableArray<Value*>* args); 148 ZoneGrowableArray<Value*>* args);
149 149
150 void BuildTypecheckArguments(intptr_t token_index, 150 void BuildTypecheckArguments(intptr_t token_pos,
151 Value** instantiator, 151 Value** instantiator,
152 Value** instantiator_type_arguments); 152 Value** instantiator_type_arguments);
153 Value* BuildInstantiator(); 153 Value* BuildInstantiator();
154 Value* BuildInstantiatorTypeArguments(intptr_t token_index, 154 Value* BuildInstantiatorTypeArguments(intptr_t token_pos,
155 Value* instantiator); 155 Value* instantiator);
156 156
157 // Perform a type check on the given value. 157 // Perform a type check on the given value.
158 AssertAssignableComp* BuildAssertAssignable(intptr_t token_index, 158 AssertAssignableComp* BuildAssertAssignable(intptr_t token_pos,
159 Value* value, 159 Value* value,
160 const AbstractType& dst_type, 160 const AbstractType& dst_type,
161 const String& dst_name); 161 const String& dst_name);
162 162
163 // Perform a type check on the given value and return it. 163 // Perform a type check on the given value and return it.
164 Value* BuildAssignableValue(intptr_t token_index, 164 Value* BuildAssignableValue(intptr_t token_pos,
165 Value* value, 165 Value* value,
166 const AbstractType& dst_type, 166 const AbstractType& dst_type,
167 const String& dst_name); 167 const String& dst_name);
168 168
169 void BuildStoreIndexedValues(StoreIndexedNode* node, 169 void BuildStoreIndexedValues(StoreIndexedNode* node,
170 Value** array, 170 Value** array,
171 Value** index, 171 Value** index,
172 Value** value); 172 Value** value);
173 void BuildInstanceSetterValues(InstanceSetterNode* node, 173 void BuildInstanceSetterValues(InstanceSetterNode* node,
174 Value** receiver, 174 Value** receiver,
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 // 282 //
283 // To distinguish between the graphs with only nonlocal exits and graphs 283 // To distinguish between the graphs with only nonlocal exits and graphs
284 // with both true and false exits, there are a pair of TargetEntryInstr**: 284 // with both true and false exits, there are a pair of TargetEntryInstr**:
285 // 285 //
286 // - Both NULL: only non-local exits, truly closed 286 // - Both NULL: only non-local exits, truly closed
287 // - Neither NULL: true and false successors at the given addresses 287 // - Neither NULL: true and false successors at the given addresses
288 // 288 //
289 // We expect that AstNode in test contexts either have only nonlocal exits 289 // We expect that AstNode in test contexts either have only nonlocal exits
290 // or else control flow has both true and false successors. 290 // or else control flow has both true and false successors.
291 // 291 //
292 // The cis and token_index are used in checked mode to verify that the 292 // The cis and token_pos are used in checked mode to verify that the
293 // condition of the test is of type bool. 293 // condition of the test is of type bool.
294 class TestGraphVisitor : public ValueGraphVisitor { 294 class TestGraphVisitor : public ValueGraphVisitor {
295 public: 295 public:
296 TestGraphVisitor(FlowGraphBuilder* owner, 296 TestGraphVisitor(FlowGraphBuilder* owner,
297 intptr_t temp_index, 297 intptr_t temp_index,
298 intptr_t condition_token_index) 298 intptr_t condition_token_pos)
299 : ValueGraphVisitor(owner, temp_index), 299 : ValueGraphVisitor(owner, temp_index),
300 true_successor_address_(NULL), 300 true_successor_address_(NULL),
301 false_successor_address_(NULL), 301 false_successor_address_(NULL),
302 condition_token_index_(condition_token_index) { 302 condition_token_pos_(condition_token_pos) {
303 } 303 }
304 304
305 TargetEntryInstr** true_successor_address() const { 305 TargetEntryInstr** true_successor_address() const {
306 ASSERT(true_successor_address_ != NULL); 306 ASSERT(true_successor_address_ != NULL);
307 return true_successor_address_; 307 return true_successor_address_;
308 } 308 }
309 TargetEntryInstr** false_successor_address() const { 309 TargetEntryInstr** false_successor_address() const {
310 ASSERT(false_successor_address_ != NULL); 310 ASSERT(false_successor_address_ != NULL);
311 return false_successor_address_; 311 return false_successor_address_;
312 } 312 }
313 313
314 intptr_t condition_token_index() const { return condition_token_index_; } 314 intptr_t condition_token_pos() const { return condition_token_pos_; }
315 315
316 private: 316 private:
317 // Construct and concatenate a Branch instruction to this graph fragment. 317 // Construct and concatenate a Branch instruction to this graph fragment.
318 // Closes the fragment and sets the output parameters. 318 // Closes the fragment and sets the output parameters.
319 virtual void ReturnValue(Value* value); 319 virtual void ReturnValue(Value* value);
320 320
321 // Output parameters. 321 // Output parameters.
322 TargetEntryInstr** true_successor_address_; 322 TargetEntryInstr** true_successor_address_;
323 TargetEntryInstr** false_successor_address_; 323 TargetEntryInstr** false_successor_address_;
324 324
325 intptr_t condition_token_index_; 325 intptr_t condition_token_pos_;
326 }; 326 };
327 327
328 } // namespace dart 328 } // namespace dart
329 329
330 #endif // VM_FLOW_GRAPH_BUILDER_H_ 330 #endif // VM_FLOW_GRAPH_BUILDER_H_
OLDNEW
« no previous file with comments | « vm/debugger.cc ('k') | vm/flow_graph_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698