| Index: src/data-flow.h
|
| ===================================================================
|
| --- src/data-flow.h (revision 3827)
|
| +++ src/data-flow.h (working copy)
|
| @@ -62,6 +62,56 @@
|
| };
|
|
|
|
|
| +class VarUseMap : public HashMap {
|
| + public:
|
| + VarUseMap() : HashMap(VarMatch) {}
|
| +
|
| + ZoneList<Expression*>* Lookup(Variable* var);
|
| +
|
| + private:
|
| + static bool VarMatch(void* key1, void* key2) { return key1 == key2; }
|
| +};
|
| +
|
| +
|
| +class DefinitionInfo : public ZoneObject {
|
| + public:
|
| + explicit DefinitionInfo() : last_use_(NULL) {}
|
| +
|
| + Expression* last_use() { return last_use_; }
|
| + void set_last_use(Expression* expr) { last_use_ = expr; }
|
| +
|
| + private:
|
| + Expression* last_use_;
|
| + Register location_;
|
| +};
|
| +
|
| +
|
| +class LivenessAnalyzer : public AstVisitor {
|
| + public:
|
| + LivenessAnalyzer() {}
|
| +
|
| + void Analyze(FunctionLiteral* fun);
|
| +
|
| + private:
|
| + void VisitStatements(ZoneList<Statement*>* stmts);
|
| +
|
| + void RecordUse(Variable* var, Expression* expr);
|
| + void RecordDef(Variable* var, Expression* expr);
|
| +
|
| +
|
| + // AST node visit functions.
|
| +#define DECLARE_VISIT(type) virtual void Visit##type(type* node);
|
| + AST_NODE_LIST(DECLARE_VISIT)
|
| +#undef DECLARE_VISIT
|
| +
|
| + // Map for tracking the live variables.
|
| + VarUseMap live_vars_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(LivenessAnalyzer);
|
| +};
|
| +
|
| +
|
| } } // namespace v8::internal
|
|
|
| +
|
| #endif // V8_DATAFLOW_H_
|
|
|