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

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

Issue 15740007: Add for-of Crankshaft support Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase onto master; fix AstTyper for ForOfStatement Created 7 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/hydrogen.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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 1206
1207 // var iterator = iterable[@@iterator]() 1207 // var iterator = iterable[@@iterator]()
1208 VisitForAccumulatorValue(stmt->assign_iterator()); 1208 VisitForAccumulatorValue(stmt->assign_iterator());
1209 1209
1210 // As with for-in, skip the loop if the iterator is null or undefined. 1210 // As with for-in, skip the loop if the iterator is null or undefined.
1211 __ CompareRoot(eax, Heap::kUndefinedValueRootIndex); 1211 __ CompareRoot(eax, Heap::kUndefinedValueRootIndex);
1212 __ j(equal, loop_statement.break_label()); 1212 __ j(equal, loop_statement.break_label());
1213 __ CompareRoot(eax, Heap::kNullValueRootIndex); 1213 __ CompareRoot(eax, Heap::kNullValueRootIndex);
1214 __ j(equal, loop_statement.break_label()); 1214 __ j(equal, loop_statement.break_label());
1215 1215
1216 // Convert the iterator to a JS object.
1217 Label convert, done_convert;
1218 __ JumpIfSmi(eax, &convert);
1219 __ CmpObjectType(eax, FIRST_SPEC_OBJECT_TYPE, ecx);
1220 __ j(above_equal, &done_convert);
1221 __ bind(&convert);
1222 __ push(eax);
1223 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION);
1224 __ bind(&done_convert);
1225
1226 // Loop entry. 1216 // Loop entry.
1227 __ bind(loop_statement.continue_label()); 1217 __ bind(loop_statement.continue_label());
1228 1218
1229 // result = iterator.next() 1219 // result = iterator.next()
1230 VisitForEffect(stmt->next_result()); 1220 VisitForEffect(stmt->next_result());
1231 1221
1232 // if (result.done) break; 1222 // if (result.done) break;
1233 Label result_not_done; 1223 Label result_not_done;
1234 VisitForControl(stmt->result_done(), 1224 VisitForControl(stmt->result_done(),
1235 loop_statement.break_label(), 1225 loop_statement.break_label(),
1236 &result_not_done, 1226 &result_not_done,
1237 &result_not_done); 1227 &result_not_done);
1238 __ bind(&result_not_done); 1228 __ bind(&result_not_done);
1239 1229
1230 PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS);
1231
1240 // each = result.value 1232 // each = result.value
1241 VisitForEffect(stmt->assign_each()); 1233 VisitForEffect(stmt->assign_each());
1242 1234
1243 // Generate code for the body of the loop. 1235 // Generate code for the body of the loop.
1244 Visit(stmt->body()); 1236 Visit(stmt->body());
1245 1237
1246 // Check stack before looping. 1238 // Loop.
1247 PrepareForBailoutForId(stmt->BackEdgeId(), NO_REGISTERS);
1248 EmitBackEdgeBookkeeping(stmt, loop_statement.continue_label()); 1239 EmitBackEdgeBookkeeping(stmt, loop_statement.continue_label());
1249 __ jmp(loop_statement.continue_label()); 1240 __ jmp(loop_statement.continue_label());
1250 1241
1251 // Exit and decrement the loop depth. 1242 // Exit and decrement the loop depth.
1252 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); 1243 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
1253 __ bind(loop_statement.break_label()); 1244 __ bind(loop_statement.break_label());
1254 decrement_loop_depth(); 1245 decrement_loop_depth();
1255 } 1246 }
1256 1247
1257 1248
(...skipping 3668 matching lines...) Expand 10 before | Expand all | Expand 10 after
4926 *stack_depth = 0; 4917 *stack_depth = 0;
4927 *context_length = 0; 4918 *context_length = 0;
4928 return previous_; 4919 return previous_;
4929 } 4920 }
4930 4921
4931 #undef __ 4922 #undef __
4932 4923
4933 } } // namespace v8::internal 4924 } } // namespace v8::internal
4934 4925
4935 #endif // V8_TARGET_ARCH_IA32 4926 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698