| OLD | NEW |
| 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 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 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 1965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1976 } | 1976 } |
| 1977 } | 1977 } |
| 1978 | 1978 |
| 1979 | 1979 |
| 1980 void LCodeGen::DoArithmeticD(LArithmeticD* instr) { | 1980 void LCodeGen::DoArithmeticD(LArithmeticD* instr) { |
| 1981 XMMRegister left = ToDoubleRegister(instr->left()); | 1981 XMMRegister left = ToDoubleRegister(instr->left()); |
| 1982 XMMRegister right = ToDoubleRegister(instr->right()); | 1982 XMMRegister right = ToDoubleRegister(instr->right()); |
| 1983 XMMRegister result = ToDoubleRegister(instr->result()); | 1983 XMMRegister result = ToDoubleRegister(instr->result()); |
| 1984 switch (instr->op()) { | 1984 switch (instr->op()) { |
| 1985 case Token::ADD: | 1985 case Token::ADD: |
| 1986 if (CpuFeatures::IsSupported(AVX)) { | 1986 __ addsd(left, right); |
| 1987 CpuFeatureScope scope(masm(), AVX); | |
| 1988 __ vaddsd(result, left, right); | |
| 1989 } else { | |
| 1990 DCHECK(result.is(left)); | |
| 1991 __ addsd(left, right); | |
| 1992 } | |
| 1993 break; | 1987 break; |
| 1994 case Token::SUB: | 1988 case Token::SUB: |
| 1995 if (CpuFeatures::IsSupported(AVX)) { | 1989 __ subsd(left, right); |
| 1996 CpuFeatureScope scope(masm(), AVX); | |
| 1997 __ vsubsd(result, left, right); | |
| 1998 } else { | |
| 1999 DCHECK(result.is(left)); | |
| 2000 __ subsd(left, right); | |
| 2001 } | |
| 2002 break; | 1990 break; |
| 2003 case Token::MUL: | 1991 case Token::MUL: |
| 2004 if (CpuFeatures::IsSupported(AVX)) { | 1992 __ mulsd(left, right); |
| 2005 CpuFeatureScope scope(masm(), AVX); | |
| 2006 __ vmulsd(result, left, right); | |
| 2007 } else { | |
| 2008 DCHECK(result.is(left)); | |
| 2009 __ mulsd(left, right); | |
| 2010 } | |
| 2011 break; | 1993 break; |
| 2012 case Token::DIV: | 1994 case Token::DIV: |
| 2013 if (CpuFeatures::IsSupported(AVX)) { | 1995 __ divsd(left, right); |
| 2014 CpuFeatureScope scope(masm(), AVX); | 1996 // Don't delete this mov. It may improve performance on some CPUs, |
| 2015 __ vdivsd(result, left, right); | 1997 // when there is a mulsd depending on the result |
| 2016 } else { | 1998 __ movaps(left, left); |
| 2017 DCHECK(result.is(left)); | |
| 2018 __ divsd(left, right); | |
| 2019 // Don't delete this mov. It may improve performance on some CPUs, | |
| 2020 // when there is a mulsd depending on the result | |
| 2021 __ movaps(left, left); | |
| 2022 } | |
| 2023 break; | 1999 break; |
| 2024 case Token::MOD: { | 2000 case Token::MOD: { |
| 2025 // Pass two doubles as arguments on the stack. | 2001 // Pass two doubles as arguments on the stack. |
| 2026 __ PrepareCallCFunction(4, eax); | 2002 __ PrepareCallCFunction(4, eax); |
| 2027 __ movsd(Operand(esp, 0 * kDoubleSize), left); | 2003 __ movsd(Operand(esp, 0 * kDoubleSize), left); |
| 2028 __ movsd(Operand(esp, 1 * kDoubleSize), right); | 2004 __ movsd(Operand(esp, 1 * kDoubleSize), right); |
| 2029 __ CallCFunction( | 2005 __ CallCFunction( |
| 2030 ExternalReference::mod_two_doubles_operation(isolate()), | 2006 ExternalReference::mod_two_doubles_operation(isolate()), |
| 2031 4); | 2007 4); |
| 2032 | 2008 |
| (...skipping 3727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5760 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5736 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5761 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5737 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5762 } | 5738 } |
| 5763 | 5739 |
| 5764 | 5740 |
| 5765 #undef __ | 5741 #undef __ |
| 5766 | 5742 |
| 5767 } } // namespace v8::internal | 5743 } } // namespace v8::internal |
| 5768 | 5744 |
| 5769 #endif // V8_TARGET_ARCH_IA32 | 5745 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |