Commit 62896e48 authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

PPC/s390: Reland "[runtime] Remove the construct_stub field of the SFI"

Port b158bfdc

Original Commit Message:

    This is a reland of 63ecddc8

    Original change's description:
    > [runtime] Remove the construct_stub field of the SFI
    >
    > Don't dispatch based on the construct_stub field anymore. Rather than
    > read it out and jump to the construct stub, we can switch on the
    > builtin_id.
    >
    > Builtins will always have builtin_id as a Smi, so this signals we need
    > to jump to JSBuiltinsConstructStub. The only exception is for uncompiled
    > functions, which will have kCompileLazy as the builtin_id, but need to
    > jump to the generic stub instead.
    >
    > API function calls will have a FunctionTemplateInfo in the SFI
    > function_data field, and need to go to the builtins stub as well.
    >
    > The final case is everything else, which should go to the generic stub.
    >
    > Bug: v8:7503
    > Change-Id: I14790a5f9784dc0d940bf10a05f5310026e1d482
    > Reviewed-on: https://chromium-review.googlesource.com/980941
    > Reviewed-by: Leszek Swirski <leszeks@chromium.org>
    > Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
    > Commit-Queue: Peter Marshall <petermarshall@chromium.org>
    > Cr-Commit-Position: refs/heads/master@{#52345}

R=petermarshall@chromium.org, joransiu@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=
LOG=N

Change-Id: I53d92ea7326c5a0ffec25eef0972cdeb659848b6
Reviewed-on: https://chromium-review.googlesource.com/998018Reviewed-by: 's avatarJoran Siu <joransiu@ca.ibm.com>
Reviewed-by: 's avatarPeter Marshall <petermarshall@chromium.org>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#52449}
parent e4a72d8b
......@@ -2333,12 +2333,21 @@ void Builtins::Generate_ConstructFunction(MacroAssembler* masm) {
// r5 to contain either an AllocationSite or undefined.
__ LoadRoot(r5, Heap::kUndefinedValueRootIndex);
// Tail call to the function-specific construct stub (still in the caller
// context at this point).
Label call_generic_stub;
// Jump to JSBuiltinsConstructStub or JSConstructStubGeneric.
__ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
__ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kConstructStubOffset));
__ addi(ip, r7, Operand(Code::kHeaderSize - kHeapObjectTag));
__ JumpToJSEntry(ip);
__ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kFlagsOffset));
__ mov(ip, Operand(SharedFunctionInfo::ConstructAsBuiltinBit::kMask));
__ and_(r7, r7, ip, SetRC);
__ beq(&call_generic_stub, cr0);
__ Jump(BUILTIN_CODE(masm->isolate(), JSBuiltinsConstructStub),
RelocInfo::CODE_TARGET);
__ bind(&call_generic_stub);
__ Jump(masm->isolate()->builtins()->JSConstructStubGeneric(),
RelocInfo::CODE_TARGET);
}
// static
......
......@@ -2339,12 +2339,20 @@ void Builtins::Generate_ConstructFunction(MacroAssembler* masm) {
// r4 to contain either an AllocationSite or undefined.
__ LoadRoot(r4, Heap::kUndefinedValueRootIndex);
// Tail call to the function-specific construct stub (still in the caller
// context at this point).
Label call_generic_stub;
// Jump to JSBuiltinsConstructStub or JSConstructStubGeneric.
__ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset));
__ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kConstructStubOffset));
__ AddP(ip, r6, Operand(Code::kHeaderSize - kHeapObjectTag));
__ JumpToJSEntry(ip);
__ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kFlagsOffset));
__ AndP(r6, Operand(SharedFunctionInfo::ConstructAsBuiltinBit::kMask));
__ beq(&call_generic_stub);
__ Jump(BUILTIN_CODE(masm->isolate(), JSBuiltinsConstructStub),
RelocInfo::CODE_TARGET);
__ bind(&call_generic_stub);
__ Jump(masm->isolate()->builtins()->JSConstructStubGeneric(),
RelocInfo::CODE_TARGET);
}
// static
......
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