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

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

Issue 9704063: Simplify translation of conditionals in the flow graph builder. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 TestGraphVisitor(FlowGraphBuilder* owner, intptr_t temp_index) 224 TestGraphVisitor(FlowGraphBuilder* owner, intptr_t temp_index)
225 : ValueGraphVisitor(owner, temp_index), 225 : ValueGraphVisitor(owner, temp_index),
226 true_successor_address_(NULL), 226 true_successor_address_(NULL),
227 false_successor_address_(NULL) { 227 false_successor_address_(NULL) {
228 } 228 }
229 229
230 // Visit functions overridden by this class. 230 // Visit functions overridden by this class.
231 virtual void VisitLiteralNode(LiteralNode* node); 231 virtual void VisitLiteralNode(LiteralNode* node);
232 virtual void VisitLoadLocalNode(LoadLocalNode* node); 232 virtual void VisitLoadLocalNode(LoadLocalNode* node);
233 233
234 bool can_be_true() const {
235 // Either both successors are set or neither is set.
236 ASSERT((true_successor_address_ == NULL) ==
237 (false_successor_address_ == NULL));
238 return true_successor_address_ != NULL;
239 }
240 bool can_be_false() const {
241 // Either both successors are set or neither is set.
242 ASSERT((true_successor_address_ == NULL) ==
243 (false_successor_address_ == NULL));
244 return false_successor_address_ != NULL;
245 }
246
247 BlockEntryInstr** true_successor_address() const { 234 BlockEntryInstr** true_successor_address() const {
248 ASSERT(can_be_true()); 235 ASSERT(true_successor_address_ != NULL);
249 return true_successor_address_; 236 return true_successor_address_;
250 } 237 }
251 BlockEntryInstr** false_successor_address() const { 238 BlockEntryInstr** false_successor_address() const {
252 ASSERT(can_be_false()); 239 ASSERT(false_successor_address_ != NULL);
253 return false_successor_address_; 240 return false_successor_address_;
254 } 241 }
255 242
256 private: 243 private:
257 // Construct and concatenate a Branch instruction to this graph fragment. 244 // Construct and concatenate a Branch instruction to this graph fragment.
258 // Closes the fragment and sets the output parameters. 245 // Closes the fragment and sets the output parameters.
259 virtual void ReturnValue(Value* value); 246 virtual void ReturnValue(Value* value);
260 247
261 // Specify a computation as the final result. Adds a Bind instruction to 248 // Specify a computation as the final result. Adds a Bind instruction to
262 // the graph and branches on its value. 249 // the graph and branches on its value.
263 virtual void ReturnComputation(Computation* computation) { 250 virtual void ReturnComputation(Computation* computation) {
264 AddInstruction(new BindInstr(temp_index(), computation)); 251 AddInstruction(new BindInstr(temp_index(), computation));
265 ReturnValue(new TempVal(temp_index())); 252 ReturnValue(new TempVal(temp_index()));
266 } 253 }
267 254
268 // Output parameters. 255 // Output parameters.
269 BlockEntryInstr** true_successor_address_; 256 BlockEntryInstr** true_successor_address_;
270 BlockEntryInstr** false_successor_address_; 257 BlockEntryInstr** false_successor_address_;
271 }; 258 };
272 259
273 } // namespace dart 260 } // namespace dart
274 261
275 #endif // VM_FLOW_GRAPH_BUILDER_H_ 262 #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