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

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 1618693005: [Interpreter] Add ForOf support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | test/cctest/compiler/test-run-bytecode-graph-builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index 5f640854f751764938498f4fe2b33a00fc4c9543..63b00d610e7a0ef308ace07cf9efa760b54250ed 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -894,7 +894,21 @@ void BytecodeGenerator::VisitForInStatement(ForInStatement* stmt) {
void BytecodeGenerator::VisitForOfStatement(ForOfStatement* stmt) {
- UNIMPLEMENTED();
+ LoopBuilder loop_builder(builder());
+ ControlScopeForIteration control_scope(this, stmt, &loop_builder);
+
+ VisitForEffect(stmt->assign_iterator());
+
+ loop_builder.LoopHeader();
+ loop_builder.Next();
+ VisitForEffect(stmt->next_result());
+ VisitForAccumulatorValue(stmt->result_done());
+ loop_builder.BreakIfTrue();
+
+ VisitForEffect(stmt->assign_each());
+ Visit(stmt->body());
+ loop_builder.JumpToHeader();
+ loop_builder.EndLoop();
}
« no previous file with comments | « no previous file | test/cctest/compiler/test-run-bytecode-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698