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

Side by Side Diff: src/ia32/full-codegen-ia32.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/ast-value-factory.h ('k') | src/mips/full-codegen-mips.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_IA32 7 #if V8_TARGET_ARCH_IA32
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 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after
1200 } 1200 }
1201 1201
1202 1202
1203 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { 1203 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) {
1204 Comment cmnt(masm_, "[ ForOfStatement"); 1204 Comment cmnt(masm_, "[ ForOfStatement");
1205 SetStatementPosition(stmt); 1205 SetStatementPosition(stmt);
1206 1206
1207 Iteration loop_statement(this, stmt); 1207 Iteration loop_statement(this, stmt);
1208 increment_loop_depth(); 1208 increment_loop_depth();
1209 1209
1210 // var iterable = subject
1211 VisitForAccumulatorValue(stmt->assign_iterable());
1212
1213 // As with for-in, skip the loop if the iterator is null or undefined.
1214 __ CompareRoot(eax, Heap::kUndefinedValueRootIndex);
1215 __ j(equal, loop_statement.break_label());
1216 __ CompareRoot(eax, Heap::kNullValueRootIndex);
1217 __ j(equal, loop_statement.break_label());
1218
1219 // var iterator = iterable[Symbol.iterator](); 1210 // var iterator = iterable[Symbol.iterator]();
1220 VisitForEffect(stmt->assign_iterator()); 1211 VisitForEffect(stmt->assign_iterator());
1221 1212
1222 // Loop entry. 1213 // Loop entry.
1223 __ bind(loop_statement.continue_label()); 1214 __ bind(loop_statement.continue_label());
1224 1215
1225 // result = iterator.next() 1216 // result = iterator.next()
1226 VisitForEffect(stmt->next_result()); 1217 VisitForEffect(stmt->next_result());
1227 1218
1228 // if (result.done) break; 1219 // if (result.done) break;
(...skipping 3605 matching lines...) Expand 10 before | Expand all | Expand 10 after
4834 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4825 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4835 Assembler::target_address_at(call_target_address, 4826 Assembler::target_address_at(call_target_address,
4836 unoptimized_code)); 4827 unoptimized_code));
4837 return OSR_AFTER_STACK_CHECK; 4828 return OSR_AFTER_STACK_CHECK;
4838 } 4829 }
4839 4830
4840 4831
4841 } } // namespace v8::internal 4832 } } // namespace v8::internal
4842 4833
4843 #endif // V8_TARGET_ARCH_IA32 4834 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ast-value-factory.h ('k') | src/mips/full-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698