Index: src/arm64/code-stubs-arm64.cc |
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc |
index 3e28e38923e4ca8a745935185f67deb16a447acf..67ab1641dee186dadbb1a89d3ad66efc3a7f2def 100644 |
--- a/src/arm64/code-stubs-arm64.cc |
+++ b/src/arm64/code-stubs-arm64.cc |
@@ -2644,6 +2644,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_increment_count; |
DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()), |
masm->isolate()->heap()->megamorphic_symbol()); |
@@ -2666,7 +2667,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)); |
@@ -2688,7 +2689,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); |
@@ -2708,6 +2709,13 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, Register argc, |
// indicate the ElementsKind if function is the Array constructor. |
__ Bind(&initialize); |
+ // Initialize the call counter. |
+ __ Mov(scratch1, Smi::FromInt(ConstructICNexus::kCallCountIncrement)); |
+ __ Adds(scratch2, feedback_vector, |
+ Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
+ __ Str(scratch1, |
+ FieldMemOperand(scratch2, FixedArray::kHeaderSize + kPointerSize)); |
+ |
// Make sure the function is the Array() function |
__ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, scratch1); |
__ Cmp(function, scratch1); |
@@ -2725,11 +2733,23 @@ static void GenerateRecordCallTarget(MacroAssembler* masm, Register argc, |
CreateWeakCellStub weak_cell_stub(masm->isolate()); |
CallStubInRecordCallTarget(masm, &weak_cell_stub, argc, function, |
feedback_vector, index, new_target); |
+ __ B(&done); |
+ |
+ __ bind(&done_increment_count); |
+ __ Adds(scratch2, feedback_vector, |
+ Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
+ __ Ldr(scratch1, |
+ FieldMemOperand(scratch2, FixedArray::kHeaderSize + kPointerSize)); |
+ __ Add(scratch1, scratch1, |
+ Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
+ __ Str(scratch1, |
+ FieldMemOperand(scratch2, FixedArray::kHeaderSize + kPointerSize)); |
+ |
__ Bind(&done); |
} |
-void CallConstructStub::Generate(MacroAssembler* masm) { |
+void ConstructICStub::Generate(MacroAssembler* masm) { |
ASM_LOCATION("CallConstructStub::Generate"); |
// x0 : number of arguments |
// x1 : the function to call |