Index: src/arm64/code-stubs-arm64.cc |
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc |
index a96b3dfa9833285d67ebdb60384c6c533680e735..081e32dc3d89d3b17d1a9ebb75dfcb07adae8cba 100644 |
--- a/src/arm64/code-stubs-arm64.cc |
+++ b/src/arm64/code-stubs-arm64.cc |
@@ -2022,6 +2022,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()); |
@@ -2044,7 +2045,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)); |
@@ -2066,7 +2067,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); |
@@ -2097,12 +2098,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); |
} |