Chromium Code Reviews| 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 2750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2761 slow_path->entry_label(), | 2761 slow_path->entry_label(), |
| 2762 Assembler::kFarJump, | 2762 Assembler::kFarJump, |
| 2763 out_reg); | 2763 out_reg); |
| 2764 __ Bind(slow_path->exit_label()); | 2764 __ Bind(slow_path->exit_label()); |
| 2765 __ movups(FieldAddress(out_reg, Float32x4::value_offset()), value); | 2765 __ movups(FieldAddress(out_reg, Float32x4::value_offset()), value); |
| 2766 } | 2766 } |
| 2767 | 2767 |
| 2768 | 2768 |
| 2769 LocationSummary* UnboxFloat32x4Instr::MakeLocationSummary() const { | 2769 LocationSummary* UnboxFloat32x4Instr::MakeLocationSummary() const { |
| 2770 const intptr_t kNumInputs = 1; | 2770 const intptr_t kNumInputs = 1; |
| 2771 const intptr_t kNumTemps = 0; | 2771 const intptr_t value_cid = value()->Type()->ToCid(); |
| 2772 const intptr_t kNumTemps = value_cid != kFloat32x4Cid ? 1 : 0; | |
| 2772 LocationSummary* summary = | 2773 LocationSummary* summary = |
| 2773 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2774 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2774 summary->set_in(0, Location::RequiresRegister()); | 2775 summary->set_in(0, Location::RequiresRegister()); |
| 2776 if (kNumTemps > 0) { | |
| 2777 ASSERT(kNumTemps == 1); | |
| 2778 summary->set_temp(0, Location::RequiresRegister()); | |
| 2779 } | |
| 2775 summary->set_out(Location::RequiresFpuRegister()); | 2780 summary->set_out(Location::RequiresFpuRegister()); |
| 2776 return summary; | 2781 return summary; |
| 2777 } | 2782 } |
| 2778 | 2783 |
| 2779 | 2784 |
| 2780 void UnboxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2785 void UnboxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2781 const intptr_t value_cid = value()->Type()->ToCid(); | 2786 const intptr_t value_cid = value()->Type()->ToCid(); |
| 2782 const Register value = locs()->in(0).reg(); | 2787 const Register value = locs()->in(0).reg(); |
| 2783 const XmmRegister result = locs()->out().fpu_reg(); | 2788 const XmmRegister result = locs()->out().fpu_reg(); |
| 2784 | 2789 |
| 2785 ASSERT(value_cid == kFloat32x4Cid); | 2790 if (value_cid != kFloat32x4Cid) { |
|
Vyacheslav Egorov (Google)
2013/04/15 11:09:35
See the comment in the optimizer. Emit CheckClass
Cutch
2013/04/15 13:34:56
Done.
| |
| 2791 Label* deopt = compiler->AddDeoptStub(deopt_id_, kDeoptCheckClass); | |
| 2792 Register temp = locs()->temp(0).reg(); | |
| 2793 __ testl(value, Immediate(kSmiTagMask)); | |
| 2794 __ j(ZERO, deopt); | |
| 2795 __ CompareClassId(value, kFloat32x4Cid, temp); | |
| 2796 __ j(NOT_EQUAL, deopt); | |
| 2797 } | |
| 2786 __ movups(result, FieldAddress(value, Float32x4::value_offset())); | 2798 __ movups(result, FieldAddress(value, Float32x4::value_offset())); |
| 2787 } | 2799 } |
| 2788 | 2800 |
| 2789 | 2801 |
| 2790 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary() const { | 2802 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary() const { |
| 2791 const intptr_t kNumInputs = 2; | 2803 const intptr_t kNumInputs = 2; |
| 2792 const intptr_t kNumTemps = 0; | 2804 const intptr_t kNumTemps = 0; |
| 2793 LocationSummary* summary = | 2805 LocationSummary* summary = |
| 2794 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2806 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2795 summary->set_in(0, Location::RequiresFpuRegister()); | 2807 summary->set_in(0, Location::RequiresFpuRegister()); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 2808 switch (op_kind()) { | 2820 switch (op_kind()) { |
| 2809 case Token::kADD: __ addsd(left, right); break; | 2821 case Token::kADD: __ addsd(left, right); break; |
| 2810 case Token::kSUB: __ subsd(left, right); break; | 2822 case Token::kSUB: __ subsd(left, right); break; |
| 2811 case Token::kMUL: __ mulsd(left, right); break; | 2823 case Token::kMUL: __ mulsd(left, right); break; |
| 2812 case Token::kDIV: __ divsd(left, right); break; | 2824 case Token::kDIV: __ divsd(left, right); break; |
| 2813 default: UNREACHABLE(); | 2825 default: UNREACHABLE(); |
| 2814 } | 2826 } |
| 2815 } | 2827 } |
| 2816 | 2828 |
| 2817 | 2829 |
| 2830 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary() const { | |
| 2831 const intptr_t kNumInputs = 2; | |
| 2832 const intptr_t kNumTemps = 0; | |
| 2833 LocationSummary* summary = | |
| 2834 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | |
| 2835 summary->set_in(0, Location::RequiresFpuRegister()); | |
| 2836 summary->set_in(1, Location::RequiresFpuRegister()); | |
| 2837 summary->set_out(Location::SameAsFirstInput()); | |
| 2838 return summary; | |
| 2839 } | |
| 2840 | |
| 2841 | |
| 2842 void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 2843 XmmRegister left = locs()->in(0).fpu_reg(); | |
| 2844 XmmRegister right = locs()->in(1).fpu_reg(); | |
| 2845 | |
| 2846 ASSERT(locs()->out().fpu_reg() == left); | |
| 2847 | |
| 2848 switch (op_kind()) { | |
| 2849 case Token::kADD: __ addps(left, right); break; | |
| 2850 case Token::kSUB: __ subps(left, right); break; | |
| 2851 case Token::kMUL: __ mulps(left, right); break; | |
| 2852 case Token::kDIV: __ divps(left, right); break; | |
| 2853 default: UNREACHABLE(); | |
| 2854 } | |
| 2855 } | |
| 2856 | |
| 2818 LocationSummary* MathSqrtInstr::MakeLocationSummary() const { | 2857 LocationSummary* MathSqrtInstr::MakeLocationSummary() const { |
| 2819 const intptr_t kNumInputs = 1; | 2858 const intptr_t kNumInputs = 1; |
| 2820 const intptr_t kNumTemps = 0; | 2859 const intptr_t kNumTemps = 0; |
| 2821 LocationSummary* summary = | 2860 LocationSummary* summary = |
| 2822 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2861 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2823 summary->set_in(0, Location::RequiresFpuRegister()); | 2862 summary->set_in(0, Location::RequiresFpuRegister()); |
| 2824 summary->set_out(Location::RequiresFpuRegister()); | 2863 summary->set_out(Location::RequiresFpuRegister()); |
| 2825 return summary; | 2864 return summary; |
| 2826 } | 2865 } |
| 2827 | 2866 |
| (...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3944 PcDescriptors::kOther, | 3983 PcDescriptors::kOther, |
| 3945 locs()); | 3984 locs()); |
| 3946 __ Drop(2); // Discard type arguments and receiver. | 3985 __ Drop(2); // Discard type arguments and receiver. |
| 3947 } | 3986 } |
| 3948 | 3987 |
| 3949 } // namespace dart | 3988 } // namespace dart |
| 3950 | 3989 |
| 3951 #undef __ | 3990 #undef __ |
| 3952 | 3991 |
| 3953 #endif // defined TARGET_ARCH_IA32 | 3992 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |