| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 1196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1207 } | 1207 } |
| 1208 | 1208 |
| 1209 | 1209 |
| 1210 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { | 1210 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { |
| 1211 Comment cmnt(masm_, "[ ForOfStatement"); | 1211 Comment cmnt(masm_, "[ ForOfStatement"); |
| 1212 SetStatementPosition(stmt); | 1212 SetStatementPosition(stmt); |
| 1213 | 1213 |
| 1214 Iteration loop_statement(this, stmt); | 1214 Iteration loop_statement(this, stmt); |
| 1215 increment_loop_depth(); | 1215 increment_loop_depth(); |
| 1216 | 1216 |
| 1217 // var iterator = iterable[@@iterator]() | 1217 // var iterable = subject |
| 1218 VisitForAccumulatorValue(stmt->assign_iterator()); | 1218 VisitForAccumulatorValue(stmt->assign_iterable()); |
| 1219 | 1219 |
| 1220 // As with for-in, skip the loop if the iterator is null or undefined. | 1220 // As with for-in, skip the loop if the iterator is null or undefined. |
| 1221 __ CompareRoot(eax, Heap::kUndefinedValueRootIndex); | 1221 __ CompareRoot(eax, Heap::kUndefinedValueRootIndex); |
| 1222 __ j(equal, loop_statement.break_label()); | 1222 __ j(equal, loop_statement.break_label()); |
| 1223 __ CompareRoot(eax, Heap::kNullValueRootIndex); | 1223 __ CompareRoot(eax, Heap::kNullValueRootIndex); |
| 1224 __ j(equal, loop_statement.break_label()); | 1224 __ j(equal, loop_statement.break_label()); |
| 1225 | 1225 |
| 1226 // Convert the iterator to a JS object. | 1226 // var iterator = iterable[Symbol.iterator](); |
| 1227 Label convert, done_convert; | 1227 VisitForEffect(stmt->assign_iterator()); |
| 1228 __ JumpIfSmi(eax, &convert); | |
| 1229 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx); | |
| 1230 __ j(above_equal, &done_convert); | |
| 1231 __ bind(&convert); | |
| 1232 __ push(eax); | |
| 1233 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | |
| 1234 __ bind(&done_convert); | |
| 1235 | 1228 |
| 1236 // Loop entry. | 1229 // Loop entry. |
| 1237 __ bind(loop_statement.continue_label()); | 1230 __ bind(loop_statement.continue_label()); |
| 1238 | 1231 |
| 1239 // result = iterator.next() | 1232 // result = iterator.next() |
| 1240 VisitForEffect(stmt->next_result()); | 1233 VisitForEffect(stmt->next_result()); |
| 1241 | 1234 |
| 1242 // if (result.done) break; | 1235 // if (result.done) break; |
| 1243 Label result_not_done; | 1236 Label result_not_done; |
| 1244 VisitForControl(stmt->result_done(), | 1237 VisitForControl(stmt->result_done(), |
| (...skipping 3558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4803 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), | 4796 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), |
| 4804 Assembler::target_address_at(call_target_address, | 4797 Assembler::target_address_at(call_target_address, |
| 4805 unoptimized_code)); | 4798 unoptimized_code)); |
| 4806 return OSR_AFTER_STACK_CHECK; | 4799 return OSR_AFTER_STACK_CHECK; |
| 4807 } | 4800 } |
| 4808 | 4801 |
| 4809 | 4802 |
| 4810 } } // namespace v8::internal | 4803 } } // namespace v8::internal |
| 4811 | 4804 |
| 4812 #endif // V8_TARGET_ARCH_IA32 | 4805 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |