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

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

Issue 2081653005: X87: [builtins] Introduce proper base::ieee754::log. (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/instruction-selector-x87.cc ('k') | no next file » | 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 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);
}
« no previous file with comments | « src/compiler/x87/instruction-selector-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698