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

Side by Side Diff: src/crankshaft/x87/lithium-codegen-x87.cc

Issue 2403803002: [X87] [crankshaft] Set Floating-point precision in Math.Cos/Math.Sin to standard double precision. (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | 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 3642 matching lines...) Expand 10 before | Expand all | Expand 10 after
3653 3653
3654 void LCodeGen::DoMathCos(LMathCos* instr) { 3654 void LCodeGen::DoMathCos(LMathCos* instr) {
3655 X87Register result = ToX87Register(instr->result()); 3655 X87Register result = ToX87Register(instr->result());
3656 X87Register input_reg = ToX87Register(instr->value()); 3656 X87Register input_reg = ToX87Register(instr->value());
3657 __ fld(x87_stack_.st(input_reg)); 3657 __ fld(x87_stack_.st(input_reg));
3658 3658
3659 // Pass one double as argument on the stack. 3659 // Pass one double as argument on the stack.
3660 __ PrepareCallCFunction(2, eax); 3660 __ PrepareCallCFunction(2, eax);
3661 __ fstp_d(MemOperand(esp, 0)); 3661 __ fstp_d(MemOperand(esp, 0));
3662 X87PrepareToWrite(result); 3662 X87PrepareToWrite(result);
3663 __ X87SetFPUCW(0x027F);
3663 __ CallCFunction(ExternalReference::ieee754_cos_function(isolate()), 2); 3664 __ CallCFunction(ExternalReference::ieee754_cos_function(isolate()), 2);
3665 __ X87SetFPUCW(0x037F);
3664 // Return value is in st(0) on ia32. 3666 // Return value is in st(0) on ia32.
3665 X87CommitWrite(result); 3667 X87CommitWrite(result);
3666 } 3668 }
3667 3669
3668 void LCodeGen::DoMathSin(LMathSin* instr) { 3670 void LCodeGen::DoMathSin(LMathSin* instr) {
3669 X87Register result = ToX87Register(instr->result()); 3671 X87Register result = ToX87Register(instr->result());
3670 X87Register input_reg = ToX87Register(instr->value()); 3672 X87Register input_reg = ToX87Register(instr->value());
3671 __ fld(x87_stack_.st(input_reg)); 3673 __ fld(x87_stack_.st(input_reg));
3672 3674
3673 // Pass one double as argument on the stack. 3675 // Pass one double as argument on the stack.
3674 __ PrepareCallCFunction(2, eax); 3676 __ PrepareCallCFunction(2, eax);
3675 __ fstp_d(MemOperand(esp, 0)); 3677 __ fstp_d(MemOperand(esp, 0));
3676 X87PrepareToWrite(result); 3678 X87PrepareToWrite(result);
3679 __ X87SetFPUCW(0x027F);
3677 __ CallCFunction(ExternalReference::ieee754_sin_function(isolate()), 2); 3680 __ CallCFunction(ExternalReference::ieee754_sin_function(isolate()), 2);
3681 __ X87SetFPUCW(0x037F);
3678 // Return value is in st(0) on ia32. 3682 // Return value is in st(0) on ia32.
3679 X87CommitWrite(result); 3683 X87CommitWrite(result);
3680 } 3684 }
3681 3685
3682 void LCodeGen::DoMathExp(LMathExp* instr) { 3686 void LCodeGen::DoMathExp(LMathExp* instr) {
3683 X87Register result = ToX87Register(instr->result()); 3687 X87Register result = ToX87Register(instr->result());
3684 X87Register input_reg = ToX87Register(instr->value()); 3688 X87Register input_reg = ToX87Register(instr->value());
3685 __ fld(x87_stack_.st(input_reg)); 3689 __ fld(x87_stack_.st(input_reg));
3686 3690
3687 // Pass one double as argument on the stack. 3691 // Pass one double as argument on the stack.
(...skipping 2012 matching lines...) Expand 10 before | Expand all | Expand 10 after
5700 __ bind(deferred->exit()); 5704 __ bind(deferred->exit());
5701 __ bind(&done); 5705 __ bind(&done);
5702 } 5706 }
5703 5707
5704 #undef __ 5708 #undef __
5705 5709
5706 } // namespace internal 5710 } // namespace internal
5707 } // namespace v8 5711 } // namespace v8
5708 5712
5709 #endif // V8_TARGET_ARCH_X87 5713 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698