PPC/s390: [Interpreter] Collect type feedback for 'new' in the bytecode handler

Port 7e5b8feed3

Original commit message:

    Collect type feedback in the bytecode handler for 'new' bytecode. The
    earlier cl (https://codereview.chromium.org/2153433002/) was reverted
    because that implementation did not collect allocation site feedback.
    This regressed delta blue by an order of magnitude. This implementation
    includes collection of allocation site feedback.

    Reland of https://codereview.chromium.org/2190293003/ with a bug fix.

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/2302343002
Cr-Commit-Position: refs/heads/master@{#39138}
This commit is contained in:
bjaideep 2016-09-02 07:55:01 -07:00 committed by Commit bot
parent d9a026e628
commit 1d2ab6e0bd
4 changed files with 49 additions and 12 deletions

View File

@ -1213,6 +1213,7 @@ void Builtins::Generate_InterpreterPushArgsAndCallImpl(
// Calculate number of arguments (add one for receiver).
__ addi(r6, r3, Operand(1));
// TODO(mythria): Add a stack check before pushing arguments.
// Push the arguments.
Generate_InterpreterPushArgs(masm, r5, r6, r7);
@ -1230,12 +1231,14 @@ void Builtins::Generate_InterpreterPushArgsAndCallImpl(
}
// static
void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
void Builtins::Generate_InterpreterPushArgsAndConstructImpl(
MacroAssembler* masm, CallableType construct_type) {
// ----------- S t a t e -------------
// -- r3 : argument count (not including receiver)
// -- r6 : new target
// -- r4 : constructor to call
// -- r5 : address of the first argument
// -- r5 : allocation site feedback if available, undefined otherwise.
// -- r7 : address of the first argument
// -----------------------------------
// Push a slot for the receiver to be constructed.
@ -1246,11 +1249,26 @@ void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
Label skip;
__ cmpi(r3, Operand::Zero());
__ beq(&skip);
Generate_InterpreterPushArgs(masm, r5, r3, r7);
Generate_InterpreterPushArgs(masm, r7, r3, r8);
__ bind(&skip);
// Call the constructor with r3, r4, and r6 unmodified.
__ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
__ AssertUndefinedOrAllocationSite(r5, r8);
if (construct_type == CallableType::kJSFunction) {
__ AssertFunction(r4);
// Tail call to the function-specific construct stub (still in the caller
// context at this point).
__ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
__ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset));
// Jump to the construct function.
__ addi(ip, r7, Operand(Code::kHeaderSize - kHeapObjectTag));
__ Jump(ip);
} else {
DCHECK_EQ(construct_type, CallableType::kAny);
// Call the constructor with r3, r4, and r6 unmodified.
__ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
}
}
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {

View File

@ -1236,12 +1236,14 @@ void Builtins::Generate_InterpreterPushArgsAndCallImpl(
}
// static
void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
void Builtins::Generate_InterpreterPushArgsAndConstructImpl(
MacroAssembler* masm, CallableType construct_type) {
// ----------- S t a t e -------------
// -- r2 : argument count (not including receiver)
// -- r5 : new target
// -- r3 : constructor to call
// -- r4 : address of the first argument
// -- r4 : allocation site feedback if available, undefined otherwise.
// -- r6 : address of the first argument
// -----------------------------------
// Push a slot for the receiver to be constructed.
@ -1252,11 +1254,26 @@ void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) {
Label skip;
__ CmpP(r2, Operand::Zero());
__ beq(&skip);
Generate_InterpreterPushArgs(masm, r4, r2, r6);
Generate_InterpreterPushArgs(masm, r6, r2, r7);
__ bind(&skip);
// Call the constructor with r2, r3, and r5 unmodified.
__ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
__ AssertUndefinedOrAllocationSite(r4, r7);
if (construct_type == CallableType::kJSFunction) {
__ AssertFunction(r3);
// Tail call to the function-specific construct stub (still in the caller
// context at this point).
__ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset));
__ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kConstructStubOffset));
// Jump to the construct function.
__ AddP(ip, r6, Operand(Code::kHeaderSize - kHeapObjectTag));
__ Jump(ip);
} else {
DCHECK_EQ(construct_type, CallableType::kAny);
// Call the constructor with r2, r3, and r5 unmodified.
__ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CODE_TARGET);
}
}
void Builtins::Generate_InterpreterEnterBytecodeDispatch(MacroAssembler* masm) {

View File

@ -390,7 +390,8 @@ void InterpreterPushArgsAndConstructDescriptor::InitializePlatformSpecific(
r3, // argument count (not including receiver)
r6, // new target
r4, // constructor to call
r5 // address of the first argument
r5, // allocation site feedback if available, undefined otherwise
r7 // address of the first argument
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}

View File

@ -359,7 +359,8 @@ void InterpreterPushArgsAndConstructDescriptor::InitializePlatformSpecific(
r2, // argument count (not including receiver)
r5, // new target
r3, // constructor to call
r4 // address of the first argument
r4, // allocation site feedback if available, undefined otherwise
r6 // address of the first argument
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}