We forgot resetting true-/false-label to NULL after evaluating the
condition expression in dowhile- and while-loops.
This change fixes this.
This causes an assertion to fail in VisitIfStatement whenever there is an
if-statement after a while-loop before. e.g. like in:
var i=0, j=0;
while(j<5) { j++; }
if (i ==0 ) { j++; }
Review URL: http://codereview.chromium.org/371070
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3255
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
void CodeGenSelector::VisitDoWhileStatement(DoWhileStatement* stmt) {
- BAILOUT("DoWhileStatement");
+ // We do not handle loops with breaks or continue statements in their
+ // body. We will bailout when we hit those statements in the body.
+ ProcessExpression(stmt->cond(), Expression::kTest);
+ CHECK_BAILOUT;
+ Visit(stmt->body());
}
void CodeGenSelector::VisitWhileStatement(WhileStatement* stmt) {
- BAILOUT("WhileStatement");
+ // We do not handle loops with breaks or continue statements in their
+ // body. We will bailout when we hit those statements in the body.
+ ProcessExpression(stmt->cond(), Expression::kTest);
+ CHECK_BAILOUT;
+ Visit(stmt->body());
}
false_label_ = &exit;
ASSERT(stmt->cond()->context() == Expression::kTest);
Visit(stmt->cond());
+ true_label_ = NULL;
+ false_label_ = NULL;
__ bind(&exit);
false_label_ = &exit;
ASSERT(stmt->cond()->context() == Expression::kTest);
Visit(stmt->cond());
+ true_label_ = NULL;
+ false_label_ = NULL;
__ bind(&exit);