Index: src/compiler/ia32/code-generator-ia32.cc |
diff --git a/src/compiler/ia32/code-generator-ia32.cc b/src/compiler/ia32/code-generator-ia32.cc |
index afe734652fd6d73594bff38f1577a07c12bcef07..69c16a0faaf03f5a8e852223316034941caf63fb 100644 |
--- a/src/compiler/ia32/code-generator-ia32.cc |
+++ b/src/compiler/ia32/code-generator-ia32.cc |
@@ -363,6 +363,21 @@ class OutOfLineRecordWrite final : public OutOfLineCode { |
} \ |
} while (0) |
+#define ASSEMBLE_IEEE754_UNOP(name) \ |
+ do { \ |
+ /* Pass one double as argument on the stack.*/ \ |
+ __ PrepareCallCFunction(2, eax); \ |
+ __ movsd(Operand(esp, 0 * kDoubleSize), i.InputDoubleRegister(0)); \ |
+ __ CallCFunction(ExternalReference::ieee754_##name##_function(isolate()), \ |
+ 2); \ |
+ /* Return value is in st(0) on ia32. */ \ |
+ /* Store it into the result register. */ \ |
+ __ sub(esp, Immediate(kDoubleSize)); \ |
+ __ fstp_d(Operand(esp, 0)); \ |
+ __ movsd(i.OutputDoubleRegister(), Operand(esp, 0)); \ |
+ __ add(esp, Immediate(kDoubleSize)); \ |
+ } while (false) |
+ |
void CodeGenerator::AssembleDeconstructFrame() { |
__ mov(esp, ebp); |
__ pop(ebp); |
@@ -617,19 +632,12 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction( |
__ lea(i.OutputRegister(), Operand(base, offset.offset())); |
break; |
} |
- case kIeee754Float64Log: { |
- // Pass one double as argument on the stack. |
- __ PrepareCallCFunction(2, eax); |
- __ movsd(Operand(esp, 0 * kDoubleSize), i.InputDoubleRegister(0)); |
- __ CallCFunction(ExternalReference::ieee754_log_function(isolate()), 2); |
- // Return value is in st(0) on ia32. |
- // Store it into the result register. |
- __ sub(esp, Immediate(kDoubleSize)); |
- __ fstp_d(Operand(esp, 0)); |
- __ movsd(i.OutputDoubleRegister(), Operand(esp, 0)); |
- __ add(esp, Immediate(kDoubleSize)); |
+ case kIeee754Float64Log: |
+ ASSEMBLE_IEEE754_UNOP(log); |
+ break; |
+ case kIeee754Float64Log1p: |
+ ASSEMBLE_IEEE754_UNOP(log1p); |
break; |
- } |
case kIA32Add: |
if (HasImmediateInput(instr, 1)) { |
__ add(i.InputOperand(0), i.InputImmediate(1)); |