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

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

Issue 9432026: Profiler experiments: interrupt check at function exit (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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/flag-definitions.h ('k') | no next file » | 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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt, 326 void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt,
327 Label* back_edge_target) { 327 Label* back_edge_target) {
328 Comment cmnt(masm_, "[ Stack check"); 328 Comment cmnt(masm_, "[ Stack check");
329 Label ok; 329 Label ok;
330 330
331 if (FLAG_count_based_interrupts) { 331 if (FLAG_count_based_interrupts) {
332 int weight = 1; 332 int weight = 1;
333 if (FLAG_weighted_back_edges) { 333 if (FLAG_weighted_back_edges) {
334 ASSERT(back_edge_target->is_bound()); 334 ASSERT(back_edge_target->is_bound());
335 int distance = masm_->pc_offset() - back_edge_target->pos(); 335 int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target);
336 weight = Min(127, Max(1, distance / 100)); 336 weight = Min(127, Max(1, distance / 100));
337 } 337 }
338 __ sub(Operand::Cell(profiling_counter_), Immediate(Smi::FromInt(weight))); 338 __ sub(Operand::Cell(profiling_counter_), Immediate(Smi::FromInt(weight)));
339 __ j(positive, &ok, Label::kNear); 339 __ j(positive, &ok, Label::kNear);
340 InterruptStub stub; 340 InterruptStub stub;
341 __ CallStub(&stub); 341 __ CallStub(&stub);
342 } else { 342 } else {
343 // Count based interrupts happen often enough when they are enabled 343 // Count based interrupts happen often enough when they are enabled
344 // that the additional stack checks are not necessary (they would 344 // that the additional stack checks are not necessary (they would
345 // only check for interrupts). 345 // only check for interrupts).
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 Comment cmnt(masm_, "[ Return sequence"); 382 Comment cmnt(masm_, "[ Return sequence");
383 if (return_label_.is_bound()) { 383 if (return_label_.is_bound()) {
384 __ jmp(&return_label_); 384 __ jmp(&return_label_);
385 } else { 385 } else {
386 // Common return label 386 // Common return label
387 __ bind(&return_label_); 387 __ bind(&return_label_);
388 if (FLAG_trace) { 388 if (FLAG_trace) {
389 __ push(eax); 389 __ push(eax);
390 __ CallRuntime(Runtime::kTraceExit, 1); 390 __ CallRuntime(Runtime::kTraceExit, 1);
391 } 391 }
392 if (FLAG_interrupt_at_exit) {
393 // Pretend that the exit is a backwards jump to the entry.
394 int weight = 1;
395 if (FLAG_weighted_back_edges) {
396 int distance = masm_->pc_offset();
397 weight = Min(127, Max(1, distance / 100));
398 }
399 __ sub(Operand::Cell(profiling_counter_),
400 Immediate(Smi::FromInt(weight)));
401 Label ok;
402 __ j(positive, &ok, Label::kNear);
403 __ push(eax);
404 InterruptStub stub;
405 __ CallStub(&stub);
406 __ pop(eax);
407 // Reset the countdown.
408 __ mov(Operand::Cell(profiling_counter_),
409 Immediate(Smi::FromInt(FLAG_interrupt_budget)));
410 __ bind(&ok);
411 }
392 #ifdef DEBUG 412 #ifdef DEBUG
393 // Add a label for checking the size of the code used for returning. 413 // Add a label for checking the size of the code used for returning.
394 Label check_exit_codesize; 414 Label check_exit_codesize;
395 masm_->bind(&check_exit_codesize); 415 masm_->bind(&check_exit_codesize);
396 #endif 416 #endif
397 SetSourcePosition(function()->end_position() - 1); 417 SetSourcePosition(function()->end_position() - 1);
398 __ RecordJSReturn(); 418 __ RecordJSReturn();
399 // Do not use the leave instruction here because it is too short to 419 // Do not use the leave instruction here because it is too short to
400 // patch with the code required by the debugger. 420 // patch with the code required by the debugger.
401 __ mov(esp, ebp); 421 __ mov(esp, ebp);
(...skipping 4035 matching lines...) Expand 10 before | Expand all | Expand 10 after
4437 *context_length = 0; 4457 *context_length = 0;
4438 return previous_; 4458 return previous_;
4439 } 4459 }
4440 4460
4441 4461
4442 #undef __ 4462 #undef __
4443 4463
4444 } } // namespace v8::internal 4464 } } // namespace v8::internal
4445 4465
4446 #endif // V8_TARGET_ARCH_IA32 4466 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698