Commit 05652917 authored by bjaideep's avatar bjaideep Committed by Commit bot

PPC/s390: [Interpreter] Collect allocation site feedback in call bytecode handler.

Port 9a31162d

Original commit message:

    Adds support to collect allocation site feedback for Array function calls
    to the call bytecode handler.

R=mythria@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com

BUG=v8:4280, v8:4780
LOG=N

Review-Url: https://codereview.chromium.org/2319913004
Cr-Commit-Position: refs/heads/master@{#39298}
parent 5a4cbaed
...@@ -1187,8 +1187,10 @@ void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { ...@@ -1187,8 +1187,10 @@ void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) {
__ blr(); __ blr();
} }
static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, static void Generate_InterpreterPushArgs(MacroAssembler* masm,
Register num_args, Register index,
Register count, Register scratch) { Register count, Register scratch) {
// TODO(mythria): Add a stack check before pushing arguments.
Label loop; Label loop;
__ addi(index, index, Operand(kPointerSize)); // Bias up for LoadPU __ addi(index, index, Operand(kPointerSize)); // Bias up for LoadPU
__ mtctr(count); __ mtctr(count);
...@@ -1214,8 +1216,8 @@ void Builtins::Generate_InterpreterPushArgsAndCallImpl( ...@@ -1214,8 +1216,8 @@ void Builtins::Generate_InterpreterPushArgsAndCallImpl(
__ addi(r6, r3, Operand(1)); __ addi(r6, r3, Operand(1));
// TODO(mythria): Add a stack check before pushing arguments. // TODO(mythria): Add a stack check before pushing arguments.
// Push the arguments. // Push the arguments. r5, r6, r7 will be modified.
Generate_InterpreterPushArgs(masm, r5, r6, r7); Generate_InterpreterPushArgs(masm, r6, r5, r6, r7);
// Call the target. // Call the target.
if (function_type == CallableType::kJSFunction) { if (function_type == CallableType::kJSFunction) {
...@@ -1249,7 +1251,8 @@ void Builtins::Generate_InterpreterPushArgsAndConstructImpl( ...@@ -1249,7 +1251,8 @@ void Builtins::Generate_InterpreterPushArgsAndConstructImpl(
Label skip; Label skip;
__ cmpi(r3, Operand::Zero()); __ cmpi(r3, Operand::Zero());
__ beq(&skip); __ beq(&skip);
Generate_InterpreterPushArgs(masm, r7, r3, r8); // Push the arguments. r8, r7, r9 will be modified.
Generate_InterpreterPushArgs(masm, r3, r7, r3, r8);
__ bind(&skip); __ bind(&skip);
__ AssertUndefinedOrAllocationSite(r5, r8); __ AssertUndefinedOrAllocationSite(r5, r8);
...@@ -1271,6 +1274,29 @@ void Builtins::Generate_InterpreterPushArgsAndConstructImpl( ...@@ -1271,6 +1274,29 @@ void Builtins::Generate_InterpreterPushArgsAndConstructImpl(
} }
} }
// static
void Builtins::Generate_InterpreterPushArgsAndConstructArray(
MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r3 : argument count (not including receiver)
// -- r4 : target to call verified to be Array function
// -- r5 : allocation site feedback if available, undefined otherwise.
// -- r6 : address of the first argument
// -----------------------------------
__ addi(r7, r3, Operand(1)); // Add one for receiver.
// TODO(mythria): Add a stack check before pushing arguments.
// Push the arguments. r6, r8, r3 will be modified.
Generate_InterpreterPushArgs(masm, r7, r6, r7, r8);
// Array constructor expects constructor in r6. It is same as r4 here.
__ mr(r6, r4);
ArrayConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
}
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
// Set the return address to the correct point in the interpreter entry // Set the return address to the correct point in the interpreter entry
// trampoline. // trampoline.
......
...@@ -1191,8 +1191,10 @@ void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { ...@@ -1191,8 +1191,10 @@ void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) {
__ Ret(); __ Ret();
} }
static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, static void Generate_InterpreterPushArgs(MacroAssembler* masm,
Register num_args, Register index,
Register count, Register scratch) { Register count, Register scratch) {
// TODO(mythria): Add a stack check before pushing arguments.
Label loop; Label loop;
__ AddP(index, index, Operand(kPointerSize)); // Bias up for LoadPU __ AddP(index, index, Operand(kPointerSize)); // Bias up for LoadPU
__ LoadRR(r0, count); __ LoadRR(r0, count);
...@@ -1220,7 +1222,7 @@ void Builtins::Generate_InterpreterPushArgsAndCallImpl( ...@@ -1220,7 +1222,7 @@ void Builtins::Generate_InterpreterPushArgsAndCallImpl(
__ AddP(r5, r2, Operand(1)); __ AddP(r5, r2, Operand(1));
// Push the arguments. // Push the arguments.
Generate_InterpreterPushArgs(masm, r4, r5, r6); Generate_InterpreterPushArgs(masm, r5, r4, r5, r6);
// Call the target. // Call the target.
if (function_type == CallableType::kJSFunction) { if (function_type == CallableType::kJSFunction) {
...@@ -1254,7 +1256,7 @@ void Builtins::Generate_InterpreterPushArgsAndConstructImpl( ...@@ -1254,7 +1256,7 @@ void Builtins::Generate_InterpreterPushArgsAndConstructImpl(
Label skip; Label skip;
__ CmpP(r2, Operand::Zero()); __ CmpP(r2, Operand::Zero());
__ beq(&skip); __ beq(&skip);
Generate_InterpreterPushArgs(masm, r6, r2, r7); Generate_InterpreterPushArgs(masm, r2, r6, r2, r7);
__ bind(&skip); __ bind(&skip);
__ AssertUndefinedOrAllocationSite(r4, r7); __ AssertUndefinedOrAllocationSite(r4, r7);
...@@ -1276,6 +1278,29 @@ void Builtins::Generate_InterpreterPushArgsAndConstructImpl( ...@@ -1276,6 +1278,29 @@ void Builtins::Generate_InterpreterPushArgsAndConstructImpl(
} }
} }
// static
void Builtins::Generate_InterpreterPushArgsAndConstructArray(
MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r2 : argument count (not including receiver)
// -- r3 : target to call verified to be Array function
// -- r4 : allocation site feedback if available, undefined otherwise.
// -- r5 : address of the first argument
// -----------------------------------
__ AddP(r6, r2, Operand(1)); // Add one for receiver.
// TODO(mythria): Add a stack check before pushing arguments.
// Push the arguments. r6, r8, r3 will be modified.
Generate_InterpreterPushArgs(masm, r6, r5, r6, r7);
// Array constructor expects constructor in r5. It is same as r3 here.
__ LoadRR(r5, r3);
ArrayConstructorStub stub(masm->isolate());
__ TailCallStub(&stub);
}
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) { void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {
// Set the return address to the correct point in the interpreter entry // Set the return address to the correct point in the interpreter entry
// trampoline. // trampoline.
......
...@@ -396,6 +396,17 @@ void InterpreterPushArgsAndConstructDescriptor::InitializePlatformSpecific( ...@@ -396,6 +396,17 @@ void InterpreterPushArgsAndConstructDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void InterpreterPushArgsAndConstructArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r3, // argument count (not including receiver)
r4, // target to call checked to be Array function
r5, // allocation site feedback if available, undefined otherwise
r6 // address of the first argument
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InterpreterCEntryDescriptor::InitializePlatformSpecific( void InterpreterCEntryDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = { Register registers[] = {
......
...@@ -365,6 +365,17 @@ void InterpreterPushArgsAndConstructDescriptor::InitializePlatformSpecific( ...@@ -365,6 +365,17 @@ void InterpreterPushArgsAndConstructDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void InterpreterPushArgsAndConstructArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r2, // argument count (not including receiver)
r3, // target to call checked to be Array function
r4, // allocation site feedback if available, undefined otherwise
r5 // address of the first argument
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InterpreterCEntryDescriptor::InitializePlatformSpecific( void InterpreterCEntryDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = { Register 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