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_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 } | 1266 } |
1267 | 1267 |
1268 | 1268 |
1269 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { | 1269 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { |
1270 Comment cmnt(masm_, "[ ForOfStatement"); | 1270 Comment cmnt(masm_, "[ ForOfStatement"); |
1271 SetStatementPosition(stmt); | 1271 SetStatementPosition(stmt); |
1272 | 1272 |
1273 Iteration loop_statement(this, stmt); | 1273 Iteration loop_statement(this, stmt); |
1274 increment_loop_depth(); | 1274 increment_loop_depth(); |
1275 | 1275 |
1276 // var iterator = iterable[@@iterator]() | 1276 // var iterable = subject |
1277 VisitForAccumulatorValue(stmt->assign_iterator()); | 1277 VisitForAccumulatorValue(stmt->assign_iterable()); |
1278 | 1278 |
1279 // As with for-in, skip the loop if the iterator is null or undefined. | 1279 // As with for-in, skip the loop if the iterator is null or undefined. |
1280 __ CompareRoot(r0, Heap::kUndefinedValueRootIndex); | 1280 __ CompareRoot(r0, Heap::kUndefinedValueRootIndex); |
1281 __ b(eq, loop_statement.break_label()); | 1281 __ b(eq, loop_statement.break_label()); |
1282 __ CompareRoot(r0, Heap::kNullValueRootIndex); | 1282 __ CompareRoot(r0, Heap::kNullValueRootIndex); |
1283 __ b(eq, loop_statement.break_label()); | 1283 __ b(eq, loop_statement.break_label()); |
1284 | 1284 |
1285 // Convert the iterator to a JS object. | 1285 // var iterator = iterable[Symbol.iterator](); |
1286 Label convert, done_convert; | 1286 VisitForEffect(stmt->assign_iterator()); |
1287 __ JumpIfSmi(r0, &convert); | |
1288 __ CompareObjectType(r0, r1, r1, FIRST_SPEC_OBJECT_TYPE); | |
1289 __ b(ge, &done_convert); | |
1290 __ bind(&convert); | |
1291 __ push(r0); | |
1292 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | |
1293 __ bind(&done_convert); | |
1294 __ push(r0); | |
1295 | 1287 |
1296 // Loop entry. | 1288 // Loop entry. |
1297 __ bind(loop_statement.continue_label()); | 1289 __ bind(loop_statement.continue_label()); |
1298 | 1290 |
1299 // result = iterator.next() | 1291 // result = iterator.next() |
1300 VisitForEffect(stmt->next_result()); | 1292 VisitForEffect(stmt->next_result()); |
1301 | 1293 |
1302 // if (result.done) break; | 1294 // if (result.done) break; |
1303 Label result_not_done; | 1295 Label result_not_done; |
1304 VisitForControl(stmt->result_done(), | 1296 VisitForControl(stmt->result_done(), |
(...skipping 3526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4831 | 4823 |
4832 ASSERT(interrupt_address == | 4824 ASSERT(interrupt_address == |
4833 isolate->builtins()->OsrAfterStackCheck()->entry()); | 4825 isolate->builtins()->OsrAfterStackCheck()->entry()); |
4834 return OSR_AFTER_STACK_CHECK; | 4826 return OSR_AFTER_STACK_CHECK; |
4835 } | 4827 } |
4836 | 4828 |
4837 | 4829 |
4838 } } // namespace v8::internal | 4830 } } // namespace v8::internal |
4839 | 4831 |
4840 #endif // V8_TARGET_ARCH_ARM | 4832 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |