Commit fb10f8fa authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: [runtime] Introduce FastNewStrictArgumentsStub to optimize strict arguments.

Port 09d84535

Original commit message:
    The FastNewStrictArgumentsStub is very similar to the recently added
    FastNewRestParameterStub, it's actually almost a copy of it, except that
    it doesn't have the fast case we have for the empty rest parameter. This
    patch improves strict arguments in TurboFan and fullcodegen by up to 10x
    compared to the previous version.

    Also introduce proper JSSloppyArgumentsObject and JSStrictArgumentsObject
    for the in-object properties instead of having them as constants in the
    Heap class.

    Drive-by-fix: Use this stub and the FastNewRestParameterStub in the
    interpreter to avoid the runtime call overhead for strict arguments
    and rest parameter creation.

R=bmeurer@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=

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

Cr-Commit-Position: refs/heads/master@{#33963}
parent c8257c4c
......@@ -276,28 +276,32 @@ void FullCodeGenerator::Generate() {
if (arguments != NULL) {
// Function uses arguments object.
Comment cmnt(masm_, "[ Allocate arguments object");
DCHECK(r4.is(ArgumentsAccessNewDescriptor::function()));
if (!function_in_register_r4) {
// Load this again, if it's used by the local context below.
__ LoadP(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
}
// Receiver is just before the parameters on the caller's stack.
int num_parameters = info->scope()->num_parameters();
int offset = num_parameters * kPointerSize;
__ LoadSmiLiteral(ArgumentsAccessNewDescriptor::parameter_count(),
Smi::FromInt(num_parameters));
__ addi(ArgumentsAccessNewDescriptor::parameter_pointer(), fp,
Operand(StandardFrameConstants::kCallerSPOffset + offset));
// Arguments to ArgumentsAccessStub:
// function, parameter pointer, parameter count.
// The stub will rewrite parameter pointer and parameter count if the
// previous stack frame was an arguments adapter frame.
bool is_unmapped = is_strict(language_mode()) || !has_simple_parameters();
ArgumentsAccessStub::Type type = ArgumentsAccessStub::ComputeType(
is_unmapped, literal()->has_duplicate_parameters());
ArgumentsAccessStub stub(isolate(), type);
__ CallStub(&stub);
if (is_strict(language_mode()) || !has_simple_parameters()) {
FastNewStrictArgumentsStub stub(isolate());
__ CallStub(&stub);
} else {
DCHECK(r4.is(ArgumentsAccessNewDescriptor::function()));
// Receiver is just before the parameters on the caller's stack.
int num_parameters = info->scope()->num_parameters();
int offset = num_parameters * kPointerSize;
__ LoadSmiLiteral(ArgumentsAccessNewDescriptor::parameter_count(),
Smi::FromInt(num_parameters));
__ addi(ArgumentsAccessNewDescriptor::parameter_pointer(), fp,
Operand(StandardFrameConstants::kCallerSPOffset + offset));
// Arguments to ArgumentsAccessStub:
// function, parameter pointer, parameter count.
// The stub will rewrite parameter pointer and parameter count if the
// previous stack frame was an arguments adapter frame.
ArgumentsAccessStub::Type type = ArgumentsAccessStub::ComputeType(
literal()->has_duplicate_parameters());
ArgumentsAccessStub stub(isolate(), type);
__ CallStub(&stub);
}
SetVar(arguments, r3, r4, r5);
}
......
......@@ -1988,9 +1988,7 @@ void Builtins::Generate_Apply(MacroAssembler* masm) {
// Try to create the list from an arguments object.
__ bind(&create_arguments);
__ LoadP(r5, FieldMemOperand(
r3, JSObject::kHeaderSize +
Heap::kArgumentsLengthIndex * kPointerSize));
__ LoadP(r5, FieldMemOperand(r3, JSArgumentsObject::kLengthOffset));
__ LoadP(r7, FieldMemOperand(r3, JSObject::kElementsOffset));
__ LoadP(ip, FieldMemOperand(r7, FixedArray::kLengthOffset));
__ cmp(r5, ip);
......
This diff is collapsed.
......@@ -93,6 +93,11 @@ void FastNewRestParameterDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastNewStrictArgumentsDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {r4};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ToNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
......
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