Index: src/x64/lithium-codegen-x64.cc |
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc |
index 6fe64c553ec39222eb7741696892cc436b5d5799..c9bccf54136caeb320da3c41a9b8ed00da539b89 100644 |
--- a/src/x64/lithium-codegen-x64.cc |
+++ b/src/x64/lithium-codegen-x64.cc |
@@ -3673,10 +3673,35 @@ void LCodeGen::DoMathExp(LMathExp* instr) { |
void LCodeGen::DoMathLog(LMathLog* instr) { |
- ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
- TranscendentalCacheStub stub(TranscendentalCache::LOG, |
- TranscendentalCacheStub::UNTAGGED); |
- CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr); |
+ ASSERT(instr->value()->Equals(instr->result())); |
+ XMMRegister input_reg = ToDoubleRegister(instr->value()); |
+ XMMRegister xmm_scratch = double_scratch0(); |
+ Label positive, done, zero; |
+ __ xorps(xmm_scratch, xmm_scratch); |
+ __ ucomisd(input_reg, xmm_scratch); |
+ __ j(above, &positive, Label::kNear); |
+ __ j(equal, &zero, Label::kNear); |
+ ExternalReference nan = |
+ ExternalReference::address_of_canonical_non_hole_nan(); |
+ Operand nan_operand = __ ExternalOperand(nan); |
Jakob Kummerow
2013/10/17 12:49:29
nit: please use "masm->" instead of "__" here. "__
Weiliang
2013/10/17 13:19:36
Done.
|
+ __ movsd(input_reg, nan_operand); |
+ __ jmp(&done, Label::kNear); |
+ __ bind(&zero); |
+ ExternalReference ninf = |
+ ExternalReference::address_of_negative_infinity(); |
+ Operand ninf_operand = __ ExternalOperand(ninf); |
Jakob Kummerow
2013/10/17 12:49:29
same here
Weiliang
2013/10/17 13:19:36
Done.
|
+ __ movsd(input_reg, ninf_operand); |
+ __ jmp(&done, Label::kNear); |
+ __ bind(&positive); |
+ __ fldln2(); |
+ __ subq(rsp, Immediate(kDoubleSize)); |
+ __ movsd(Operand(rsp, 0), input_reg); |
+ __ fld_d(Operand(rsp, 0)); |
+ __ fyl2x(); |
+ __ fstp_d(Operand(rsp, 0)); |
+ __ movsd(input_reg, Operand(rsp, 0)); |
+ __ addq(rsp, Immediate(kDoubleSize)); |
+ __ bind(&done); |
} |