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

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 850803002: First simple implementation of for-of in TurboFan. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index 5c91b95153d6448fda9816f1340546aac6952186..7408cc5608dfbd1ac1207a029da3c3356eb1ecac 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -789,9 +789,17 @@ void AstGraphBuilder::VisitForInStatement(ForInStatement* stmt) {
void AstGraphBuilder::VisitForOfStatement(ForOfStatement* stmt) {
- VisitForValue(stmt->subject());
- environment()->Pop();
- // TODO(turbofan): create and use loop builder.
+ LoopBuilder for_loop(this);
+ VisitForEffect(stmt->assign_iterator());
+ for_loop.BeginLoop(GetVariablesAssignedInLoop(stmt), IsOsrLoopEntry(stmt));
+ VisitForEffect(stmt->next_result());
+ VisitForTest(stmt->result_done());
+ Node* condition = environment()->Pop();
+ for_loop.BreakWhen(condition);
+ VisitForEffect(stmt->assign_each());
+ VisitIterationBody(stmt, &for_loop, 0);
+ for_loop.EndBody();
+ for_loop.EndLoop();
}

Powered by Google App Engine
This is Rietveld 408576698