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

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

Powered by Google App Engine
This is Rietveld 408576698