Introduce a kTieredHotnessMask.
To be used by the baseline compiler for when to trigger optimized
compilation. Before we were using the nterp threshold, but there may be
a need to have different ones.
Test: test.py
Bug: 112676029
Change-Id: I98e97ad8cfa50a6546c927960fad1567263a7354
diff --git a/compiler/optimizing/code_generator_arm64.cc b/compiler/optimizing/code_generator_arm64.cc
index b8f4011..ced16fb 100644
--- a/compiler/optimizing/code_generator_arm64.cc
+++ b/compiler/optimizing/code_generator_arm64.cc
@@ -30,6 +30,7 @@
#include "gc/accounting/card_table.h"
#include "gc/space/image_space.h"
#include "heap_poisoning.h"
+#include "interpreter/mterp/nterp.h"
#include "intrinsics.h"
#include "intrinsics_arm64.h"
#include "linker/linker_patch.h"
@@ -1153,9 +1154,9 @@
__ Mov(temp, address);
__ Ldrh(counter, MemOperand(temp, ProfilingInfo::BaselineHotnessCountOffset().Int32Value()));
__ Add(counter, counter, 1);
+ __ And(counter, counter, interpreter::kTieredHotnessMask);
__ Strh(counter, MemOperand(temp, ProfilingInfo::BaselineHotnessCountOffset().Int32Value()));
- __ Tst(counter, 0xffff);
- __ B(ne, &done);
+ __ Cbnz(counter, &done);
if (is_frame_entry) {
if (HasEmptyFrame()) {
// The entrypoint expects the method at the bottom of the stack. We
diff --git a/compiler/optimizing/code_generator_x86_64.cc b/compiler/optimizing/code_generator_x86_64.cc
index 37265ec..0ed982a 100644
--- a/compiler/optimizing/code_generator_x86_64.cc
+++ b/compiler/optimizing/code_generator_x86_64.cc
@@ -25,6 +25,7 @@
#include "gc/accounting/card_table.h"
#include "gc/space/image_space.h"
#include "heap_poisoning.h"
+#include "interpreter/mterp/nterp.h"
#include "intrinsics.h"
#include "intrinsics_x86_64.h"
#include "jit/profiling_info.h"
@@ -1425,7 +1426,9 @@
__ movq(CpuRegister(TMP), Immediate(address));
__ addw(Address(CpuRegister(TMP), ProfilingInfo::BaselineHotnessCountOffset().Int32Value()),
Immediate(1));
- __ j(kCarryClear, &done);
+ __ andw(Address(CpuRegister(TMP), ProfilingInfo::BaselineHotnessCountOffset().Int32Value()),
+ Immediate(interpreter::kTieredHotnessMask));
+ __ j(kNotZero, &done);
if (HasEmptyFrame()) {
CHECK(is_frame_entry);
// Frame alignment, and the stub expects the method on the stack.