Index: src/mips64/code-stubs-mips64.cc |
diff --git a/src/mips64/code-stubs-mips64.cc b/src/mips64/code-stubs-mips64.cc |
index 5994c25567fca82a0dabdf7ea1d788ef1bfc190f..c0b8b694583c4b6cceedecd28ed0df3ca7285b78 100644 |
--- a/src/mips64/code-stubs-mips64.cc |
+++ b/src/mips64/code-stubs-mips64.cc |
@@ -1911,6 +1911,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// a2 : feedback vector |
// a3 : 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()); |
@@ -1930,7 +1931,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
Register feedback_map = a6; |
Register weak_value = t0; |
__ ld(weak_value, FieldMemOperand(a5, WeakCell::kValueOffset)); |
- __ Branch(&done, eq, a1, Operand(weak_value)); |
+ __ Branch(&done_increment_count, eq, a1, Operand(weak_value)); |
__ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); |
__ Branch(&done, eq, a5, Operand(at)); |
__ ld(feedback_map, FieldMemOperand(a5, HeapObject::kMapOffset)); |
@@ -1952,7 +1953,7 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// Make sure the function is the Array() function |
__ LoadNativeContextSlot(Context::ARRAY_FUNCTION_INDEX, a5); |
__ Branch(&megamorphic, ne, a1, Operand(a5)); |
- __ jmp(&done); |
+ __ jmp(&done_increment_count); |
__ bind(&miss); |
@@ -1980,12 +1981,31 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// slot. |
CreateAllocationSiteStub create_stub(masm->isolate()); |
CallStubInRecordCallTarget(masm, &create_stub); |
- __ Branch(&done); |
+ __ Branch(&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. |
+ |
+ __ dsrl(a4, a3, 32 - kPointerSizeLog2); |
+ __ Daddu(a4, a2, Operand(a4)); |
+ __ li(a5, Operand(Smi::FromInt(1))); |
+ __ sd(a5, FieldMemOperand(a4, FixedArray::kHeaderSize + kPointerSize)); |
+ __ bind(&done); |
+ |
+ __ bind(&done_increment_count); |
+ |
+ // Increment the call count for monomorphic function calls. |
+ __ dsrl(a4, a3, 32 - kPointerSizeLog2); |
+ __ Daddu(a5, a2, Operand(a4)); |
+ __ ld(a4, FieldMemOperand(a5, FixedArray::kHeaderSize + kPointerSize)); |
+ __ Daddu(a4, a4, Operand(Smi::FromInt(1))); |
+ __ sd(a4, FieldMemOperand(a5, FixedArray::kHeaderSize + kPointerSize)); |
+ |
__ bind(&done); |
} |