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

Unified Diff: src/data-flow.cc

Issue 668257: Have the flow graph builder collect definitions. (Closed)
Patch Set: Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/data-flow.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/data-flow.cc
diff --git a/src/data-flow.cc b/src/data-flow.cc
index 96acb9959cfd0b58edbfa175dfaa498da9e398d6..1a0cf1a18765cf4843b14b21be4ef2225e53caa3 100644
--- a/src/data-flow.cc
+++ b/src/data-flow.cc
@@ -431,11 +431,17 @@ void FlowGraphBuilder::VisitAssignment(Assignment* expr) {
// Left-hand side can be a variable or property (or reference error) but
// not both.
ASSERT(var == NULL || prop == NULL);
- if (prop != NULL) {
+ if (var != NULL) {
+ Visit(expr->value());
+ Slot* slot = var->slot();
+ if (slot != NULL &&
fschneider 2010/03/09 09:23:05 I'm also checking for stack locals and parameters
+ (slot->type() == Slot::LOCAL || slot->type() == Slot::PARAMETER)) {
+ definitions_.Add(expr);
+ }
+
+ } else if (prop != NULL) {
Visit(prop->obj());
if (!prop->key()->IsPropertyName()) Visit(prop->key());
- }
- if (var != NULL || prop != NULL) {
Visit(expr->value());
}
graph_.AppendInstruction(expr);
@@ -492,6 +498,14 @@ void FlowGraphBuilder::VisitUnaryOperation(UnaryOperation* expr) {
void FlowGraphBuilder::VisitCountOperation(CountOperation* expr) {
Visit(expr->expression());
+ Variable* var = expr->expression()->AsVariableProxy()->AsVariable();
fschneider 2010/03/09 09:23:05 Sometimes we use ...->AsVariableProxy()->var()
+ if (var != NULL) {
+ Slot* slot = var->slot();
+ if (slot != NULL &&
+ (slot->type() == Slot::LOCAL || slot->type() == Slot::PARAMETER)) {
+ definitions_.Add(expr);
+ }
+ }
graph_.AppendInstruction(expr);
}
« no previous file with comments | « src/data-flow.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698