Index: src/ppc/code-stubs-ppc.cc |
diff --git a/src/ppc/code-stubs-ppc.cc b/src/ppc/code-stubs-ppc.cc |
index 8797bce7b4df46fc5b162bc278d65194dfb0f995..edee7942bbe45705bf207bfb7318d70237fdd1c0 100644 |
--- a/src/ppc/code-stubs-ppc.cc |
+++ b/src/ppc/code-stubs-ppc.cc |
@@ -1849,12 +1849,15 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// r5 : feedback vector |
// r6 : 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()); |
DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), |
masm->isolate()->heap()->uninitialized_symbol()); |
+ const int count_offset = FixedArray::kHeaderSize + kPointerSize; |
+ |
// Load the cache state into r8. |
__ SmiToPtrArrayOffset(r8, r6); |
__ add(r8, r5, r8); |
@@ -1869,7 +1872,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
Register weak_value = r10; |
__ LoadP(weak_value, FieldMemOperand(r8, WeakCell::kValueOffset)); |
__ cmp(r4, weak_value); |
- __ beq(&done); |
+ __ beq(&done_increment_count); |
__ CompareRoot(r8, Heap::kmegamorphic_symbolRootIndex); |
__ beq(&done); |
__ LoadP(feedback_map, FieldMemOperand(r8, HeapObject::kMapOffset)); |
@@ -1892,7 +1895,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
__ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, r8); |
__ cmp(r4, r8); |
__ bne(&megamorphic); |
- __ b(&done); |
+ __ b(&done_increment_count); |
__ bind(&miss); |
@@ -1922,12 +1925,31 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// slot. |
CreateAllocationSiteStub create_stub(masm->isolate()); |
CallStubInRecordCallTarget(masm, &create_stub); |
- __ b(&done); |
+ __ b(&done_initialize_count); |
__ bind(¬_array_function); |
CreateWeakCellStub weak_cell_stub(masm->isolate()); |
CallStubInRecordCallTarget(masm, &weak_cell_stub); |
+ |
+ __ bind(&done_initialize_count); |
+ // Initialize the call counter. |
+ __ LoadSmiLiteral(r8, Smi::FromInt(1)); |
+ __ SmiToPtrArrayOffset(r7, r6); |
+ __ add(r7, r5, r7); |
+ __ StoreP(r8, FieldMemOperand(r7, count_offset), r0); |
+ __ b(&done); |
+ |
+ __ bind(&done_increment_count); |
+ |
+ // Increment the call count for monomorphic function calls. |
+ __ SmiToPtrArrayOffset(r8, r6); |
+ __ add(r8, r5, r8); |
+ |
+ __ LoadP(r7, FieldMemOperand(r8, count_offset)); |
+ __ AddSmiLiteral(r7, r7, Smi::FromInt(1), r0); |
+ __ StoreP(r7, FieldMemOperand(r8, count_offset), r0); |
+ |
__ bind(&done); |
} |