Commit d483edb5 authored by Junliang Yan's avatar Junliang Yan Committed by Commit Bot

PPC/s390: [stubs] Route all ArrayConstructor stub accesses through CodeFactory

Port 0a373f8a

Original Commit Message:

    This is the initial step towards moving all array constructor stubs to
    builtins.

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

Change-Id: I3b46a3bd91780c2be938f710ceb18a7a8cd1824e
Reviewed-on: https://chromium-review.googlesource.com/1076595Reviewed-by: 's avatarJoran Siu <joransiu@ca.ibm.com>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#53423}
parent 3d52841d
......@@ -3071,20 +3071,23 @@ void Builtins::Generate_MathPowInternal(MacroAssembler* masm) {
namespace {
template <class T>
static void CreateArrayDispatch(MacroAssembler* masm,
AllocationSiteOverrideMode mode) {
void CreateArrayDispatchNoArgument(MacroAssembler* masm,
AllocationSiteOverrideMode mode) {
if (mode == DISABLE_ALLOCATION_SITES) {
T stub(masm->isolate(), GetInitialFastElementsKind(), mode);
__ TailCallStub(&stub);
__ Jump(CodeFactory::ArrayNoArgumentConstructor(
masm->isolate(), GetInitialFastElementsKind(), mode)
.code(),
RelocInfo::CODE_TARGET);
} else if (mode == DONT_OVERRIDE) {
int last_index =
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
for (int i = 0; i <= last_index; ++i) {
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
__ Cmpi(r6, Operand(kind), r0);
T stub(masm->isolate(), kind);
__ TailCallStub(&stub, eq);
__ Jump(
CodeFactory::ArrayNoArgumentConstructor(masm->isolate(), kind, mode)
.code(),
RelocInfo::CODE_TARGET, eq);
}
// If we reached this point there is a problem.
......@@ -3112,9 +3115,10 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
ElementsKind initial = GetInitialFastElementsKind();
ElementsKind holey_initial = GetHoleyElementsKind(initial);
ArraySingleArgumentConstructorStub stub_holey(
masm->isolate(), holey_initial, DISABLE_ALLOCATION_SITES);
__ TailCallStub(&stub_holey);
__ Jump(CodeFactory::ArraySingleArgumentConstructor(
masm->isolate(), holey_initial, DISABLE_ALLOCATION_SITES)
.code(),
RelocInfo::CODE_TARGET);
} else if (mode == DONT_OVERRIDE) {
// is the low bit set? If so, we are holey and that is good.
Label normal_sequence;
......@@ -3150,8 +3154,10 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
__ mov(r0, Operand(kind));
__ cmp(r6, r0);
ArraySingleArgumentConstructorStub stub(masm->isolate(), kind);
__ TailCallStub(&stub, eq);
__ Jump(CodeFactory::ArraySingleArgumentConstructor(masm->isolate(), kind,
DONT_OVERRIDE)
.code(),
RelocInfo::CODE_TARGET, eq);
}
// If we reached this point there is a problem.
......@@ -3166,7 +3172,7 @@ void GenerateDispatchToArrayStub(
Label not_zero_case, not_one_case;
__ cmpi(r3, Operand::Zero());
__ bne(&not_zero_case);
CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
CreateArrayDispatchNoArgument(masm, mode);
__ bind(&not_zero_case);
__ cmpi(r3, Operand(1));
......@@ -3242,8 +3248,9 @@ void GenerateInternalArrayConstructorCase(MacroAssembler* masm,
ElementsKind kind) {
__ cmpli(r3, Operand(1));
InternalArrayNoArgumentConstructorStub stub0(masm->isolate(), kind);
__ TailCallStub(&stub0, lt);
__ Jump(CodeFactory::InternalArrayNoArgumentConstructor(masm->isolate(), kind)
.code(),
RelocInfo::CODE_TARGET, lt);
__ Jump(BUILTIN_CODE(masm->isolate(), ArrayNArgumentsConstructor),
RelocInfo::CODE_TARGET, gt);
......@@ -3254,13 +3261,16 @@ void GenerateInternalArrayConstructorCase(MacroAssembler* masm,
__ LoadP(r6, MemOperand(sp, 0));
__ cmpi(r6, Operand::Zero());
InternalArraySingleArgumentConstructorStub stub1_holey(
masm->isolate(), GetHoleyElementsKind(kind));
__ TailCallStub(&stub1_holey, ne);
__ Jump(CodeFactory::InternalArraySingleArgumentConstructor(
masm->isolate(), GetHoleyElementsKind(kind))
.code(),
RelocInfo::CODE_TARGET, ne);
}
InternalArraySingleArgumentConstructorStub stub1(masm->isolate(), kind);
__ TailCallStub(&stub1);
__ Jump(
CodeFactory::InternalArraySingleArgumentConstructor(masm->isolate(), kind)
.code(),
RelocInfo::CODE_TARGET);
}
} // namespace
......
......@@ -3074,20 +3074,23 @@ void Builtins::Generate_ArrayNArgumentsConstructor(MacroAssembler* masm) {
namespace {
template <class T>
static void CreateArrayDispatch(MacroAssembler* masm,
AllocationSiteOverrideMode mode) {
void CreateArrayDispatchNoArgument(MacroAssembler* masm,
AllocationSiteOverrideMode mode) {
if (mode == DISABLE_ALLOCATION_SITES) {
T stub(masm->isolate(), GetInitialFastElementsKind(), mode);
__ TailCallStub(&stub);
__ Jump(CodeFactory::ArrayNoArgumentConstructor(
masm->isolate(), GetInitialFastElementsKind(), mode)
.code(),
RelocInfo::CODE_TARGET);
} else if (mode == DONT_OVERRIDE) {
int last_index =
GetSequenceIndexFromFastElementsKind(TERMINAL_FAST_ELEMENTS_KIND);
for (int i = 0; i <= last_index; ++i) {
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
__ CmpP(r5, Operand(kind));
T stub(masm->isolate(), kind);
__ TailCallStub(&stub, eq);
__ Jump(
CodeFactory::ArrayNoArgumentConstructor(masm->isolate(), kind, mode)
.code(),
RelocInfo::CODE_TARGET, eq);
}
// If we reached this point there is a problem.
......@@ -3115,9 +3118,10 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
ElementsKind initial = GetInitialFastElementsKind();
ElementsKind holey_initial = GetHoleyElementsKind(initial);
ArraySingleArgumentConstructorStub stub_holey(
masm->isolate(), holey_initial, DISABLE_ALLOCATION_SITES);
__ TailCallStub(&stub_holey);
__ Jump(CodeFactory::ArraySingleArgumentConstructor(
masm->isolate(), holey_initial, DISABLE_ALLOCATION_SITES)
.code(),
RelocInfo::CODE_TARGET);
} else if (mode == DONT_OVERRIDE) {
Label normal_sequence;
// is the low bit set? If so, we are holey and that is good.
......@@ -3149,8 +3153,10 @@ static void CreateArrayDispatchOneArgument(MacroAssembler* masm,
for (int i = 0; i <= last_index; ++i) {
ElementsKind kind = GetFastElementsKindFromSequenceIndex(i);
__ CmpP(r5, Operand(kind));
ArraySingleArgumentConstructorStub stub(masm->isolate(), kind);
__ TailCallStub(&stub, eq);
__ Jump(CodeFactory::ArraySingleArgumentConstructor(masm->isolate(), kind,
DONT_OVERRIDE)
.code(),
RelocInfo::CODE_TARGET, eq);
}
// If we reached this point there is a problem.
......@@ -3165,7 +3171,7 @@ void GenerateDispatchToArrayStub(
Label not_zero_case, not_one_case;
__ CmpP(r2, Operand::Zero());
__ bne(&not_zero_case);
CreateArrayDispatch<ArrayNoArgumentConstructorStub>(masm, mode);
CreateArrayDispatchNoArgument(masm, mode);
__ bind(&not_zero_case);
__ CmpP(r2, Operand(1));
......@@ -3241,8 +3247,9 @@ void GenerateInternalArrayConstructorCase(MacroAssembler* masm,
ElementsKind kind) {
__ CmpLogicalP(r2, Operand(1));
InternalArrayNoArgumentConstructorStub stub0(masm->isolate(), kind);
__ TailCallStub(&stub0, lt);
__ Jump(CodeFactory::InternalArrayNoArgumentConstructor(masm->isolate(), kind)
.code(),
RelocInfo::CODE_TARGET, lt);
__ Jump(BUILTIN_CODE(masm->isolate(), ArrayNArgumentsConstructor),
RelocInfo::CODE_TARGET, gt);
......@@ -3253,13 +3260,16 @@ void GenerateInternalArrayConstructorCase(MacroAssembler* masm,
__ LoadP(r5, MemOperand(sp, 0));
__ CmpP(r5, Operand::Zero());
InternalArraySingleArgumentConstructorStub stub1_holey(
masm->isolate(), GetHoleyElementsKind(kind));
__ TailCallStub(&stub1_holey, ne);
__ Jump(CodeFactory::InternalArraySingleArgumentConstructor(
masm->isolate(), GetHoleyElementsKind(kind))
.code(),
RelocInfo::CODE_TARGET, ne);
}
InternalArraySingleArgumentConstructorStub stub1(masm->isolate(), kind);
__ TailCallStub(&stub1);
__ Jump(
CodeFactory::InternalArraySingleArgumentConstructor(masm->isolate(), kind)
.code(),
RelocInfo::CODE_TARGET);
}
} // namespace
......
......@@ -190,7 +190,7 @@ void MacroAssembler::JumpToJSEntry(Register target) {
}
void TurboAssembler::Jump(intptr_t target, RelocInfo::Mode rmode,
Condition cond, CRegister) {
Condition cond) {
Label skip;
if (cond != al) b(NegateCondition(cond), &skip);
......@@ -203,10 +203,10 @@ void TurboAssembler::Jump(intptr_t target, RelocInfo::Mode rmode,
bind(&skip);
}
void TurboAssembler::Jump(Address target, RelocInfo::Mode rmode, Condition cond,
CRegister cr) {
void TurboAssembler::Jump(Address target, RelocInfo::Mode rmode,
Condition cond) {
DCHECK(!RelocInfo::IsCodeTarget(rmode));
Jump(static_cast<intptr_t>(target), rmode, cond, cr);
Jump(static_cast<intptr_t>(target), rmode, cond);
}
void TurboAssembler::Jump(Handle<Code> code, RelocInfo::Mode rmode,
......
......@@ -191,8 +191,7 @@ class TurboAssembler : public Assembler {
// Jump, Call, and Ret pseudo instructions implementing inter-working.
void Jump(Register target, Condition cond = al);
void Jump(Address target, RelocInfo::Mode rmode, Condition cond = al,
CRegister cr = cr7);
void Jump(Address target, RelocInfo::Mode rmode, Condition cond = al);
void Jump(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al);
// Jump the register contains a smi.
inline void JumpIfSmi(Register value, Label* smi_label) {
......@@ -1039,8 +1038,7 @@ class TurboAssembler : public Assembler {
void CallCFunctionHelper(Register function, int num_reg_arguments,
int num_double_arguments);
void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al,
CRegister cr = cr7);
void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al);
int CalculateStackPassedWords(int num_reg_arguments,
int num_double_arguments);
......
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