OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2011 __ addsd(left, right); | 2011 __ addsd(left, right); |
2012 break; | 2012 break; |
2013 case Token::SUB: | 2013 case Token::SUB: |
2014 __ subsd(left, right); | 2014 __ subsd(left, right); |
2015 break; | 2015 break; |
2016 case Token::MUL: | 2016 case Token::MUL: |
2017 __ mulsd(left, right); | 2017 __ mulsd(left, right); |
2018 break; | 2018 break; |
2019 case Token::DIV: | 2019 case Token::DIV: |
2020 __ divsd(left, right); | 2020 __ divsd(left, right); |
| 2021 // Don't delete this mov. It may improve performance on some CPUs, |
| 2022 // when there is a mulsd depending on the result |
| 2023 { |
| 2024 bool has_dependent_mul = false; |
| 2025 HValue* value = instr->hydrogen_value(); |
| 2026 for (HUseIterator it(value->uses()); !it.Done(); it.Advance()) { |
| 2027 HValue* use = it.value(); |
| 2028 if (!use->IsMul()) continue; |
| 2029 LArithmeticD* lmul = NULL; |
| 2030 for (int i = use->block()->first_instruction_index(); |
| 2031 i <= use->block()->last_instruction_index(); i++) { |
| 2032 LInstruction* luse = chunk_->instructions()->at(i); |
| 2033 if (luse->hydrogen_value() == use) { |
| 2034 ASSERT(luse->IsArithmeticD()); |
| 2035 lmul = reinterpret_cast<LArithmeticD*>(luse); |
| 2036 ASSERT(lmul->op() == Token::MUL); |
| 2037 break; |
| 2038 } |
| 2039 } |
| 2040 if (lmul->left()->Equals(instr->left()) || |
| 2041 lmul->right()->Equals(instr->left())) { |
| 2042 has_dependent_mul = true; |
| 2043 break; |
| 2044 } |
| 2045 } |
| 2046 if (has_dependent_mul) { |
| 2047 __ movaps(left, left); |
| 2048 } |
| 2049 } |
2021 break; | 2050 break; |
2022 case Token::MOD: { | 2051 case Token::MOD: { |
2023 // Pass two doubles as arguments on the stack. | 2052 // Pass two doubles as arguments on the stack. |
2024 __ PrepareCallCFunction(4, eax); | 2053 __ PrepareCallCFunction(4, eax); |
2025 __ movdbl(Operand(esp, 0 * kDoubleSize), left); | 2054 __ movdbl(Operand(esp, 0 * kDoubleSize), left); |
2026 __ movdbl(Operand(esp, 1 * kDoubleSize), right); | 2055 __ movdbl(Operand(esp, 1 * kDoubleSize), right); |
2027 __ CallCFunction( | 2056 __ CallCFunction( |
2028 ExternalReference::double_fp_operation(Token::MOD, isolate()), | 2057 ExternalReference::double_fp_operation(Token::MOD, isolate()), |
2029 4); | 2058 4); |
2030 | 2059 |
(...skipping 4712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6743 FixedArray::kHeaderSize - kPointerSize)); | 6772 FixedArray::kHeaderSize - kPointerSize)); |
6744 __ bind(&done); | 6773 __ bind(&done); |
6745 } | 6774 } |
6746 | 6775 |
6747 | 6776 |
6748 #undef __ | 6777 #undef __ |
6749 | 6778 |
6750 } } // namespace v8::internal | 6779 } } // namespace v8::internal |
6751 | 6780 |
6752 #endif // V8_TARGET_ARCH_IA32 | 6781 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |