X87: [turbofan] Introduce Float64Pow and NumberPow operators.
port e607e12ea0
(r37323)
original commit message:
Introduce a new machine operator Float64Pow that for now is backed by
the existing MathPowStub to start the unification of Math.pow, and at
the same time address the main performance issue that TurboFan still has
with the imaging-darkroom benchmark in Kraken.
Also migrate the Math.pow builtin itself to a TurboFan builtin and
remove a few hundred lines of hand-written platform code for special
handling of the fullcodegen Math.pow version.
BUG=
Review-Url: https://codereview.chromium.org/2119773003
Cr-Commit-Position: refs/heads/master@{#37468}
This commit is contained in:
parent
1c1cd34f83
commit
727266fcb8
@ -785,6 +785,16 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kIeee754Float64Log10:
|
||||
ASSEMBLE_IEEE754_UNOP(log10);
|
||||
break;
|
||||
case kIeee754Float64Pow: {
|
||||
// Keep the x87 FPU stack empty before calling stub code
|
||||
__ fstp(0);
|
||||
// Call the MathStub and put return value in stX_0
|
||||
MathPowStub stub(isolate(), MathPowStub::DOUBLE);
|
||||
__ CallStub(&stub);
|
||||
/* Return value is in st(0) on x87. */
|
||||
__ lea(esp, Operand(esp, 2 * kDoubleSize));
|
||||
break;
|
||||
}
|
||||
case kIeee754Float64Sin:
|
||||
__ X87SetFPUCW(0x027F);
|
||||
ASSEMBLE_IEEE754_UNOP(sin);
|
||||
|
@ -270,26 +270,26 @@ void FloatingPointHelper::CheckFloatOperands(MacroAssembler* masm,
|
||||
|
||||
|
||||
void MathPowStub::Generate(MacroAssembler* masm) {
|
||||
const Register base = edx;
|
||||
const Register scratch = ecx;
|
||||
Label call_runtime;
|
||||
|
||||
// We will call runtime helper function directly.
|
||||
if (exponent_type() == ON_STACK) {
|
||||
// The arguments are still on the stack.
|
||||
__ bind(&call_runtime);
|
||||
__ TailCallRuntime(Runtime::kMathPowRT);
|
||||
// Load the double_exponent into x87 FPU
|
||||
__ fld_d(Operand(esp, 0 * kDoubleSize + 4));
|
||||
// Load the double_base into x87 FPU
|
||||
__ fld_d(Operand(esp, 1 * kDoubleSize + 4));
|
||||
|
||||
// The stub is called from non-optimized code, which expects the result
|
||||
// as heap number in exponent.
|
||||
__ AllocateHeapNumber(eax, scratch, base, &call_runtime);
|
||||
__ fstp_d(FieldOperand(eax, HeapNumber::kValueOffset));
|
||||
__ ret(2 * kPointerSize);
|
||||
} else {
|
||||
// Currently it's only called from full-compiler and exponent type is
|
||||
// ON_STACK.
|
||||
UNIMPLEMENTED();
|
||||
// Call ieee754 runtime directly.
|
||||
{
|
||||
AllowExternalCallThatCantCauseGC scope(masm);
|
||||
__ PrepareCallCFunction(4, scratch);
|
||||
// Put the double_base parameter in call stack
|
||||
__ fstp_d(Operand(esp, 0 * kDoubleSize));
|
||||
// Put the double_exponent parameter in call stack
|
||||
__ fstp_d(Operand(esp, 1 * kDoubleSize));
|
||||
__ CallCFunction(ExternalReference::power_double_double_function(isolate()),
|
||||
4);
|
||||
}
|
||||
// Return value is in st(0) on ia32.
|
||||
__ ret(0);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user