| Index: runtime/vm/flow_graph_builder.h
|
| diff --git a/runtime/vm/flow_graph_builder.h b/runtime/vm/flow_graph_builder.h
|
| index b4cc5743ea1175a6479ef0eaa641c6769f0a45a6..33c89b9713f5029ec5be702fb3d176f0977683e0 100644
|
| --- a/runtime/vm/flow_graph_builder.h
|
| +++ b/runtime/vm/flow_graph_builder.h
|
| @@ -38,8 +38,6 @@ class FlowGraphBuilder: public ValueObject {
|
| };
|
|
|
|
|
| -#define DEFINE_VISIT(type, name) virtual void Visit##type(type* node);
|
| -
|
| class TestGraphVisitor;
|
|
|
| // Translate an AstNode to a control-flow graph fragment for its effects
|
| @@ -59,7 +57,9 @@ class EffectGraphVisitor : public AstNodeVisitor {
|
| entry_(NULL),
|
| exit_(NULL) { }
|
|
|
| +#define DEFINE_VISIT(type, name) virtual void Visit##type(type* node);
|
| NODE_LIST(DEFINE_VISIT)
|
| +#undef DEFINE_VISIT
|
|
|
| FlowGraphBuilder* owner() const { return owner_; }
|
| intptr_t temp_index() const { return temp_index_; }
|
| @@ -89,14 +89,7 @@ class EffectGraphVisitor : public AstNodeVisitor {
|
| const EffectGraphVisitor& body_fragment);
|
|
|
| protected:
|
| - // Implement the core part of the translation of expression node types.
|
| - AssertAssignableComp* TranslateAssignable(const AssignableNode& node);
|
| - InstanceCallComp* TranslateBinaryOp(const BinaryOpNode& node);
|
| - InstanceCallComp* TranslateUnaryOp(const UnaryOpNode& node);
|
| - Computation* TranslateComparison(const ComparisonNode& node);
|
| - StoreLocalComp* TranslateStoreLocal(const StoreLocalNode& node);
|
| - StaticCallComp* TranslateStaticCall(const StaticCallNode& node);
|
| - InstanceCallComp* TranslateInstanceCall(const InstanceCallNode& node);
|
| + // Helpers for translating parts of the AST.
|
| void TranslateArgumentList(const ArgumentListNode& node,
|
| ZoneGrowableArray<Value*>* values);
|
|
|
| @@ -104,8 +97,9 @@ class EffectGraphVisitor : public AstNodeVisitor {
|
| intptr_t AllocateTempIndex() { return temp_index_++; }
|
|
|
| private:
|
| - // Helper to append a Do instruction to the graph.
|
| - void DoComputation(Computation* computation) {
|
| + // Specify a computation as the final result. Adds a Do instruction to
|
| + // the graph, but normally overridden in subclasses.
|
| + virtual void ReturnComputation(Computation* computation) {
|
| AddInstruction(new DoInstr(computation));
|
| }
|
|
|
| @@ -131,7 +125,9 @@ class ValueGraphVisitor : public EffectGraphVisitor {
|
| ValueGraphVisitor(FlowGraphBuilder* owner, intptr_t temp_index)
|
| : EffectGraphVisitor(owner, temp_index), value_(NULL) { }
|
|
|
| - NODE_LIST(DEFINE_VISIT)
|
| + // Visit functions overridden by this class.
|
| + virtual void VisitLiteralNode(LiteralNode* node);
|
| + virtual void VisitLoadLocalNode(LoadLocalNode* node);
|
|
|
| Value* value() const { return value_; }
|
|
|
| @@ -139,9 +135,10 @@ class ValueGraphVisitor : public EffectGraphVisitor {
|
| // Helper to set the output state to return a Value.
|
| void ReturnValue(Value* value) { value_ = value; }
|
|
|
| - // Helper to append a Bind instruction to the graph and return its
|
| - // temporary value (i.e., set the output parameters).
|
| - void ReturnValueOf(Computation* computation) {
|
| + // Specify a computation as the final result. Adds a Bind instruction to
|
| + // the graph and returns its temporary value (i.e., set the output
|
| + // parameters).
|
| + virtual void ReturnComputation(Computation* computation) {
|
| AddInstruction(new BindInstr(temp_index(), computation));
|
| value_ = new TempVal(AllocateTempIndex());
|
| }
|
| @@ -173,7 +170,9 @@ class TestGraphVisitor : public EffectGraphVisitor {
|
| false_successor_address_(NULL) {
|
| }
|
|
|
| - NODE_LIST(DEFINE_VISIT)
|
| + // Visit functions overridden by this class.
|
| + virtual void VisitLiteralNode(LiteralNode* node);
|
| + virtual void VisitLoadLocalNode(LoadLocalNode* node);
|
|
|
| bool can_be_true() const {
|
| // Either both successors are set or neither is set.
|
| @@ -202,8 +201,9 @@ class TestGraphVisitor : public EffectGraphVisitor {
|
| // Closes the fragment and sets the output parameters.
|
| void BranchOnValue(Value* value);
|
|
|
| - // Helper to bind a computation and branch on its value.
|
| - void BranchOnValueOf(Computation* computation) {
|
| + // Specify a computation as the final result. Adds a Bind instruction to
|
| + // the graph and branches on its value.
|
| + virtual void ReturnComputation(Computation* computation) {
|
| AddInstruction(new BindInstr(temp_index(), computation));
|
| BranchOnValue(new TempVal(temp_index()));
|
| }
|
| @@ -213,9 +213,6 @@ class TestGraphVisitor : public EffectGraphVisitor {
|
| TargetEntryInstr** false_successor_address_;
|
| };
|
|
|
| -#undef DEFINE_VISIT
|
| -
|
| -
|
| } // namespace dart
|
|
|
| #endif // VM_FLOW_GRAPH_BUILDER_H_
|
|
|