| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 Comment cmnt(masm_, "[ ForOfStatement"); | 1262 Comment cmnt(masm_, "[ ForOfStatement"); |
| 1263 SetStatementPosition(stmt); | 1263 SetStatementPosition(stmt); |
| 1264 | 1264 |
| 1265 Iteration loop_statement(this, stmt); | 1265 Iteration loop_statement(this, stmt); |
| 1266 increment_loop_depth(); | 1266 increment_loop_depth(); |
| 1267 | 1267 |
| 1268 // var iterator = iterable[@@iterator]() | 1268 // var iterator = iterable[@@iterator]() |
| 1269 VisitForAccumulatorValue(stmt->assign_iterator()); | 1269 VisitForAccumulatorValue(stmt->assign_iterator()); |
| 1270 | 1270 |
| 1271 // As with for-in, skip the loop if the iterator is null or undefined. | 1271 // As with for-in, skip the loop if the iterator is null or undefined. |
| 1272 __ CompareRoot(x0, Heap::kUndefinedValueRootIndex); | 1272 Register iterator = x0; |
| 1273 __ B(eq, loop_statement.break_label()); | 1273 __ JumpIfRoot(iterator, Heap::kUndefinedValueRootIndex, |
| 1274 __ CompareRoot(x0, Heap::kNullValueRootIndex); | 1274 loop_statement.break_label()); |
| 1275 __ B(eq, loop_statement.break_label()); | 1275 __ JumpIfRoot(iterator, Heap::kNullValueRootIndex, |
| 1276 loop_statement.break_label()); |
| 1276 | 1277 |
| 1277 // Convert the iterator to a JS object. | 1278 // Convert the iterator to a JS object. |
| 1278 Label convert, done_convert; | 1279 Label convert, done_convert; |
| 1279 __ JumpIfSmi(x0, &convert); | 1280 __ JumpIfSmi(iterator, &convert); |
| 1280 __ CompareObjectType(x0, x10, x11, FIRST_SPEC_OBJECT_TYPE); | 1281 __ CompareObjectType(iterator, x1, x1, FIRST_SPEC_OBJECT_TYPE); |
| 1281 __ B(ge, &done_convert); | 1282 __ B(ge, &done_convert); |
| 1282 __ Bind(&convert); | 1283 __ Bind(&convert); |
| 1283 __ Push(x0); | 1284 __ Push(iterator); |
| 1284 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); | 1285 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
| 1285 __ Bind(&done_convert); | 1286 __ Bind(&done_convert); |
| 1286 __ Push(x0); | 1287 __ Push(iterator); |
| 1287 | 1288 |
| 1288 // Loop entry. | 1289 // Loop entry. |
| 1289 __ Bind(loop_statement.continue_label()); | 1290 __ Bind(loop_statement.continue_label()); |
| 1290 | 1291 |
| 1291 // result = iterator.next() | 1292 // result = iterator.next() |
| 1292 VisitForEffect(stmt->next_result()); | 1293 VisitForEffect(stmt->next_result()); |
| 1293 | 1294 |
| 1294 // if (result.done) break; | 1295 // if (result.done) break; |
| 1295 Label result_not_done; | 1296 Label result_not_done; |
| 1296 VisitForControl(stmt->result_done(), | 1297 VisitForControl(stmt->result_done(), |
| (...skipping 3666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4963 return previous_; | 4964 return previous_; |
| 4964 } | 4965 } |
| 4965 | 4966 |
| 4966 | 4967 |
| 4967 #undef __ | 4968 #undef __ |
| 4968 | 4969 |
| 4969 | 4970 |
| 4970 } } // namespace v8::internal | 4971 } } // namespace v8::internal |
| 4971 | 4972 |
| 4972 #endif // V8_TARGET_ARCH_A64 | 4973 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |