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/mips/full-codegen-mips.cc

Issue 682413004: Fix stepping in for-loops. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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/ia32/full-codegen-ia32.cc ('k') | src/mips64/full-codegen-mips64.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_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 Comment cmnt(masm_, "[ ForInStatement"); 1095 Comment cmnt(masm_, "[ ForInStatement");
1096 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot(); 1096 FeedbackVectorSlot slot = stmt->ForInFeedbackSlot();
1097 SetStatementPosition(stmt); 1097 SetStatementPosition(stmt);
1098 1098
1099 Label loop, exit; 1099 Label loop, exit;
1100 ForIn loop_statement(this, stmt); 1100 ForIn loop_statement(this, stmt);
1101 increment_loop_depth(); 1101 increment_loop_depth();
1102 1102
1103 // Get the object to enumerate over. If the object is null or undefined, skip 1103 // Get the object to enumerate over. If the object is null or undefined, skip
1104 // over the loop. See ECMA-262 version 5, section 12.6.4. 1104 // over the loop. See ECMA-262 version 5, section 12.6.4.
1105 SetExpressionPosition(stmt->enumerable());
1105 VisitForAccumulatorValue(stmt->enumerable()); 1106 VisitForAccumulatorValue(stmt->enumerable());
1106 __ mov(a0, result_register()); // Result as param to InvokeBuiltin below. 1107 __ mov(a0, result_register()); // Result as param to InvokeBuiltin below.
1107 __ LoadRoot(at, Heap::kUndefinedValueRootIndex); 1108 __ LoadRoot(at, Heap::kUndefinedValueRootIndex);
1108 __ Branch(&exit, eq, a0, Operand(at)); 1109 __ Branch(&exit, eq, a0, Operand(at));
1109 Register null_value = t1; 1110 Register null_value = t1;
1110 __ LoadRoot(null_value, Heap::kNullValueRootIndex); 1111 __ LoadRoot(null_value, Heap::kNullValueRootIndex);
1111 __ Branch(&exit, eq, a0, Operand(null_value)); 1112 __ Branch(&exit, eq, a0, Operand(null_value));
1112 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG); 1113 PrepareForBailoutForId(stmt->PrepareId(), TOS_REG);
1113 __ mov(a0, v0); 1114 __ mov(a0, v0);
1114 // Convert the object to a JS object. 1115 // Convert the object to a JS object.
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION); 1237 __ InvokeBuiltin(Builtins::FILTER_KEY, CALL_FUNCTION);
1237 __ mov(a3, result_register()); 1238 __ mov(a3, result_register());
1238 __ Branch(loop_statement.continue_label(), eq, a3, Operand(zero_reg)); 1239 __ Branch(loop_statement.continue_label(), eq, a3, Operand(zero_reg));
1239 1240
1240 // Update the 'each' property or variable from the possibly filtered 1241 // Update the 'each' property or variable from the possibly filtered
1241 // entry in register a3. 1242 // entry in register a3.
1242 __ bind(&update_each); 1243 __ bind(&update_each);
1243 __ mov(result_register(), a3); 1244 __ mov(result_register(), a3);
1244 // Perform the assignment as if via '='. 1245 // Perform the assignment as if via '='.
1245 { EffectContext context(this); 1246 { EffectContext context(this);
1247 SetExpressionPosition(stmt->each());
1246 EmitAssignment(stmt->each()); 1248 EmitAssignment(stmt->each());
1247 } 1249 }
1248 1250
1249 // Generate code for the body of the loop. 1251 // Generate code for the body of the loop.
1250 Visit(stmt->body()); 1252 Visit(stmt->body());
1251 1253
1252 // Generate code for the going to the next element by incrementing 1254 // Generate code for the going to the next element by incrementing
1253 // the index (smi) stored on top of the stack. 1255 // the index (smi) stored on top of the stack.
1254 __ bind(loop_statement.continue_label()); 1256 __ bind(loop_statement.continue_label());
1255 __ pop(a0); 1257 __ pop(a0);
1256 __ Addu(a0, a0, Operand(Smi::FromInt(1))); 1258 __ Addu(a0, a0, Operand(Smi::FromInt(1)));
1257 __ push(a0); 1259 __ push(a0);
1258 1260
1259 EmitBackEdgeBookkeeping(stmt, &loop); 1261 EmitBackEdgeBookkeeping(stmt, &loop);
1260 __ Branch(&loop); 1262 __ Branch(&loop);
1261 1263
1262 // Remove the pointers stored on the stack. 1264 // Remove the pointers stored on the stack.
1263 __ bind(loop_statement.break_label()); 1265 __ bind(loop_statement.break_label());
1264 __ Drop(5); 1266 __ Drop(5);
1265 1267
1266 // Exit and decrement the loop depth. 1268 // Exit and decrement the loop depth.
1267 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); 1269 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
1268 __ bind(&exit); 1270 __ bind(&exit);
1269 decrement_loop_depth(); 1271 decrement_loop_depth();
1270 } 1272 }
1271 1273
1272 1274
1273 void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) {
1274 Comment cmnt(masm_, "[ ForOfStatement");
1275 SetStatementPosition(stmt);
1276
1277 Iteration loop_statement(this, stmt);
1278 increment_loop_depth();
1279
1280 // var iterator = iterable[Symbol.iterator]();
1281 VisitForEffect(stmt->assign_iterator());
1282
1283 // Loop entry.
1284 __ bind(loop_statement.continue_label());
1285
1286 // result = iterator.next()
1287 VisitForEffect(stmt->next_result());
1288
1289 // if (result.done) break;
1290 Label result_not_done;
1291 VisitForControl(stmt->result_done(),
1292 loop_statement.break_label(),
1293 &result_not_done,
1294 &result_not_done);
1295 __ bind(&result_not_done);
1296
1297 // each = result.value
1298 VisitForEffect(stmt->assign_each());
1299
1300 // Generate code for the body of the loop.
1301 Visit(stmt->body());
1302
1303 // Check stack before looping.
1304 PrepareForBailoutForId(stmt->BackEdgeId(), NO_REGISTERS);
1305 EmitBackEdgeBookkeeping(stmt, loop_statement.continue_label());
1306 __ jmp(loop_statement.continue_label());
1307
1308 // Exit and decrement the loop depth.
1309 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
1310 __ bind(loop_statement.break_label());
1311 decrement_loop_depth();
1312 }
1313
1314
1315 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, 1275 void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info,
1316 bool pretenure) { 1276 bool pretenure) {
1317 // Use the fast case closure allocation code that allocates in new 1277 // Use the fast case closure allocation code that allocates in new
1318 // space for nested functions that don't need literals cloning. If 1278 // space for nested functions that don't need literals cloning. If
1319 // we're running with the --always-opt or the --prepare-always-opt 1279 // we're running with the --always-opt or the --prepare-always-opt
1320 // flag, we need to use the runtime function so that the new function 1280 // flag, we need to use the runtime function so that the new function
1321 // we are creating here gets a chance to have its code optimized and 1281 // we are creating here gets a chance to have its code optimized and
1322 // doesn't just get a copy of the existing unoptimized code. 1282 // doesn't just get a copy of the existing unoptimized code.
1323 if (!FLAG_always_opt && 1283 if (!FLAG_always_opt &&
1324 !FLAG_prepare_always_opt && 1284 !FLAG_prepare_always_opt &&
(...skipping 3954 matching lines...) Expand 10 before | Expand all | Expand 10 after
5279 Assembler::target_address_at(pc_immediate_load_address)) == 5239 Assembler::target_address_at(pc_immediate_load_address)) ==
5280 reinterpret_cast<uint32_t>( 5240 reinterpret_cast<uint32_t>(
5281 isolate->builtins()->OsrAfterStackCheck()->entry())); 5241 isolate->builtins()->OsrAfterStackCheck()->entry()));
5282 return OSR_AFTER_STACK_CHECK; 5242 return OSR_AFTER_STACK_CHECK;
5283 } 5243 }
5284 5244
5285 5245
5286 } } // namespace v8::internal 5246 } } // namespace v8::internal
5287 5247
5288 #endif // V8_TARGET_ARCH_MIPS 5248 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/mips64/full-codegen-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698