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

Side by Side Diff: src/x87/full-codegen-x87.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/x64/full-codegen-x64.cc ('k') | test/mjsunit/harmony/iteration-semantics.js » ('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_X87 7 #if V8_TARGET_ARCH_X87
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 1193 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 } 1204 }
1205 1205
1206 1206
1207 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { 1207 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) {
1208 Comment cmnt(masm_, "[ ForOfStatement"); 1208 Comment cmnt(masm_, "[ ForOfStatement");
1209 SetStatementPosition(stmt); 1209 SetStatementPosition(stmt);
1210 1210
1211 Iteration loop_statement(this, stmt); 1211 Iteration loop_statement(this, stmt);
1212 increment_loop_depth(); 1212 increment_loop_depth();
1213 1213
1214 // var iterator = iterable[@@iterator]() 1214 // var iterable = subject
1215 VisitForAccumulatorValue(stmt->assign_iterator()); 1215 VisitForAccumulatorValue(stmt->assign_iterable());
1216 1216
1217 // As with for-in, skip the loop if the iterator is null or undefined. 1217 // As with for-in, skip the loop if the iterator is null or undefined.
1218 __ CompareRoot(eax, Heap::kUndefinedValueRootIndex); 1218 __ CompareRoot(eax, Heap::kUndefinedValueRootIndex);
1219 __ j(equal, loop_statement.break_label()); 1219 __ j(equal, loop_statement.break_label());
1220 __ CompareRoot(eax, Heap::kNullValueRootIndex); 1220 __ CompareRoot(eax, Heap::kNullValueRootIndex);
1221 __ j(equal, loop_statement.break_label()); 1221 __ j(equal, loop_statement.break_label());
1222 1222
1223 // Convert the iterator to a JS object. 1223 // var iterator = iterable[Symbol.iterator]();
1224 Label convert, done_convert; 1224 VisitForEffect(stmt->assign_iterator());
1225 __ JumpIfSmi(eax, &convert);
1226 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx);
1227 __ j(above_equal, &done_convert);
1228 __ bind(&convert);
1229 __ push(eax);
1230 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
1231 __ bind(&done_convert);
1232 1225
1233 // Loop entry. 1226 // Loop entry.
1234 __ bind(loop_statement.continue_label()); 1227 __ bind(loop_statement.continue_label());
1235 1228
1236 // result = iterator.next() 1229 // result = iterator.next()
1237 VisitForEffect(stmt->next_result()); 1230 VisitForEffect(stmt->next_result());
1238 1231
1239 // if (result.done) break; 1232 // if (result.done) break;
1240 Label result_not_done; 1233 Label result_not_done;
1241 VisitForControl(stmt->result_done(), 1234 VisitForControl(stmt->result_done(),
(...skipping 3554 matching lines...) Expand 10 before | Expand all | Expand 10 after
4796 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4789 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4797 Assembler::target_address_at(call_target_address, 4790 Assembler::target_address_at(call_target_address,
4798 unoptimized_code)); 4791 unoptimized_code));
4799 return OSR_AFTER_STACK_CHECK; 4792 return OSR_AFTER_STACK_CHECK;
4800 } 4793 }
4801 4794
4802 4795
4803 } } // namespace v8::internal 4796 } } // namespace v8::internal
4804 4797
4805 #endif // V8_TARGET_ARCH_X87 4798 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/mjsunit/harmony/iteration-semantics.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698