Index: src/x64/full-codegen-x64.cc |
diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
index b752e2cd751ab3dad04ae3acbe13c60e46839392..ac31cfda545d0bd8e80ac8627056cf2e14d92f81 100644 |
--- a/src/x64/full-codegen-x64.cc |
+++ b/src/x64/full-codegen-x64.cc |
@@ -386,9 +386,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); |