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

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

Issue 11437016: Use count-based profiling exclusively. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed review comments Created 8 years 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/arm/deoptimizer-arm.cc ('k') | src/execution.h » ('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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 if (isolate()->IsDebuggerActive()) { 340 if (isolate()->IsDebuggerActive()) {
341 // Detect debug break requests as soon as possible. 341 // Detect debug break requests as soon as possible.
342 reset_value = FLAG_interrupt_budget >> 4; 342 reset_value = FLAG_interrupt_budget >> 4;
343 } 343 }
344 __ mov(r2, Operand(profiling_counter_)); 344 __ mov(r2, Operand(profiling_counter_));
345 __ mov(r3, Operand(Smi::FromInt(reset_value))); 345 __ mov(r3, Operand(Smi::FromInt(reset_value)));
346 __ str(r3, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset)); 346 __ str(r3, FieldMemOperand(r2, JSGlobalPropertyCell::kValueOffset));
347 } 347 }
348 348
349 349
350 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt, 350 void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt,
351 Label* back_edge_target) { 351 Label* back_edge_target) {
352 Comment cmnt(masm_, "[ Stack check"); 352 Comment cmnt(masm_, "[ Back edge bookkeeping");
353 // Block literal pools whilst emitting stack check code. 353 // Block literal pools whilst emitting stack check code.
354 Assembler::BlockConstPoolScope block_const_pool(masm_); 354 Assembler::BlockConstPoolScope block_const_pool(masm_);
355 Label ok; 355 Label ok;
356 356
357 if (FLAG_count_based_interrupts) { 357 int weight = 1;
358 int weight = 1; 358 if (FLAG_weighted_back_edges) {
359 if (FLAG_weighted_back_edges) { 359 ASSERT(back_edge_target->is_bound());
360 ASSERT(back_edge_target->is_bound()); 360 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target);
361 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); 361 weight = Min(kMaxBackEdgeWeight,
362 weight = Min(kMaxBackEdgeWeight, 362 Max(1, distance / kBackEdgeDistanceUnit));
363 Max(1, distance / kBackEdgeDistanceUnit));
364 }
365 EmitProfilingCounterDecrement(weight);
366 __ b(pl, &ok);
367 InterruptStub stub;
368 __ CallStub(&stub);
369 } else {
370 __ LoadRoot(ip, Heap::kStackLimitRootIndex);
371 __ cmp(sp, Operand(ip));
372 __ b(hs, &ok);
373 PredictableCodeSizeScope predictable(masm_, 2 * Assembler::kInstrSize);
374 StackCheckStub stub;
375 __ CallStub(&stub);
376 } 363 }
364 EmitProfilingCounterDecrement(weight);
365 __ b(pl, &ok);
366 InterruptStub stub;
367 __ CallStub(&stub);
377 368
378 // Record a mapping of this PC offset to the OSR id. This is used to find 369 // Record a mapping of this PC offset to the OSR id. This is used to find
379 // the AST id from the unoptimized code in order to use it as a key into 370 // the AST id from the unoptimized code in order to use it as a key into
380 // the deoptimization input data found in the optimized code. 371 // the deoptimization input data found in the optimized code.
381 RecordStackCheck(stmt->OsrEntryId()); 372 RecordBackEdge(stmt->OsrEntryId());
382 373
383 if (FLAG_count_based_interrupts) { 374 EmitProfilingCounterReset();
384 EmitProfilingCounterReset();
385 }
386 375
387 __ bind(&ok); 376 __ bind(&ok);
388 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); 377 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
389 // Record a mapping of the OSR id to this PC. This is used if the OSR 378 // Record a mapping of the OSR id to this PC. This is used if the OSR
390 // entry becomes the target of a bailout. We don't expect it to be, but 379 // entry becomes the target of a bailout. We don't expect it to be, but
391 // we want it to work if it is. 380 // we want it to work if it is.
392 PrepareForBailoutForId(stmt->OsrEntryId(), NO_REGISTERS); 381 PrepareForBailoutForId(stmt->OsrEntryId(), NO_REGISTERS);
393 } 382 }
394 383
395 384
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 // Generate code for the body of the loop. 1233 // Generate code for the body of the loop.
1245 Visit(stmt->body()); 1234 Visit(stmt->body());
1246 1235
1247 // Generate code for the going to the next element by incrementing 1236 // Generate code for the going to the next element by incrementing
1248 // the index (smi) stored on top of the stack. 1237 // the index (smi) stored on top of the stack.
1249 __ bind(loop_statement.continue_label()); 1238 __ bind(loop_statement.continue_label());
1250 __ pop(r0); 1239 __ pop(r0);
1251 __ add(r0, r0, Operand(Smi::FromInt(1))); 1240 __ add(r0, r0, Operand(Smi::FromInt(1)));
1252 __ push(r0); 1241 __ push(r0);
1253 1242
1254 EmitStackCheck(stmt, &loop); 1243 EmitBackEdgeBookkeeping(stmt, &loop);
1255 __ b(&loop); 1244 __ b(&loop);
1256 1245
1257 // Remove the pointers stored on the stack. 1246 // Remove the pointers stored on the stack.
1258 __ bind(loop_statement.break_label()); 1247 __ bind(loop_statement.break_label());
1259 __ Drop(5); 1248 __ Drop(5);
1260 1249
1261 // Exit and decrement the loop depth. 1250 // Exit and decrement the loop depth.
1262 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); 1251 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
1263 __ bind(&exit); 1252 __ bind(&exit);
1264 decrement_loop_depth(); 1253 decrement_loop_depth();
(...skipping 3299 matching lines...) Expand 10 before | Expand all | Expand 10 after
4564 *context_length = 0; 4553 *context_length = 0;
4565 return previous_; 4554 return previous_;
4566 } 4555 }
4567 4556
4568 4557
4569 #undef __ 4558 #undef __
4570 4559
4571 } } // namespace v8::internal 4560 } } // namespace v8::internal
4572 4561
4573 #endif // V8_TARGET_ARCH_ARM 4562 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/deoptimizer-arm.cc ('k') | src/execution.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698