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

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

Issue 332663004: For-of calls [Symbol.iterator]() on RHS to get iterator (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | « src/ia32/full-codegen-ia32.cc ('k') | src/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after
1275 } 1275 }
1276 1276
1277 1277
1278 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { 1278 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) {
1279 Comment cmnt(masm_, "[ ForOfStatement"); 1279 Comment cmnt(masm_, "[ ForOfStatement");
1280 SetStatementPosition(stmt); 1280 SetStatementPosition(stmt);
1281 1281
1282 Iteration loop_statement(this, stmt); 1282 Iteration loop_statement(this, stmt);
1283 increment_loop_depth(); 1283 increment_loop_depth();
1284 1284
1285 // var iterator = iterable[@@iterator]() 1285 // var iterable = subject
1286 VisitForAccumulatorValue(stmt->assign_iterator()); 1286 VisitForAccumulatorValue(stmt->assign_iterable());
1287 __ mov(a0, v0); 1287 __ mov(a0, v0);
1288 1288
1289 // As with for-in, skip the loop if the iterator is null or undefined. 1289 // As with for-in, skip the loop if the iterator is null or undefined.
1290 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 1290 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
1291 __ Branch(loop_statement.break_label(), eq, a0, Operand(at)); 1291 __ Branch(loop_statement.break_label(), eq, a0, Operand(at));
1292 __ LoadRoot(at, Heap::kNullValueRootIndex); 1292 __ LoadRoot(at, Heap::kNullValueRootIndex);
1293 __ Branch(loop_statement.break_label(), eq, a0, Operand(at)); 1293 __ Branch(loop_statement.break_label(), eq, a0, Operand(at));
1294 1294
1295 // Convert the iterator to a JS object. 1295 // var iterator = iterable[Symbol.iterator]();
1296 Label convert, done_convert; 1296 VisitForEffect(stmt->assign_iterator());
1297 __ JumpIfSmi(a0, &convert);
1298 __ GetObjectType(a0, a1, a1);
1299 __ Branch(&done_convert, ge, a1, Operand(FIRST_SPEC_OBJECT_TYPE));
1300 __ bind(&convert);
1301 __ push(a0);
1302 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
1303 __ mov(a0, v0);
1304 __ bind(&done_convert);
1305 __ push(a0);
1306 1297
1307 // Loop entry. 1298 // Loop entry.
1308 __ bind(loop_statement.continue_label()); 1299 __ bind(loop_statement.continue_label());
1309 1300
1310 // result = iterator.next() 1301 // result = iterator.next()
1311 VisitForEffect(stmt->next_result()); 1302 VisitForEffect(stmt->next_result());
1312 1303
1313 // if (result.done) break; 1304 // if (result.done) break;
1314 Label result_not_done; 1305 Label result_not_done;
1315 VisitForControl(stmt->result_done(), 1306 VisitForControl(stmt->result_done(),
(...skipping 3546 matching lines...) Expand 10 before | Expand all | Expand 10 after
4862 Assembler::target_address_at(pc_immediate_load_address)) == 4853 Assembler::target_address_at(pc_immediate_load_address)) ==
4863 reinterpret_cast<uint32_t>( 4854 reinterpret_cast<uint32_t>(
4864 isolate->builtins()->OsrAfterStackCheck()->entry())); 4855 isolate->builtins()->OsrAfterStackCheck()->entry()));
4865 return OSR_AFTER_STACK_CHECK; 4856 return OSR_AFTER_STACK_CHECK;
4866 } 4857 }
4867 4858
4868 4859
4869 } } // namespace v8::internal 4860 } } // namespace v8::internal
4870 4861
4871 #endif // V8_TARGET_ARCH_MIPS 4862 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698