| 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 1964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1975 } | 1975 } |
| 1976 } | 1976 } |
| 1977 | 1977 |
| 1978 | 1978 |
| 1979 void LCodeGen::DoArithmeticD(LArithmeticD* instr) { | 1979 void LCodeGen::DoArithmeticD(LArithmeticD* instr) { |
| 1980 XMMRegister left = ToDoubleRegister(instr->left()); | 1980 XMMRegister left = ToDoubleRegister(instr->left()); |
| 1981 XMMRegister right = ToDoubleRegister(instr->right()); | 1981 XMMRegister right = ToDoubleRegister(instr->right()); |
| 1982 XMMRegister result = ToDoubleRegister(instr->result()); | 1982 XMMRegister result = ToDoubleRegister(instr->result()); |
| 1983 switch (instr->op()) { | 1983 switch (instr->op()) { |
| 1984 case Token::ADD: | 1984 case Token::ADD: |
| 1985 if (CpuFeatures::IsSupported(AVX)) { | 1985 __ addsd(left, right); |
| 1986 CpuFeatureScope scope(masm(), AVX); | |
| 1987 __ vaddsd(result, left, right); | |
| 1988 } else { | |
| 1989 DCHECK(result.is(left)); | |
| 1990 __ addsd(left, right); | |
| 1991 } | |
| 1992 break; | 1986 break; |
| 1993 case Token::SUB: | 1987 case Token::SUB: |
| 1994 if (CpuFeatures::IsSupported(AVX)) { | 1988 __ subsd(left, right); |
| 1995 CpuFeatureScope scope(masm(), AVX); | |
| 1996 __ vsubsd(result, left, right); | |
| 1997 } else { | |
| 1998 DCHECK(result.is(left)); | |
| 1999 __ subsd(left, right); | |
| 2000 } | |
| 2001 break; | 1989 break; |
| 2002 case Token::MUL: | 1990 case Token::MUL: |
| 2003 if (CpuFeatures::IsSupported(AVX)) { | 1991 __ mulsd(left, right); |
| 2004 CpuFeatureScope scope(masm(), AVX); | |
| 2005 __ vmulsd(result, left, right); | |
| 2006 } else { | |
| 2007 DCHECK(result.is(left)); | |
| 2008 __ mulsd(left, right); | |
| 2009 } | |
| 2010 break; | 1992 break; |
| 2011 case Token::DIV: | 1993 case Token::DIV: |
| 2012 if (CpuFeatures::IsSupported(AVX)) { | 1994 __ divsd(left, right); |
| 2013 CpuFeatureScope scope(masm(), AVX); | 1995 // Don't delete this mov. It may improve performance on some CPUs, |
| 2014 __ vdivsd(result, left, right); | 1996 // when there is a mulsd depending on the result |
| 2015 } else { | 1997 __ movaps(left, left); |
| 2016 DCHECK(result.is(left)); | |
| 2017 __ divsd(left, right); | |
| 2018 // Don't delete this mov. It may improve performance on some CPUs, | |
| 2019 // when there is a mulsd depending on the result | |
| 2020 __ movaps(left, left); | |
| 2021 } | |
| 2022 break; | 1998 break; |
| 2023 case Token::MOD: { | 1999 case Token::MOD: { |
| 2024 // Pass two doubles as arguments on the stack. | 2000 // Pass two doubles as arguments on the stack. |
| 2025 __ PrepareCallCFunction(4, eax); | 2001 __ PrepareCallCFunction(4, eax); |
| 2026 __ movsd(Operand(esp, 0 * kDoubleSize), left); | 2002 __ movsd(Operand(esp, 0 * kDoubleSize), left); |
| 2027 __ movsd(Operand(esp, 1 * kDoubleSize), right); | 2003 __ movsd(Operand(esp, 1 * kDoubleSize), right); |
| 2028 __ CallCFunction( | 2004 __ CallCFunction( |
| 2029 ExternalReference::mod_two_doubles_operation(isolate()), | 2005 ExternalReference::mod_two_doubles_operation(isolate()), |
| 2030 4); | 2006 4); |
| 2031 | 2007 |
| (...skipping 3718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5750 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5726 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5751 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5727 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5752 } | 5728 } |
| 5753 | 5729 |
| 5754 | 5730 |
| 5755 #undef __ | 5731 #undef __ |
| 5756 | 5732 |
| 5757 } } // namespace v8::internal | 5733 } } // namespace v8::internal |
| 5758 | 5734 |
| 5759 #endif // V8_TARGET_ARCH_IA32 | 5735 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |