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

Unified Diff: src/data-flow.h

Issue 603004: Add last use data flow information to the fast code generator.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast.h ('k') | src/data-flow.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « src/ast.h ('k') | src/data-flow.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698