Index: src/data-flow.h |
diff --git a/src/data-flow.h b/src/data-flow.h |
index 74a370c0da446898e94feb6ac336e9243f4e5973..f380702c77ef32cd0915e9d8daffe1da18d776c8 100644 |
--- a/src/data-flow.h |
+++ b/src/data-flow.h |
@@ -485,19 +485,20 @@ class FlowGraph BASE_EMBEDDED { |
// traversal orders as a byproduct. |
class FlowGraphBuilder: public AstVisitor { |
public: |
- FlowGraphBuilder() |
+ explicit FlowGraphBuilder(int variable_count) |
: graph_(FlowGraph::Empty()), |
global_exit_(NULL), |
preorder_(4), |
postorder_(4), |
- definitions_(4) { |
+ variable_count_(variable_count), |
+ body_definitions_(4) { |
} |
void Build(FunctionLiteral* lit); |
FlowGraph* graph() { return &graph_; } |
ZoneList<Node*>* postorder() { return &postorder_; } |
- ZoneList<Expression*>* definitions() { return &definitions_; } |
+ ZoneList<Expression*>* body_definitions() { return &body_definitions_; } |
private: |
ExitNode* global_exit() { return global_exit_; } |
@@ -512,11 +513,13 @@ class FlowGraphBuilder: public AstVisitor { |
ZoneList<Node*> preorder_; |
ZoneList<Node*> postorder_; |
- // The flow graph builder collects a list of definitions (assignments and |
- // count operations) to stack-allocated variables to use for reaching |
- // definitions analysis. AST node numbers in the AST are used to refer |
- // into this list. |
- ZoneList<Expression*> definitions_; |
+ // The flow graph builder collects a list of explicit definitions |
+ // (assignments and count operations) to stack-allocated variables to use |
+ // for reaching definitions analysis. It does not count the implicit |
+ // definition at function entry. AST node numbers in the AST are used to |
+ // refer into this list. |
+ int variable_count_; |
+ ZoneList<Expression*> body_definitions_; |
DISALLOW_COPY_AND_ASSIGN(FlowGraphBuilder); |
}; |
@@ -589,15 +592,11 @@ class AssignedVariablesAnalyzer : public AstVisitor { |
class ReachingDefinitions BASE_EMBEDDED { |
public: |
ReachingDefinitions(ZoneList<Node*>* postorder, |
- ZoneList<Expression*>* definitions, |
+ ZoneList<Expression*>* body_definitions, |
int variable_count) |
: postorder_(postorder), |
- definitions_(definitions), |
- variables_(variable_count) { |
- int definition_count = definitions->length(); |
- for (int i = 0; i < variable_count; i++) { |
- variables_.Add(new BitVector(definition_count)); |
- } |
+ body_definitions_(body_definitions), |
+ variable_count_(variable_count) { |
} |
static int IndexFor(Variable* var, int variable_count); |
@@ -609,10 +608,9 @@ class ReachingDefinitions BASE_EMBEDDED { |
ZoneList<Node*>* postorder_; |
// A list of all the definitions in the body. |
- ZoneList<Expression*>* definitions_; |
+ ZoneList<Expression*>* body_definitions_; |
- // For each variable, the set of all its definitions. |
- List<BitVector*> variables_; |
+ int variable_count_; |
DISALLOW_COPY_AND_ASSIGN(ReachingDefinitions); |
}; |