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

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

Issue 416033002: For-of on null or undefined is an error (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 6 years, 5 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
« 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 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1197 } 1197 }
1198 1198
1199 1199
1200 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { 1200 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) {
1201 Comment cmnt(masm_, "[ ForOfStatement"); 1201 Comment cmnt(masm_, "[ ForOfStatement");
1202 SetStatementPosition(stmt); 1202 SetStatementPosition(stmt);
1203 1203
1204 Iteration loop_statement(this, stmt); 1204 Iteration loop_statement(this, stmt);
1205 increment_loop_depth(); 1205 increment_loop_depth();
1206 1206
1207 // var iterable = subject
1208 VisitForAccumulatorValue(stmt->assign_iterable());
1209
1210 // As with for-in, skip the loop if the iterator is null or undefined.
1211 __ CompareRoot(eax, Heap::kUndefinedValueRootIndex);
1212 __ j(equal, loop_statement.break_label());
1213 __ CompareRoot(eax, Heap::kNullValueRootIndex);
1214 __ j(equal, loop_statement.break_label());
1215
1216 // var iterator = iterable[Symbol.iterator](); 1207 // var iterator = iterable[Symbol.iterator]();
1217 VisitForEffect(stmt->assign_iterator()); 1208 VisitForEffect(stmt->assign_iterator());
1218 1209
1219 // Loop entry. 1210 // Loop entry.
1220 __ bind(loop_statement.continue_label()); 1211 __ bind(loop_statement.continue_label());
1221 1212
1222 // result = iterator.next() 1213 // result = iterator.next()
1223 VisitForEffect(stmt->next_result()); 1214 VisitForEffect(stmt->next_result());
1224 1215
1225 // if (result.done) break; 1216 // if (result.done) break;
(...skipping 3601 matching lines...) Expand 10 before | Expand all | Expand 10 after
4827 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4818 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4828 Assembler::target_address_at(call_target_address, 4819 Assembler::target_address_at(call_target_address,
4829 unoptimized_code)); 4820 unoptimized_code));
4830 return OSR_AFTER_STACK_CHECK; 4821 return OSR_AFTER_STACK_CHECK;
4831 } 4822 }
4832 4823
4833 4824
4834 } } // namespace v8::internal 4825 } } // namespace v8::internal
4835 4826
4836 #endif // V8_TARGET_ARCH_X87 4827 #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