Index: src/mips64/full-codegen-mips64.cc |
diff --git a/src/mips64/full-codegen-mips64.cc b/src/mips64/full-codegen-mips64.cc |
index 72801d5715e263dd13aee3a4bf25942375e373a9..06c3bb45b5c400d7a72a118a69632833e8e21e31 100644 |
--- a/src/mips64/full-codegen-mips64.cc |
+++ b/src/mips64/full-codegen-mips64.cc |
@@ -1097,7 +1097,6 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
// Get the object to enumerate over. If the object is null or undefined, skip |
// over the loop. See ECMA-262 version 5, section 12.6.4. |
- SetExpressionPosition(stmt->enumerable()); |
VisitForAccumulatorValue(stmt->enumerable()); |
__ mov(a0, result_register()); // Result as param to InvokeBuiltin below. |
__ LoadRoot(at, Heap::kUndefinedValueRootIndex); |
@@ -1239,7 +1238,6 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
__ mov(result_register(), a3); |
// Perform the assignment as if via '='. |
{ EffectContext context(this); |
- SetExpressionPosition(stmt->each()); |
EmitAssignment(stmt->each()); |
} |
@@ -1267,6 +1265,48 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { |
} |
+void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { |
+ Comment cmnt(masm_, "[ ForOfStatement"); |
+ SetStatementPosition(stmt); |
+ |
+ Iteration loop_statement(this, stmt); |
+ increment_loop_depth(); |
+ |
+ // var iterator = iterable[Symbol.iterator](); |
+ VisitForEffect(stmt->assign_iterator()); |
+ |
+ // Loop entry. |
+ __ bind(loop_statement.continue_label()); |
+ |
+ // result = iterator.next() |
+ 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(), NO_REGISTERS); |
+ EmitBackEdgeBookkeeping(stmt, loop_statement.continue_label()); |
+ __ jmp(loop_statement.continue_label()); |
+ |
+ // Exit and decrement the loop depth. |
+ PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
+ __ bind(loop_statement.break_label()); |
+ decrement_loop_depth(); |
+} |
+ |
+ |
void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, |
bool pretenure) { |
// Use the fast case closure allocation code that allocates in new |