Commit 232bbb1b authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [stubs] Refactor the CallICStub to pass the number of arguments.

  port c15c5827 (r40206)

  original commit message:
  This is the next step to unify the Call/Construct feedback collection
  and prepare it to be able to collect SharedFunctionInfo feedback. This
  also reduces the CallICStub overhead quite a bit since we only need one
  stub per mode (and tail call mode), not also one per call arity.

BUG=

Review-Url: https://codereview.chromium.org/2409953005
Cr-Commit-Position: refs/heads/master@{#40244}
parent d1d2addb
...@@ -2274,10 +2274,10 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) { ...@@ -2274,10 +2274,10 @@ void FullCodeGenerator::EmitCall(Call* expr, ConvertReceiverMode mode) {
EmitProfilingCounterHandlingForReturnSequence(true); EmitProfilingCounterHandlingForReturnSequence(true);
} }
Handle<Code> code = Handle<Code> code =
CodeFactory::CallIC(isolate(), arg_count, mode, expr->tail_call_mode()) CodeFactory::CallIC(isolate(), mode, expr->tail_call_mode()).code();
.code();
__ Move(edx, Immediate(SmiFromSlot(expr->CallFeedbackICSlot()))); __ Move(edx, Immediate(SmiFromSlot(expr->CallFeedbackICSlot())));
__ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
__ Move(eax, Immediate(arg_count));
__ call(code, RelocInfo::CODE_TARGET); __ call(code, RelocInfo::CODE_TARGET);
OperandStackDepthDecrement(arg_count + 1); OperandStackDepthDecrement(arg_count + 1);
......
...@@ -1258,6 +1258,7 @@ static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector, ...@@ -1258,6 +1258,7 @@ static void IncrementCallCount(MacroAssembler* masm, Register feedback_vector,
} }
void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
// eax - number of arguments
// edi - function // edi - function
// edx - slot id // edx - slot id
// ebx - vector // ebx - vector
...@@ -1265,7 +1266,6 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { ...@@ -1265,7 +1266,6 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
__ cmp(edi, ecx); __ cmp(edi, ecx);
__ j(not_equal, miss); __ j(not_equal, miss);
__ mov(eax, arg_count());
// Reload ecx. // Reload ecx.
__ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size,
FixedArray::kHeaderSize)); FixedArray::kHeaderSize));
...@@ -1283,13 +1283,12 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) { ...@@ -1283,13 +1283,12 @@ void CallICStub::HandleArrayCase(MacroAssembler* masm, Label* miss) {
void CallICStub::Generate(MacroAssembler* masm) { void CallICStub::Generate(MacroAssembler* masm) {
// edi - number of arguments
// edi - function // edi - function
// edx - slot id // edx - slot id
// ebx - vector // ebx - vector
Isolate* isolate = masm->isolate(); Isolate* isolate = masm->isolate();
Label extra_checks_or_miss, call, call_function, call_count_incremented; Label extra_checks_or_miss, call, call_function, call_count_incremented;
int argc = arg_count();
ParameterCount actual(argc);
// The checks. First, does edi match the recorded monomorphic target? // The checks. First, does edi match the recorded monomorphic target?
__ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size,
...@@ -1321,7 +1320,6 @@ void CallICStub::Generate(MacroAssembler* masm) { ...@@ -1321,7 +1320,6 @@ void CallICStub::Generate(MacroAssembler* masm) {
// Increment the call count for monomorphic function calls. // Increment the call count for monomorphic function calls.
IncrementCallCount(masm, ebx, edx); IncrementCallCount(masm, ebx, edx);
__ Set(eax, argc);
__ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(), __ Jump(masm->isolate()->builtins()->CallFunction(convert_mode(),
tail_call_mode()), tail_call_mode()),
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
...@@ -1367,7 +1365,6 @@ void CallICStub::Generate(MacroAssembler* masm) { ...@@ -1367,7 +1365,6 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ bind(&call_count_incremented); __ bind(&call_count_incremented);
__ Set(eax, argc);
__ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()), __ Jump(masm->isolate()->builtins()->Call(convert_mode(), tail_call_mode()),
RelocInfo::CODE_TARGET); RelocInfo::CODE_TARGET);
...@@ -1393,12 +1390,15 @@ void CallICStub::Generate(MacroAssembler* masm) { ...@@ -1393,12 +1390,15 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ j(not_equal, &miss); __ j(not_equal, &miss);
// Store the function. Use a stub since we need a frame for allocation. // Store the function. Use a stub since we need a frame for allocation.
// eax - number of arguments
// ebx - vector // ebx - vector
// edx - slot // edx - slot
// edi - function // edi - function
{ {
FrameScope scope(masm, StackFrame::INTERNAL); FrameScope scope(masm, StackFrame::INTERNAL);
CreateWeakCellStub create_stub(isolate); CreateWeakCellStub create_stub(isolate);
__ SmiTag(eax);
__ push(eax);
__ push(ebx); __ push(ebx);
__ push(edx); __ push(edx);
__ push(edi); __ push(edi);
...@@ -1408,6 +1408,8 @@ void CallICStub::Generate(MacroAssembler* masm) { ...@@ -1408,6 +1408,8 @@ void CallICStub::Generate(MacroAssembler* masm) {
__ pop(edi); __ pop(edi);
__ pop(edx); __ pop(edx);
__ pop(ebx); __ pop(ebx);
__ pop(eax);
__ SmiUntag(eax);
} }
__ jmp(&call_function); __ jmp(&call_function);
...@@ -1427,6 +1429,10 @@ void CallICStub::Generate(MacroAssembler* masm) { ...@@ -1427,6 +1429,10 @@ void CallICStub::Generate(MacroAssembler* masm) {
void CallICStub::GenerateMiss(MacroAssembler* masm) { void CallICStub::GenerateMiss(MacroAssembler* masm) {
FrameScope scope(masm, StackFrame::INTERNAL); FrameScope scope(masm, StackFrame::INTERNAL);
// Preserve the number of arguments.
__ SmiTag(eax);
__ push(eax);
// Push the function and feedback info. // Push the function and feedback info.
__ push(edi); __ push(edi);
__ push(ebx); __ push(ebx);
...@@ -1437,6 +1443,10 @@ void CallICStub::GenerateMiss(MacroAssembler* masm) { ...@@ -1437,6 +1443,10 @@ void CallICStub::GenerateMiss(MacroAssembler* masm) {
// Move result to edi and exit the internal frame. // Move result to edi and exit the internal frame.
__ mov(edi, eax); __ mov(edi, eax);
// Restore number of arguments.
__ pop(eax);
__ SmiUntag(eax);
} }
......
...@@ -153,7 +153,7 @@ void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific( ...@@ -153,7 +153,7 @@ void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific( void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {edi, edx, ebx}; Register registers[] = {edi, eax, edx, ebx};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment