Index: src/arm64/code-stubs-arm64.cc |
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc |
index a076f79fae79ddbbcfa808eca0f39ac3710e2c6f..d55d2c1a524c5ee223907d90ccbd2127061d1941 100644 |
--- a/src/arm64/code-stubs-arm64.cc |
+++ b/src/arm64/code-stubs-arm64.cc |
@@ -2010,6 +2010,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, Register argc, |
// feedback_vector : the feedback vector |
// index : slot in feedback vector (smi) |
Label initialize, done, miss, megamorphic, not_array_function; |
+ Label done_initialize_count, done_increment_count; |
DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()), |
masm->isolate()->heap()->megamorphic_symbol()); |
@@ -2032,7 +2033,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, Register argc, |
Label check_allocation_site; |
__ Ldr(feedback_value, FieldMemOperand(feedback, WeakCell::kValueOffset)); |
__ Cmp(function, feedback_value); |
- __ B(eq, &done); |
+ __ B(eq, &done_increment_count); |
__ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); |
__ B(eq, &done); |
__ Ldr(feedback_map, FieldMemOperand(feedback, HeapObject::kMapOffset)); |
@@ -2054,7 +2055,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, Register argc, |
__ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, scratch1); |
__ Cmp(function, scratch1); |
__ B(ne, &megamorphic); |
- __ B(&done); |
+ __ B(&done_increment_count); |
__ Bind(&miss); |
@@ -2085,12 +2086,32 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, Register argc, |
CreateAllocationSiteStub create_stub(masm->isolate()); |
CallStubInRecordCallTarget(masm, &create_stub, argc, function, |
feedback_vector, index, new_target); |
- __ B(&done); |
+ __ B(&done_initialize_count); |
__ Bind(¬_array_function); |
CreateWeakCellStub weak_cell_stub(masm->isolate()); |
CallStubInRecordCallTarget(masm, &weak_cell_stub, argc, function, |
feedback_vector, index, new_target); |
+ |
+ __ bind(&done_initialize_count); |
+ // Initialize the call counter. |
+ __ Mov(scratch1, Operand(Smi::FromInt(1))); |
+ __ Adds(scratch2, feedback_vector, |
+ Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
+ __ Str(scratch1, |
+ FieldMemOperand(scratch2, FixedArray::kHeaderSize + kPointerSize)); |
+ __ b(&done); |
+ |
+ __ bind(&done_increment_count); |
+ |
+ // Increment the call count for monomorphic function calls. |
+ __ Add(scratch1, feedback_vector, |
+ Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
+ __ Add(scratch1, scratch1, Operand(FixedArray::kHeaderSize + kPointerSize)); |
+ __ Ldr(scratch2, FieldMemOperand(scratch1, 0)); |
+ __ Add(scratch2, scratch2, Operand(Smi::FromInt(1))); |
+ __ Str(scratch2, FieldMemOperand(scratch1, 0)); |
+ |
__ Bind(&done); |
} |