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

Side by Side Diff: src/data-flow.cc

Issue 1074009: Mark all loop conditions. (Closed)
Patch Set: Negate test to match previous (and correct) behavior. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // loop without the init-statement. 207 // loop without the init-statement.
208 Block* block = new Block(NULL, 2, false); 208 Block* block = new Block(NULL, 2, false);
209 if (stmt->init() != NULL) { 209 if (stmt->init() != NULL) {
210 Statement* init = stmt->init(); 210 Statement* init = stmt->init();
211 // The init statement gets the statement position of the for-loop 211 // The init statement gets the statement position of the for-loop
212 // to make debugging of peeled loops possible. 212 // to make debugging of peeled loops possible.
213 init->set_statement_pos(stmt->statement_pos()); 213 init->set_statement_pos(stmt->statement_pos());
214 block->AddStatement(init); 214 block->AddStatement(init);
215 } 215 }
216 216
217 // Copy the condition. 217 // Copy the condition but mark the copy as no longer a loop condition.
218 CopyAstVisitor copy_visitor; 218 CopyAstVisitor copy_visitor;
219 Expression* cond_copy = stmt->cond() != NULL 219 Expression* cond_copy = stmt->cond() != NULL
220 ? copy_visitor.DeepCopyExpr(stmt->cond()) 220 ? copy_visitor.DeepCopyExpr(stmt->cond())
221 : new Literal(Factory::true_value()); 221 : new Literal(Factory::true_value());
222 if (copy_visitor.HasStackOverflow()) return NULL; 222 if (copy_visitor.HasStackOverflow()) return NULL;
223 cond_copy->set_is_loop_condition(false);
Søren Thygesen Gjesse 2010/03/23 13:21:02 Strictly speaking this is a lie, and it will cause
Kevin Millikin (Chromium) 2010/03/23 13:36:26 I guess not. I've removed it for now.
223 224
224 // Construct a block with the peeled body and the rest of the for-loop. 225 // Construct a block with the peeled body and the rest of the for-loop.
225 Statement* body_copy = copy_visitor.DeepCopyStmt(stmt->body()); 226 Statement* body_copy = copy_visitor.DeepCopyStmt(stmt->body());
226 if (copy_visitor.HasStackOverflow()) return NULL; 227 if (copy_visitor.HasStackOverflow()) return NULL;
227 228
228 Statement* next_copy = stmt->next() != NULL 229 Statement* next_copy = stmt->next() != NULL
229 ? copy_visitor.DeepCopyStmt(stmt->next()) 230 ? copy_visitor.DeepCopyStmt(stmt->next())
230 : new EmptyStatement(); 231 : new EmptyStatement();
231 if (copy_visitor.HasStackOverflow()) return NULL; 232 if (copy_visitor.HasStackOverflow()) return NULL;
232 233
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after
1988 1989
1989 // Step 4: Based on RD_in for block nodes, propagate reaching definitions 1990 // Step 4: Based on RD_in for block nodes, propagate reaching definitions
1990 // to all variable uses in the block. 1991 // to all variable uses in the block.
1991 for (int i = 0; i < node_count; i++) { 1992 for (int i = 0; i < node_count; i++) {
1992 postorder_->at(i)->PropagateReachingDefinitions(&variables); 1993 postorder_->at(i)->PropagateReachingDefinitions(&variables);
1993 } 1994 }
1994 } 1995 }
1995 1996
1996 1997
1997 } } // namespace v8::internal 1998 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.cc ('k') | src/ia32/codegen-ia32.cc » ('j') | src/ia32/codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698