Fixed bug in while-loops that caused an assertion to fail.

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
This commit is contained in:
fschneider@chromium.org 2009-11-10 09:57:13 +00:00
parent 95d550578c
commit 091c7a2306
2 changed files with 14 additions and 2 deletions

View File

@ -708,12 +708,20 @@ void CodeGenSelector::VisitSwitchStatement(SwitchStatement* stmt) {
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());
}

View File

@ -320,6 +320,8 @@ void FastCodeGenerator::VisitDoWhileStatement(DoWhileStatement* stmt) {
false_label_ = &exit;
ASSERT(stmt->cond()->context() == Expression::kTest);
Visit(stmt->cond());
true_label_ = NULL;
false_label_ = NULL;
__ bind(&exit);
@ -347,6 +349,8 @@ void FastCodeGenerator::VisitWhileStatement(WhileStatement* stmt) {
false_label_ = &exit;
ASSERT(stmt->cond()->context() == Expression::kTest);
Visit(stmt->cond());
true_label_ = NULL;
false_label_ = NULL;
__ bind(&exit);