From: m.m.capewell@googlemail.com Date: Thu, 24 Apr 2014 17:20:34 +0000 (+0000) Subject: ARM64: slightly modify weight for profiling counter X-Git-Tag: upstream/4.7.83~9441 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0fc9354a1f8de0edca2fd82307a354c0afa34eb6;p=platform%2Fupstream%2Fv8.git ARM64: slightly modify weight for profiling counter BUG= R=ulan@chromium.org, bmeurer@chromium.org Review URL: https://codereview.chromium.org/252443004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20952 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/arm64/full-codegen-arm64.cc b/src/arm64/full-codegen-arm64.cc index 97e8067..2099fde 100644 --- a/src/arm64/full-codegen-arm64.cc +++ b/src/arm64/full-codegen-arm64.cc @@ -391,7 +391,12 @@ void FullCodeGenerator::EmitBackEdgeBookkeeping(IterationStatement* stmt, Label ok; ASSERT(back_edge_target->is_bound()); - int distance = masm_->SizeOfCodeGeneratedSince(back_edge_target); + // We want to do a round rather than a floor of distance/kCodeSizeMultiplier + // to reduce the absolute error due to the integer division. To do that, + // we add kCodeSizeMultiplier/2 to the distance (equivalent to adding 0.5 to + // the result). + int distance = + masm_->SizeOfCodeGeneratedSince(back_edge_target) + kCodeSizeMultiplier / 2; int weight = Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier)); EmitProfilingCounterDecrement(weight); @@ -434,7 +439,7 @@ void FullCodeGenerator::EmitReturnSequence() { if (info_->ShouldSelfOptimize()) { weight = FLAG_interrupt_budget / FLAG_self_opt_count; } else { - int distance = masm_->pc_offset(); + int distance = masm_->pc_offset() + kCodeSizeMultiplier / 2; weight = Min(kMaxBackEdgeWeight, Max(1, distance / kCodeSizeMultiplier)); }