Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: src/a64/full-codegen-a64.cc

Issue 146703002: A64: Tidy up VisitForOfStatement (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698