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

Side by Side Diff: src/x64/full-codegen-x64.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/parser.cc ('k') | src/x87/full-codegen-x87.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_X64 7 #if V8_TARGET_ARCH_X64
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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 } 1234 }
1235 1235
1236 1236
1237 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { 1237 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) {
1238 Comment cmnt(masm_, "[ ForOfStatement"); 1238 Comment cmnt(masm_, "[ ForOfStatement");
1239 SetStatementPosition(stmt); 1239 SetStatementPosition(stmt);
1240 1240
1241 Iteration loop_statement(this, stmt); 1241 Iteration loop_statement(this, stmt);
1242 increment_loop_depth(); 1242 increment_loop_depth();
1243 1243
1244 // var iterable = subject
1245 VisitForAccumulatorValue(stmt->assign_iterable());
1246
1247 // As with for-in, skip the loop if the iterable is null or undefined.
1248 __ CompareRoot(rax, Heap::kUndefinedValueRootIndex);
1249 __ j(equal, loop_statement.break_label());
1250 __ CompareRoot(rax, Heap::kNullValueRootIndex);
1251 __ j(equal, loop_statement.break_label());
1252
1253 // var iterator = iterable[Symbol.iterator](); 1244 // var iterator = iterable[Symbol.iterator]();
1254 VisitForEffect(stmt->assign_iterator()); 1245 VisitForEffect(stmt->assign_iterator());
1255 1246
1256 // Loop entry. 1247 // Loop entry.
1257 __ bind(loop_statement.continue_label()); 1248 __ bind(loop_statement.continue_label());
1258 1249
1259 // result = iterator.next() 1250 // result = iterator.next()
1260 VisitForEffect(stmt->next_result()); 1251 VisitForEffect(stmt->next_result());
1261 1252
1262 // if (result.done) break; 1253 // if (result.done) break;
(...skipping 3578 matching lines...) Expand 10 before | Expand all | Expand 10 after
4841 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4832 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4842 Assembler::target_address_at(call_target_address, 4833 Assembler::target_address_at(call_target_address,
4843 unoptimized_code)); 4834 unoptimized_code));
4844 return OSR_AFTER_STACK_CHECK; 4835 return OSR_AFTER_STACK_CHECK;
4845 } 4836 }
4846 4837
4847 4838
4848 } } // namespace v8::internal 4839 } } // namespace v8::internal
4849 4840
4850 #endif // V8_TARGET_ARCH_X64 4841 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698