Commit 050b7923 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: Use register arguments for RestParamAccessStub.

  port 82ca2a41(r33084)

  original commit message:
  This is preferable because in TurboFan we need to call it, and can't pass
  untagged external pointers on the stack.

BUG=

Review URL: https://codereview.chromium.org/1557283002

Cr-Commit-Position: refs/heads/master@{#33102}
parent 7fdb0da0
...@@ -260,11 +260,14 @@ void FullCodeGenerator::Generate() { ...@@ -260,11 +260,14 @@ void FullCodeGenerator::Generate() {
int num_parameters = info->scope()->num_parameters(); int num_parameters = info->scope()->num_parameters();
int offset = num_parameters * kPointerSize; int offset = num_parameters * kPointerSize;
__ lea(edx, Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset)); __ mov(RestParamAccessDescriptor::parameter_count(),
__ push(edx); Immediate(Smi::FromInt(num_parameters)));
__ push(Immediate(Smi::FromInt(num_parameters))); __ lea(RestParamAccessDescriptor::parameter_pointer(),
__ push(Immediate(Smi::FromInt(rest_index))); Operand(ebp, StandardFrameConstants::kCallerSPOffset + offset));
__ push(Immediate(Smi::FromInt(language_mode()))); __ mov(RestParamAccessDescriptor::rest_parameter_index(),
Immediate(Smi::FromInt(rest_index)));
__ mov(RestParamAccessDescriptor::language_mode(),
Immediate(Smi::FromInt(language_mode())));
function_in_register = false; function_in_register = false;
RestParamAccessStub stub(isolate()); RestParamAccessStub stub(isolate());
......
...@@ -854,27 +854,32 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) { ...@@ -854,27 +854,32 @@ void ArgumentsAccessStub::GenerateNewStrict(MacroAssembler* masm) {
void RestParamAccessStub::GenerateNew(MacroAssembler* masm) { void RestParamAccessStub::GenerateNew(MacroAssembler* masm) {
// ecx : number of parameters (tagged)
// edx : parameters pointer
// ebx : rest parameter index (tagged)
// edi : language mode (tagged)
// esp[0] : return address // esp[0] : return address
// esp[4] : language mode
// esp[8] : index of rest parameter
// esp[12] : number of parameters
// esp[16] : receiver displacement
// Check if the calling frame is an arguments adaptor frame. // Check if the calling frame is an arguments adaptor frame.
Label runtime; Label runtime;
__ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset)); __ mov(eax, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
__ mov(ecx, Operand(edx, StandardFrameConstants::kContextOffset)); __ mov(eax, Operand(eax, StandardFrameConstants::kContextOffset));
__ cmp(ecx, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); __ cmp(eax, Immediate(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
__ j(not_equal, &runtime); __ j(not_equal, &runtime);
// Patch the arguments.length and the parameters pointer. // Patch the arguments.length and the parameters pointer.
__ mov(edx, Operand(ebp, StandardFrameConstants::kCallerFPOffset));
__ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset)); __ mov(ecx, Operand(edx, ArgumentsAdaptorFrameConstants::kLengthOffset));
__ mov(Operand(esp, 3 * kPointerSize), ecx);
__ lea(edx, __ lea(edx,
Operand(edx, ecx, times_2, StandardFrameConstants::kCallerSPOffset)); Operand(edx, ecx, times_2, StandardFrameConstants::kCallerSPOffset));
__ mov(Operand(esp, 4 * kPointerSize), edx);
__ bind(&runtime); __ bind(&runtime);
__ pop(eax); // Save return address.
__ push(ecx); // Push number of parameters.
__ push(edx); // Push parameters pointer.
__ push(ebx); // Push rest parameter index.
__ push(edi); // Push language mode.
__ push(eax); // Push return address.
__ TailCallRuntime(Runtime::kNewRestParam); __ TailCallRuntime(Runtime::kNewRestParam);
} }
......
...@@ -67,6 +67,11 @@ const Register ArgumentsAccessNewDescriptor::function() { return edi; } ...@@ -67,6 +67,11 @@ const Register ArgumentsAccessNewDescriptor::function() { return edi; }
const Register ArgumentsAccessNewDescriptor::parameter_count() { return ecx; } const Register ArgumentsAccessNewDescriptor::parameter_count() { return ecx; }
const Register ArgumentsAccessNewDescriptor::parameter_pointer() { return edx; } const Register ArgumentsAccessNewDescriptor::parameter_pointer() { return edx; }
const Register RestParamAccessDescriptor::parameter_count() { return ecx; }
const Register RestParamAccessDescriptor::parameter_pointer() { return edx; }
const Register RestParamAccessDescriptor::rest_parameter_index() { return ebx; }
const Register RestParamAccessDescriptor::language_mode() { return edi; }
const Register ApiGetterDescriptor::function_address() { return edx; } const Register ApiGetterDescriptor::function_address() { return edx; }
......
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