Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index b9e60a54e127b7811f2a5f11c2538c3a4072efe9..0fa8be6869cece6aac3588dc684d76e078e6f5fa 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -2286,6 +2286,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// r2 : feedback vector |
// r3 : 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()); |
@@ -2305,7 +2306,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
Register weak_value = r9; |
__ ldr(weak_value, FieldMemOperand(r5, WeakCell::kValueOffset)); |
__ cmp(r1, weak_value); |
- __ b(eq, &done); |
+ __ b(eq, &done_increment_count); |
__ CompareRoot(r5, Heap::kmegamorphic_symbolRootIndex); |
__ b(eq, &done); |
__ ldr(feedback_map, FieldMemOperand(r5, HeapObject::kMapOffset)); |
@@ -2328,7 +2329,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
__ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r5); |
__ cmp(r1, r5); |
__ b(ne, &megamorphic); |
- __ jmp(&done); |
+ __ jmp(&done_increment_count); |
__ bind(&miss); |
@@ -2347,6 +2348,11 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// An uninitialized cache is patched with the function |
__ bind(&initialize); |
+ // Initialize the call counter. |
+ __ Move(r5, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
+ __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
+ __ str(r5, FieldMemOperand(r4, FixedArray::kHeaderSize + kPointerSize)); |
+ |
// Make sure the function is the Array() function |
__ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r5); |
__ cmp(r1, r5); |
@@ -2362,11 +2368,20 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
__ bind(¬_array_function); |
CreateWeakCellStub weak_cell_stub(masm->isolate()); |
CallStubInRecordCallTarget(masm, &weak_cell_stub); |
+ __ b(&done); |
+ |
+ __ bind(&done_increment_count); |
+ __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
+ __ add(r4, r4, Operand(FixedArray::kHeaderSize + kPointerSize)); |
+ __ ldr(r5, FieldMemOperand(r4, 0)); |
+ __ add(r5, r5, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
+ __ str(r5, FieldMemOperand(r4, 0)); |
+ |
__ bind(&done); |
} |
-void CallConstructStub::Generate(MacroAssembler* masm) { |
+void ConstructICStub::Generate(MacroAssembler* masm) { |
// r0 : number of arguments |
// r1 : the function to call |
// r2 : feedback vector |