| Index: src/arm64/code-stubs-arm64.cc
|
| diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc
|
| index 9b3778e7854afd8742ff0e3ff05808c0d2a649ac..d28f9afa887ba7428f2766972a660ae771c21ef1 100644
|
| --- a/src/arm64/code-stubs-arm64.cc
|
| +++ b/src/arm64/code-stubs-arm64.cc
|
| @@ -1995,6 +1995,17 @@ void CallConstructStub::Generate(MacroAssembler* masm) {
|
| __ Jump(isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
|
| }
|
|
|
| +// Note: feedback_vector and slot are clobbered after the call.
|
| +static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector,
|
| + Register slot) {
|
| + __ Add(feedback_vector, feedback_vector,
|
| + Operand::UntagSmiAndScale(slot, kPointerSizeLog2));
|
| + __ Add(feedback_vector, feedback_vector,
|
| + Operand(FixedArray::kHeaderSize + kPointerSize));
|
| + __ Ldr(slot, FieldMemOperand(feedback_vector, 0));
|
| + __ Add(slot, slot, Operand(Smi::FromInt(1)));
|
| + __ Str(slot, FieldMemOperand(feedback_vector, 0));
|
| +}
|
|
|
| void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
|
| // x1 - function
|
| @@ -2014,13 +2025,7 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
|
| __ Mov(x0, Operand(arg_count()));
|
|
|
| // 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(1)));
|
| - __ Str(index, FieldMemOperand(feedback_vector, 0));
|
| + IncrementCallCount(masm, feedback_vector, index);
|
|
|
| // Set up arguments for the array constructor stub.
|
| Register allocation_site_arg = feedback_vector;
|
| @@ -2038,7 +2043,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
|
| // x1 - function
|
| // x3 - slot id (Smi)
|
| // x2 - vector
|
| - Label extra_checks_or_miss, call, call_function;
|
| + Label extra_checks_or_miss, call, call_function, call_count_incremented;
|
| int argc = arg_count();
|
| ParameterCount actual(argc);
|
|
|
| @@ -2073,16 +2078,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
|
| // convincing us that we have a monomorphic JSFunction.
|
| __ JumpIfSmi(function, &extra_checks_or_miss);
|
|
|
| + __ Bind(&call_function);
|
| +
|
| // 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(1)));
|
| - __ Str(index, FieldMemOperand(feedback_vector, 0));
|
| + IncrementCallCount(masm, feedback_vector, index);
|
|
|
| - __ Bind(&call_function);
|
| __ Mov(x0, argc);
|
| __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(),
|
| tail_call_mode()),
|
| @@ -2106,6 +2106,7 @@ void CallICStub::Generate(MacroAssembler* masm) {
|
| __ jmp(&miss);
|
| }
|
|
|
| + // TODO(mvstanton): the code below is effectively disabled. Investigate.
|
| __ JumpIfRoot(x4, Heap::kuninitialized_symbolRootIndex, &miss);
|
|
|
| // We are going megamorphic. If the feedback is a JSFunction, it is fine
|
| @@ -2118,6 +2119,11 @@ void CallICStub::Generate(MacroAssembler* masm) {
|
| __ Str(x5, FieldMemOperand(x4, FixedArray::kHeaderSize));
|
|
|
| __ Bind(&call);
|
| +
|
| + // Increment the call count for megamorphic function calls.
|
| + IncrementCallCount(masm, feedback_vector, index);
|
| +
|
| + __ Bind(&call_count_incremented);
|
| __ Mov(x0, argc);
|
| __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()),
|
| RelocInfo::CODE_TARGET);
|
| @@ -2143,12 +2149,6 @@ void CallICStub::Generate(MacroAssembler* masm) {
|
| __ Cmp(x4, x5);
|
| __ B(ne, &miss);
|
|
|
| - // Initialize the call counter.
|
| - __ Mov(x5, Smi::FromInt(1));
|
| - __ 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
|
| @@ -2156,9 +2156,13 @@ void CallICStub::Generate(MacroAssembler* masm) {
|
| {
|
| FrameScope scope(masm, StackFrame::INTERNAL);
|
| CreateWeakCellStub create_stub(masm->isolate());
|
| + __ Push(feedback_vector, index);
|
| +
|
| __ Push(cp, function);
|
| __ CallStub(&create_stub);
|
| __ Pop(cp, function);
|
| +
|
| + __ Pop(feedback_vector, index);
|
| }
|
|
|
| __ B(&call_function);
|
| @@ -2168,7 +2172,8 @@ void CallICStub::Generate(MacroAssembler* masm) {
|
| __ bind(&miss);
|
| GenerateMiss(masm);
|
|
|
| - __ B(&call);
|
| + // The runtime increments the call count in the vector for us.
|
| + __ B(&call_count_incremented);
|
| }
|
|
|
|
|
|
|