Reviewers: Lasse Reichstein,
Message:
Small fix that re-activates while-loops and dowhile-loops and fixes the
debug
assertion failure in test/mjsunit/array-concat.js
Description:
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++; }
Please review this at http://codereview.chromium.org/371070
SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/
Affected files:
M src/compiler.cc
M src/fast-codegen.cc
Index: src/compiler.cc
===================================================================
--- src/compiler.cc (revision 3253)
+++ src/compiler.cc (working copy)
@@ -708,12 +708,20 @@
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());
}
Index: src/fast-codegen.cc
===================================================================
--- src/fast-codegen.cc (revision 3252)
+++ src/fast-codegen.cc (working copy)
@@ -320,6 +320,8 @@
false_label_ = &exit;
ASSERT(stmt->cond()->context() == Expression::kTest);
Visit(stmt->cond());
+ true_label_ = NULL;
+ false_label_ = NULL;
__ bind(&exit);
@@ -347,6 +349,8 @@
false_label_ = &exit;
ASSERT(stmt->cond()->context() == Expression::kTest);
Visit(stmt->cond());
+ true_label_ = NULL;
+ false_label_ = NULL;
__ bind(&exit);
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---