Revision: 23369
Author: [email protected]
Date: Mon Aug 25 16:32:35 2014 UTC
Log: Fix continue statements within for-in loops.
[email protected]
TEST=cctest/test-run-jsbranches/ForInContinueStatement
BUG=v8:3522
LOG=N
Review URL: https://codereview.chromium.org/502043002
https://code.google.com/p/v8/source/detail?r=23369
Modified:
/branches/bleeding_edge/src/compiler/ast-graph-builder.cc
/branches/bleeding_edge/test/cctest/compiler/test-run-jsbranches.cc
=======================================
--- /branches/bleeding_edge/src/compiler/ast-graph-builder.cc Fri Aug 22
07:44:18 2014 UTC
+++ /branches/bleeding_edge/src/compiler/ast-graph-builder.cc Mon Aug 25
16:32:35 2014 UTC
@@ -744,13 +744,13 @@
// Bind value and do loop body.
VisitForInAssignment(stmt->each(), value);
VisitIterationBody(stmt, &for_loop, 5);
+ for_loop.EndBody();
// Inc counter and continue.
Node* index_inc =
NewNode(javascript()->Add(), index, jsgraph()->OneConstant());
// TODO(jarin): provide real bailout id.
PrepareFrameState(index_inc, BailoutId::None());
environment()->Poke(0, index_inc);
- for_loop.EndBody();
for_loop.EndLoop();
environment()->Drop(5);
// PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
=======================================
--- /branches/bleeding_edge/test/cctest/compiler/test-run-jsbranches.cc Wed
Jul 30 13:54:45 2014 UTC
+++ /branches/bleeding_edge/test/cctest/compiler/test-run-jsbranches.cc Mon
Aug 25 16:32:35 2014 UTC
@@ -146,6 +146,26 @@
"}"
"return obj.a;})");
}
+
+
+TEST(ForInContinueStatement) {
+ const char* src =
+ "(function(a,b) {"
+ " var r = '-';"
+ " for (var x in a) {"
+ " r += 'A-';"
+ " if (b) continue;"
+ " r += 'B-';"
+ " }"
+ " return r;"
+ "})";
+ FunctionTester T(src);
+
+ T.CheckCall(T.Val("-A-B-"), T.NewObject("({x:1})"), T.false_value());
+ T.CheckCall(T.Val("-A-B-A-B-"), T.NewObject("({x:1,y:2})"),
T.false_value());
+ T.CheckCall(T.Val("-A-"), T.NewObject("({x:1})"), T.true_value());
+ T.CheckCall(T.Val("-A-A-"), T.NewObject("({x:1,y:2})"), T.true_value());
+}
TEST(SwitchStatement) {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.