| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 2696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2707 Label do_call, done; | 2707 Label do_call, done; |
| 2708 // Check for overflow and that it fits into Smi. | 2708 // Check for overflow and that it fits into Smi. |
| 2709 __ cmpl(result, Immediate(0xC0000000)); | 2709 __ cmpl(result, Immediate(0xC0000000)); |
| 2710 __ j(NEGATIVE, deopt); | 2710 __ j(NEGATIVE, deopt); |
| 2711 __ SmiTag(result); | 2711 __ SmiTag(result); |
| 2712 } | 2712 } |
| 2713 | 2713 |
| 2714 | 2714 |
| 2715 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary() const { | 2715 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary() const { |
| 2716 const intptr_t kNumInputs = 1; | 2716 const intptr_t kNumInputs = 1; |
| 2717 const intptr_t kNumTemps = | 2717 const intptr_t kNumTemps = 0; |
| 2718 (recognized_kind() == MethodRecognizer::kDoubleRound) ? 1 : 0; | |
| 2719 LocationSummary* result = | 2718 LocationSummary* result = |
| 2720 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2719 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2721 result->set_in(0, Location::RequiresFpuRegister()); | 2720 result->set_in(0, Location::RequiresFpuRegister()); |
| 2722 result->set_out(Location::RequiresFpuRegister()); | 2721 result->set_out(Location::RequiresFpuRegister()); |
| 2723 if (recognized_kind() == MethodRecognizer::kDoubleRound) { | |
| 2724 result->set_temp(0, Location::RequiresFpuRegister()); | |
| 2725 } | |
| 2726 return result; | 2722 return result; |
| 2727 } | 2723 } |
| 2728 | 2724 |
| 2729 | 2725 |
| 2730 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2726 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2731 XmmRegister value = locs()->in(0).fpu_reg(); | 2727 XmmRegister value = locs()->in(0).fpu_reg(); |
| 2732 XmmRegister result = locs()->out().fpu_reg(); | 2728 XmmRegister result = locs()->out().fpu_reg(); |
| 2733 switch (recognized_kind()) { | 2729 switch (recognized_kind()) { |
| 2734 case MethodRecognizer::kDoubleTruncate: | 2730 case MethodRecognizer::kDoubleTruncate: |
| 2735 __ roundsd(result, value, Assembler::kRoundToZero); | 2731 __ roundsd(result, value, Assembler::kRoundToZero); |
| 2736 break; | 2732 break; |
| 2737 case MethodRecognizer::kDoubleFloor: | 2733 case MethodRecognizer::kDoubleFloor: |
| 2738 __ roundsd(result, value, Assembler::kRoundDown); | 2734 __ roundsd(result, value, Assembler::kRoundDown); |
| 2739 break; | 2735 break; |
| 2740 case MethodRecognizer::kDoubleCeil: | 2736 case MethodRecognizer::kDoubleCeil: |
| 2741 __ roundsd(result, value, Assembler::kRoundUp); | 2737 __ roundsd(result, value, Assembler::kRoundUp); |
| 2742 break; | 2738 break; |
| 2743 case MethodRecognizer::kDoubleRound: { | |
| 2744 XmmRegister temp = locs()->temp(0).fpu_reg(); | |
| 2745 __ DoubleRound(result, value, temp); | |
| 2746 break; | |
| 2747 } | |
| 2748 default: | 2739 default: |
| 2749 UNREACHABLE(); | 2740 UNREACHABLE(); |
| 2750 } | 2741 } |
| 2751 } | 2742 } |
| 2752 | 2743 |
| 2753 | 2744 |
| 2754 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary() const { | 2745 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary() const { |
| 2755 ASSERT((InputCount() == 1) || (InputCount() == 2)); | 2746 ASSERT((InputCount() == 1) || (InputCount() == 2)); |
| 2756 const intptr_t kNumTemps = 0; | 2747 const intptr_t kNumTemps = 0; |
| 2757 LocationSummary* result = | 2748 LocationSummary* result = |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3566 PcDescriptors::kOther, | 3557 PcDescriptors::kOther, |
| 3567 locs()); | 3558 locs()); |
| 3568 __ Drop(2); // Discard type arguments and receiver. | 3559 __ Drop(2); // Discard type arguments and receiver. |
| 3569 } | 3560 } |
| 3570 | 3561 |
| 3571 } // namespace dart | 3562 } // namespace dart |
| 3572 | 3563 |
| 3573 #undef __ | 3564 #undef __ |
| 3574 | 3565 |
| 3575 #endif // defined TARGET_ARCH_IA32 | 3566 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |