Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Unified Diff: src/crankshaft/x87/lithium-codegen-x87.cc

Issue 2096283002: X87: [builtins] Introduce proper Float64Exp operator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/x87/code-generator-x87.cc ('k') | src/crankshaft/x87/lithium-x87.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4c405337c687ce2129db1f62438e00f2729c00cb..ab19eea38ea74123049031dc7b8591304cbda740 100644
--- a/src/crankshaft/x87/lithium-codegen-x87.cc
+++ b/src/crankshaft/x87/lithium-codegen-x87.cc
@@ -3702,65 +3702,17 @@ void LCodeGen::DoMathClz32(LMathClz32* instr) {
void LCodeGen::DoMathExp(LMathExp* instr) {
- X87Register input = ToX87Register(instr->value());
- X87Register result_reg = ToX87Register(instr->result());
- Register temp_result = ToRegister(instr->temp1());
- Register temp = ToRegister(instr->temp2());
- Label slow, done, smi, finish;
- DCHECK(result_reg.is(input));
-
- // Store input into Heap number and call runtime function kMathExpRT.
- if (FLAG_inline_new) {
- __ AllocateHeapNumber(temp_result, temp, no_reg, &slow);
- __ jmp(&done, Label::kNear);
- }
-
- // Slow case: Call the runtime system to do the number allocation.
- __ bind(&slow);
- {
- // TODO(3095996): Put a valid pointer value in the stack slot where the
- // result register is stored, as this register is in the pointer map, but
- // contains an integer value.
- __ Move(temp_result, Immediate(0));
-
- // Preserve the value of all registers.
- PushSafepointRegistersScope scope(this);
-
- __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
- __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber);
- RecordSafepointWithRegisters(instr->pointer_map(), 0,
- Safepoint::kNoLazyDeopt);
- __ StoreToSafepointRegisterSlot(temp_result, eax);
- }
- __ bind(&done);
- X87LoadForUsage(input);
- __ fstp_d(FieldOperand(temp_result, HeapNumber::kValueOffset));
-
- {
- // Preserve the value of all registers.
- PushSafepointRegistersScope scope(this);
+ X87Register result = ToX87Register(instr->result());
+ X87Register input_reg = ToX87Register(instr->value());
+ __ fld(x87_stack_.st(input_reg));
- __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
- __ push(temp_result);
- __ CallRuntimeSaveDoubles(Runtime::kMathExpRT);
- RecordSafepointWithRegisters(instr->pointer_map(), 1,
- Safepoint::kNoLazyDeopt);
- __ StoreToSafepointRegisterSlot(temp_result, eax);
- }
- X87PrepareToWrite(result_reg);
- // return value of MathExpRT is Smi or Heap Number.
- __ JumpIfSmi(temp_result, &smi);
- // Heap number(double)
- __ fld_d(FieldOperand(temp_result, HeapNumber::kValueOffset));
- __ jmp(&finish);
- // SMI
- __ bind(&smi);
- __ SmiUntag(temp_result);
- __ push(temp_result);
- __ fild_s(MemOperand(esp, 0));
- __ pop(temp_result);
- __ bind(&finish);
- X87CommitWrite(result_reg);
+ // Pass one double as argument on the stack.
+ __ PrepareCallCFunction(2, eax);
+ __ fstp_d(MemOperand(esp, 0));
+ X87PrepareToWrite(result);
+ __ CallCFunction(ExternalReference::ieee754_exp_function(isolate()), 2);
+ // Return value is in st(0) on ia32.
+ X87CommitWrite(result);
}
void LCodeGen::PrepareForTailCall(const ParameterCount& actual,
« no previous file with comments | « src/compiler/x87/code-generator-x87.cc ('k') | src/crankshaft/x87/lithium-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698