Index: src/ia32/full-codegen-ia32.cc |
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
index 4d4f788d10b71f9a497192d5e948d6910b7c6aac..672b46bb2568859538118bc11e82d28c74f877d1 100644 |
--- a/src/ia32/full-codegen-ia32.cc |
+++ b/src/ia32/full-codegen-ia32.cc |
@@ -383,9 +383,14 @@ void FullCodeGenerator::EmitReturnSequence() { |
__ CallRuntime(Runtime::kTraceExit, 1); |
} |
// Pretend that the exit is a backwards jump to the entry. |
- int distance = masm_->pc_offset(); |
- int weight = |
- Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier)); |
+ int weight = 1; |
+ if (info_->ShouldSelfOptimize()) { |
+ weight = FLAG_interrupt_budget / FLAG_self_opt_count; |
+ } else { |
+ int distance = masm_->pc_offset(); |
+ weight = Min(kMaxBackEdgeWeight, |
+ Max(1, distance / kCodeSizeMultiplier)); |
+ } |
EmitProfilingCounterDecrement(weight); |
Label ok; |
__ j(positive, &ok, Label::kNear); |