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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/flag-definitions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/full-codegen-ia32.cc
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc
index 98c80cdb4c9fa9bf16530f7706cfc1eb4cc2e565..f5c1521eb9e512f1314c7ac8479a359b05a1da3b 100644
--- a/src/ia32/full-codegen-ia32.cc
+++ b/src/ia32/full-codegen-ia32.cc
@@ -332,7 +332,7 @@ void FullCodeGenerator::EmitStackCheck(IterationStatement* stmt,
int weight = 1;
if (FLAG_weighted_back_edges) {
ASSERT(back_edge_target->is_bound());
- int distance = masm_->pc_offset() - back_edge_target->pos();
+ int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target);
weight = Min(127, Max(1, distance / 100));
}
__ sub(Operand::Cell(profiling_counter_), Immediate(Smi::FromInt(weight)));
@@ -389,6 +389,26 @@ void FullCodeGenerator::EmitReturnSequence() {
__ push(eax);
__ CallRuntime(Runtime::kTraceExit, 1);
}
+ if (FLAG_interrupt_at_exit) {
+ // Pretend that the exit is a backwards jump to the entry.
+ int weight = 1;
+ if (FLAG_weighted_back_edges) {
+ int distance = masm_->pc_offset();
+ weight = Min(127, Max(1, distance / 100));
+ }
+ __ sub(Operand::Cell(profiling_counter_),
+ Immediate(Smi::FromInt(weight)));
+ Label ok;
+ __ j(positive, &ok, Label::kNear);
+ __ push(eax);
+ InterruptStub stub;
+ __ CallStub(&stub);
+ __ pop(eax);
+ // Reset the countdown.
+ __ mov(Operand::Cell(profiling_counter_),
+ Immediate(Smi::FromInt(FLAG_interrupt_budget)));
+ __ bind(&ok);
+ }
#ifdef DEBUG
// Add a label for checking the size of the code used for returning.
Label check_exit_codesize;
« 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