Index: src/crankshaft/x87/lithium-codegen-x87.cc |
diff --git a/src/crankshaft/x87/lithium-codegen-x87.cc b/src/crankshaft/x87/lithium-codegen-x87.cc |
index f75041f1a6799c9a139bb3c48acd522c9c265cb5..0f25b4b0ca3ac1b1e2a95c5f14e1d71f2cad3922 100644 |
--- a/src/crankshaft/x87/lithium-codegen-x87.cc |
+++ b/src/crankshaft/x87/lithium-codegen-x87.cc |
@@ -3679,40 +3679,17 @@ void LCodeGen::DoPower(LPower* instr) { |
void LCodeGen::DoMathLog(LMathLog* instr) { |
DCHECK(instr->value()->Equals(instr->result())); |
+ X87Register result = ToX87Register(instr->result()); |
X87Register input_reg = ToX87Register(instr->value()); |
X87Fxch(input_reg); |
- Label positive, done, zero, nan_result; |
- __ fldz(); |
- __ fld(1); |
- __ FCmp(); |
- __ j(below, &nan_result, Label::kNear); |
- __ j(equal, &zero, Label::kNear); |
- // Positive input. |
- // {input, ln2}. |
- __ fldln2(); |
- // {ln2, input}. |
- __ fxch(); |
- // {result}. |
- __ fyl2x(); |
- __ jmp(&done, Label::kNear); |
- |
- __ bind(&nan_result); |
- X87PrepareToWrite(input_reg); |
- __ push(Immediate(0xffffffff)); |
- __ push(Immediate(0x7fffffff)); |
- __ fld_d(MemOperand(esp, 0)); |
- __ lea(esp, Operand(esp, kDoubleSize)); |
- X87CommitWrite(input_reg); |
- __ jmp(&done, Label::kNear); |
- |
- __ bind(&zero); |
- ExternalReference ninf = ExternalReference::address_of_negative_infinity(); |
- X87PrepareToWrite(input_reg); |
- __ fld_d(Operand::StaticVariable(ninf)); |
- X87CommitWrite(input_reg); |
- |
- __ bind(&done); |
+ // Pass one double as argument on the stack. |
+ __ PrepareCallCFunction(2, eax); |
+ __ fstp_d(MemOperand(esp, 0)); |
+ X87PrepareToWrite(result); |
+ __ CallCFunction(ExternalReference::ieee754_log_function(isolate()), 2); |
+ // Return value is in st(0) on ia32. |
+ X87CommitWrite(result); |
} |