Commit 88320112 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[fullcodegen] Remove for-of iteration support.

This removes support for iterator loops (i.e. for-of loop constructs)
from the {FullCodeGenerator}. Consequently optimized code containing
such constructs must use the {BytecodeGraphBuilder} and can no longer
use the {AstGraphBuilder} for graph building.

R=bmeurer@chromium.org
BUG=v8:5657

Review-Url: https://codereview.chromium.org/2534883004
Cr-Commit-Position: refs/heads/master@{#41357}
parent 067e9e29
......@@ -826,12 +826,6 @@ class ForOfStatement final : public ForEachStatement {
void set_result_done(Expression* e) { result_done_ = e; }
void set_assign_each(Expression* e) { assign_each_ = e; }
BailoutId ContinueId() const { return EntryId(); }
BailoutId StackCheckId() const { return BackEdgeId(); }
static int num_ids() { return parent_num_ids() + 1; }
BailoutId BackEdgeId() const { return BailoutId(local_id(0)); }
private:
friend class AstNodeFactory;
......@@ -842,8 +836,6 @@ class ForOfStatement final : public ForEachStatement {
next_result_(NULL),
result_done_(NULL),
assign_each_(NULL) {}
static int parent_num_ids() { return ForEachStatement::num_ids(); }
int local_id(int n) const { return base_id() + parent_num_ids() + n; }
Variable* iterator_;
Expression* assign_iterator_;
......
......@@ -1265,17 +1265,8 @@ void AstGraphBuilder::VisitForInStatement(ForInStatement* stmt) {
void AstGraphBuilder::VisitForOfStatement(ForOfStatement* stmt) {
LoopBuilder for_loop(this);
VisitForEffect(stmt->assign_iterator());
for_loop.BeginLoop(GetVariablesAssignedInLoop(stmt), CheckOsrEntry(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, stmt->StackCheckId());
for_loop.EndBody();
for_loop.EndLoop();
// Iterator looping is supported only by going through Ignition first.
UNREACHABLE();
}
......
......@@ -1261,43 +1261,8 @@ void FullCodeGenerator::VisitForStatement(ForStatement* stmt) {
void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) {
Comment cmnt(masm_, "[ ForOfStatement");
Iteration loop_statement(this, stmt);
increment_loop_depth();
// var iterator = iterable[Symbol.iterator]();
SetExpressionAsStatementPosition(stmt->assign_iterator());
VisitForEffect(stmt->assign_iterator());
// Loop entry.
__ bind(loop_statement.continue_label());
// result = iterator.next()
SetExpressionAsStatementPosition(stmt->next_result());
VisitForEffect(stmt->next_result());
// if (result.done) break;
Label result_not_done;
VisitForControl(stmt->result_done(), loop_statement.break_label(),
&result_not_done, &result_not_done);
__ bind(&result_not_done);
// each = result.value
VisitForEffect(stmt->assign_each());
// Generate code for the body of the loop.
Visit(stmt->body());
// Check stack before looping.
PrepareForBailoutForId(stmt->BackEdgeId(), BailoutState::NO_REGISTERS);
EmitBackEdgeBookkeeping(stmt, loop_statement.continue_label());
__ jmp(loop_statement.continue_label());
// Exit and decrement the loop depth.
PrepareForBailoutForId(stmt->ExitId(), BailoutState::NO_REGISTERS);
__ bind(loop_statement.break_label());
decrement_loop_depth();
// Iterator looping is not supported.
UNREACHABLE();
}
void FullCodeGenerator::VisitThisFunction(ThisFunction* expr) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment