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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/compiler/x87/instruction-selector-x87.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/crankshaft/x87/lithium-codegen-x87.h" 7 #include "src/crankshaft/x87/lithium-codegen-x87.h"
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 3661 matching lines...) Expand 10 before | Expand all | Expand 10 after
3672 __ CallCFunction(ExternalReference::power_double_double_function(isolate()), 3672 __ CallCFunction(ExternalReference::power_double_double_function(isolate()),
3673 4); 3673 4);
3674 // Return value is in st(0) on ia32. 3674 // Return value is in st(0) on ia32.
3675 X87CommitWrite(result); 3675 X87CommitWrite(result);
3676 } 3676 }
3677 } 3677 }
3678 3678
3679 3679
3680 void LCodeGen::DoMathLog(LMathLog* instr) { 3680 void LCodeGen::DoMathLog(LMathLog* instr) {
3681 DCHECK(instr->value()->Equals(instr->result())); 3681 DCHECK(instr->value()->Equals(instr->result()));
3682 X87Register result = ToX87Register(instr->result());
3682 X87Register input_reg = ToX87Register(instr->value()); 3683 X87Register input_reg = ToX87Register(instr->value());
3683 X87Fxch(input_reg); 3684 X87Fxch(input_reg);
3684 3685
3685 Label positive, done, zero, nan_result; 3686 // Pass one double as argument on the stack.
3686 __ fldz(); 3687 __ PrepareCallCFunction(2, eax);
3687 __ fld(1); 3688 __ fstp_d(MemOperand(esp, 0));
3688 __ FCmp(); 3689 X87PrepareToWrite(result);
3689 __ j(below, &nan_result, Label::kNear); 3690 __ CallCFunction(ExternalReference::ieee754_log_function(isolate()), 2);
3690 __ j(equal, &zero, Label::kNear); 3691 // Return value is in st(0) on ia32.
3691 // Positive input. 3692 X87CommitWrite(result);
3692 // {input, ln2}.
3693 __ fldln2();
3694 // {ln2, input}.
3695 __ fxch();
3696 // {result}.
3697 __ fyl2x();
3698 __ jmp(&done, Label::kNear);
3699
3700 __ bind(&nan_result);
3701 X87PrepareToWrite(input_reg);
3702 __ push(Immediate(0xffffffff));
3703 __ push(Immediate(0x7fffffff));
3704 __ fld_d(MemOperand(esp, 0));
3705 __ lea(esp, Operand(esp, kDoubleSize));
3706 X87CommitWrite(input_reg);
3707 __ jmp(&done, Label::kNear);
3708
3709 __ bind(&zero);
3710 ExternalReference ninf = ExternalReference::address_of_negative_infinity();
3711 X87PrepareToWrite(input_reg);
3712 __ fld_d(Operand::StaticVariable(ninf));
3713 X87CommitWrite(input_reg);
3714
3715 __ bind(&done);
3716 } 3693 }
3717 3694
3718 3695
3719 void LCodeGen::DoMathClz32(LMathClz32* instr) { 3696 void LCodeGen::DoMathClz32(LMathClz32* instr) {
3720 Register input = ToRegister(instr->value()); 3697 Register input = ToRegister(instr->value());
3721 Register result = ToRegister(instr->result()); 3698 Register result = ToRegister(instr->result());
3722 3699
3723 __ Lzcnt(result, input); 3700 __ Lzcnt(result, input);
3724 } 3701 }
3725 3702
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after
5863 __ bind(deferred->exit()); 5840 __ bind(deferred->exit());
5864 __ bind(&done); 5841 __ bind(&done);
5865 } 5842 }
5866 5843
5867 #undef __ 5844 #undef __
5868 5845
5869 } // namespace internal 5846 } // namespace internal
5870 } // namespace v8 5847 } // namespace v8
5871 5848
5872 #endif // V8_TARGET_ARCH_X87 5849 #endif // V8_TARGET_ARCH_X87
OLDNEW
« 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