Index: src/arm64/code-stubs-arm64.cc |
diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc |
index 622d12ebca5f32e29b981038f59bcaaebe2df9ba..676079153f37ef56ae6b3473905056acb638e4ed 100644 |
--- a/src/arm64/code-stubs-arm64.cc |
+++ b/src/arm64/code-stubs-arm64.cc |
@@ -3091,10 +3091,18 @@ void CallIC_ArrayStub::Generate(MacroAssembler* masm) { |
__ Ldr(map, FieldMemOperand(scratch, HeapObject::kMapOffset)); |
__ JumpIfNotRoot(map, Heap::kAllocationSiteMapRootIndex, &miss); |
+ // Increment the call count for monomorphic function calls. |
+ __ Add(feedback_vector, feedback_vector, |
+ Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
+ __ Add(feedback_vector, feedback_vector, |
+ Operand(FixedArray::kHeaderSize + kPointerSize)); |
+ __ Ldr(index, FieldMemOperand(feedback_vector, 0)); |
+ __ Add(index, index, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
+ __ Str(index, FieldMemOperand(feedback_vector, 0)); |
+ |
Register allocation_site = feedback_vector; |
+ Register original_constructor = index; |
__ Mov(allocation_site, scratch); |
- |
- Register original_constructor = x3; |
__ Mov(original_constructor, function); |
ArrayConstructorStub stub(masm->isolate(), arg_count()); |
__ TailCallStub(&stub); |
@@ -3160,6 +3168,15 @@ void CallICStub::Generate(MacroAssembler* masm) { |
// convincing us that we have a monomorphic JSFunction. |
__ JumpIfSmi(function, &extra_checks_or_miss); |
+ // Increment the call count for monomorphic function calls. |
+ __ Add(feedback_vector, feedback_vector, |
+ Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
+ __ Add(feedback_vector, feedback_vector, |
+ Operand(FixedArray::kHeaderSize + kPointerSize)); |
+ __ Ldr(index, FieldMemOperand(feedback_vector, 0)); |
+ __ Add(index, index, Operand(Smi::FromInt(CallICNexus::kCallCountIncrement))); |
+ __ Str(index, FieldMemOperand(feedback_vector, 0)); |
+ |
__ bind(&have_js_function); |
if (CallAsMethod()) { |
EmitContinueIfStrictOrNative(masm, &cont); |
@@ -3235,6 +3252,12 @@ void CallICStub::Generate(MacroAssembler* masm) { |
__ Adds(x4, x4, Operand(Smi::FromInt(1))); |
__ Str(x4, FieldMemOperand(feedback_vector, with_types_offset)); |
+ // Initialize the call counter. |
+ __ Mov(x5, Smi::FromInt(CallICNexus::kCallCountIncrement)); |
+ __ Adds(x4, feedback_vector, |
+ Operand::UntagSmiAndScale(index, kPointerSizeLog2)); |
+ __ Str(x5, FieldMemOperand(x4, FixedArray::kHeaderSize + kPointerSize)); |
+ |
// Store the function. Use a stub since we need a frame for allocation. |
// x2 - vector |
// x3 - slot |