Chromium Code Reviews| Index: src/ia32/lithium-codegen-ia32.cc |
| =================================================================== |
| --- src/ia32/lithium-codegen-ia32.cc (revision 7492) |
| +++ src/ia32/lithium-codegen-ia32.cc (working copy) |
| @@ -2777,9 +2777,31 @@ |
| void LCodeGen::DoMathLog(LUnaryMathOperation* instr) { |
| ASSERT(ToDoubleRegister(instr->result()).is(xmm1)); |
|
Kevin Millikin (Chromium)
2011/04/05 07:33:20
This doesn't put the result in xmm1, does it?
fschneider
2011/04/05 07:36:09
Result + input should be allowed any double regist
|
| - TranscendentalCacheStub stub(TranscendentalCache::LOG, |
| - TranscendentalCacheStub::UNTAGGED); |
| - CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, false); |
| + XMMRegister input_reg = ToDoubleRegister(instr->InputAt(0)); |
| + NearLabel positive, done, zero, negative; |
| + __ xorpd(xmm0, xmm0); |
| + __ ucomisd(input_reg, xmm0); |
| + __ j(above, &positive); |
| + __ j(equal, &zero); |
| + ExternalReference nan = ExternalReference::address_of_nan(); |
| + __ movdbl(input_reg, Operand::StaticVariable(nan)); |
| + __ jmp(&done); |
| + __ bind(&zero); |
| + __ push(Immediate(0xFFF00000)); |
| + __ push(Immediate(0)); |
| + __ movdbl(input_reg, Operand(esp, 0)); |
| + __ add(Operand(esp), Immediate(kDoubleSize)); |
| + __ jmp(&done); |
| + __ bind(&positive); |
| + __ fldln2(); |
| + __ sub(Operand(esp), Immediate(kDoubleSize)); |
| + __ movdbl(Operand(esp, 0), input_reg); |
| + __ fld_d(Operand(esp, 0)); |
| + __ fyl2x(); |
| + __ fstp_d(Operand(esp, 0)); |
| + __ movdbl(input_reg, Operand(esp, 0)); |
| + __ add(Operand(esp), Immediate(kDoubleSize)); |
| + __ bind(&done); |
| } |