PPC: [runtime] Implement %_ToLength via ToLengthStub.
Port e678a0f9a9
Original commit message:
Use %_ToLength for TO_LENGTH, implemented via a ToLengthStub
that supports a fast path for small integers. Everything else is still
handled in the runtime.
R=bmeurer@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, dstence@us.ibm.com
BUG=v8:4494
LOG=n
Review URL: https://codereview.chromium.org/1412153003
Cr-Commit-Position: refs/heads/master@{#31384}
This commit is contained in:
parent
af4888de13
commit
8fafb2916c
@ -3334,6 +3334,28 @@ void ToNumberStub::Generate(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void ToLengthStub::Generate(MacroAssembler* masm) {
|
||||
// The ToLength stub takes one argument in r3.
|
||||
Label not_smi;
|
||||
__ JumpIfNotSmi(r3, ¬_smi);
|
||||
STATIC_ASSERT(kSmiTag == 0);
|
||||
__ cmpi(r3, Operand::Zero());
|
||||
if (CpuFeatures::IsSupported(ISELECT)) {
|
||||
__ isel(lt, r3, r0, r3);
|
||||
} else {
|
||||
Label positive;
|
||||
__ bgt(&positive);
|
||||
__ li(r3, Operand::Zero());
|
||||
__ bind(&positive);
|
||||
}
|
||||
__ Ret();
|
||||
__ bind(¬_smi);
|
||||
|
||||
__ push(r3); // Push argument.
|
||||
__ TailCallRuntime(Runtime::kToLength, 1, 1);
|
||||
}
|
||||
|
||||
|
||||
void ToStringStub::Generate(MacroAssembler* masm) {
|
||||
// The ToString stub takes one argument in r3.
|
||||
Label is_number;
|
||||
|
@ -99,6 +99,10 @@ void ToNumberDescriptor::InitializePlatformSpecific(
|
||||
}
|
||||
|
||||
|
||||
// static
|
||||
const Register ToLengthDescriptor::ReceiverRegister() { return r3; }
|
||||
|
||||
|
||||
// static
|
||||
const Register ToStringDescriptor::ReceiverRegister() { return r3; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user