Index: src/x64/full-codegen-x64.cc |
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
index 8de422608bd7bb8334351614a253b8fdd7662f7a..1816abe294fd0921409b2a1138167b686b934d72 100644 |
--- a/src/x64/full-codegen-x64.cc |
+++ b/src/x64/full-codegen-x64.cc |
@@ -1252,24 +1252,17 @@ void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { |
Iteration loop_statement(this, stmt); |
increment_loop_depth(); |
- // var iterator = iterable[@@iterator]() |
- VisitForAccumulatorValue(stmt->assign_iterator()); |
+ // var iterable = subject |
+ VisitForAccumulatorValue(stmt->assign_iterable()); |
- // As with for-in, skip the loop if the iterator is null or undefined. |
+ // As with for-in, skip the loop if the iterable is null or undefined. |
__ CompareRoot(rax, Heap::kUndefinedValueRootIndex); |
__ j(equal, loop_statement.break_label()); |
__ CompareRoot(rax, Heap::kNullValueRootIndex); |
__ j(equal, loop_statement.break_label()); |
- // Convert the iterator to a JS object. |
- Label convert, done_convert; |
- __ JumpIfSmi(rax, &convert); |
- __ CmpObjectType(rax, FIRST_SPEC_OBJECT_TYPE, rcx); |
- __ j(above_equal, &done_convert); |
- __ bind(&convert); |
- __ Push(rax); |
- __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
- __ bind(&done_convert); |
+ // var iterator = iterable[Symbol.iterator](); |
+ VisitForEffect(stmt->assign_iterator()); |
// Loop entry. |
__ bind(loop_statement.continue_label()); |