X87: [builtins] Migrate Math.log to TurboFan.
port f2da19fe39
(r36703)
original commit message:
Introduce a dedicated Float64Log machine operator, that is either
implemented by a direct C call or by platform specific code, i.e.
using the FPU on x64 and ia32.
This operator is used to implement Math.log as a proper TurboFan
builtin on top of the CodeStubAssembler.
Also introduce a NumberLog simplified operator on top of Float64Log
and use that for the fast inline path of Math.log inside TurboFan
optimized code.
BUG=
Review-Url: https://codereview.chromium.org/2034393002
Cr-Commit-Position: refs/heads/master@{#36727}
This commit is contained in:
parent
ecd4086cf0
commit
973823e454
@ -898,6 +898,18 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
|
||||
case kX87Popcnt:
|
||||
__ Popcnt(i.OutputRegister(), i.InputOperand(0));
|
||||
break;
|
||||
case kX87Float64Log:
|
||||
if (FLAG_debug_code && FLAG_enable_slow_asserts) {
|
||||
__ VerifyX87StackDepth(1);
|
||||
}
|
||||
__ X87SetFPUCW(0x027F);
|
||||
__ fstp(0);
|
||||
__ fldln2();
|
||||
__ fld_d(MemOperand(esp, 0));
|
||||
__ fyl2x();
|
||||
__ lea(esp, Operand(esp, kDoubleSize));
|
||||
__ X87SetFPUCW(0x037F);
|
||||
break;
|
||||
case kX87LoadFloat64Constant: {
|
||||
InstructionOperand* source = instr->InputAt(0);
|
||||
InstructionOperand* destination = instr->Output();
|
||||
|
@ -44,6 +44,7 @@ namespace compiler {
|
||||
V(X87Ror) \
|
||||
V(X87Lzcnt) \
|
||||
V(X87Popcnt) \
|
||||
V(X87Float64Log) \
|
||||
V(X87Float32Cmp) \
|
||||
V(X87Float32Add) \
|
||||
V(X87Float32Sub) \
|
||||
|
@ -1009,6 +1009,11 @@ void InstructionSelector::VisitFloat64Abs(Node* node) {
|
||||
Emit(kX87Float64Abs, g.DefineAsFixed(node, stX_0), 0, nullptr);
|
||||
}
|
||||
|
||||
void InstructionSelector::VisitFloat64Log(Node* node) {
|
||||
X87OperandGenerator g(this);
|
||||
Emit(kX87PushFloat64, g.NoOutput(), g.Use(node->InputAt(0)));
|
||||
Emit(kX87Float64Log, g.DefineAsFixed(node, stX_0), 0, nullptr);
|
||||
}
|
||||
|
||||
void InstructionSelector::VisitFloat32Sqrt(Node* node) {
|
||||
X87OperandGenerator g(this);
|
||||
|
Loading…
Reference in New Issue
Block a user