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 "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 2759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2770 __ movl(temp, left); | 2770 __ movl(temp, left); |
2771 __ orl(temp, right); | 2771 __ orl(temp, right); |
2772 __ testl(temp, Immediate(kSmiTagMask)); | 2772 __ testl(temp, Immediate(kSmiTagMask)); |
2773 } | 2773 } |
2774 __ j(ZERO, deopt); | 2774 __ j(ZERO, deopt); |
2775 } | 2775 } |
2776 | 2776 |
2777 | 2777 |
2778 LocationSummary* BoxDoubleInstr::MakeLocationSummary() const { | 2778 LocationSummary* BoxDoubleInstr::MakeLocationSummary() const { |
2779 const intptr_t kNumInputs = 1; | 2779 const intptr_t kNumInputs = 1; |
2780 const intptr_t kNumTemps = 0; | 2780 const intptr_t kNumTemps = 1; |
2781 LocationSummary* summary = | 2781 LocationSummary* summary = |
2782 new LocationSummary(kNumInputs, | 2782 new LocationSummary(kNumInputs, |
2783 kNumTemps, | 2783 kNumTemps, |
2784 LocationSummary::kCallOnSlowPath); | 2784 LocationSummary::kCallOnSlowPath); |
2785 summary->set_in(0, Location::RequiresFpuRegister()); | 2785 summary->set_in(0, Location::RequiresFpuRegister()); |
2786 summary->set_temp(0, Location::RequiresRegister()); | |
srdjan
2013/10/30 20:50:12
Ia32 does not have many registers available, and t
| |
2786 summary->set_out(Location::RequiresRegister()); | 2787 summary->set_out(Location::RequiresRegister()); |
2787 return summary; | 2788 return summary; |
2788 } | 2789 } |
2789 | 2790 |
2790 | 2791 |
2791 class BoxDoubleSlowPath : public SlowPathCode { | 2792 class BoxDoubleSlowPath : public SlowPathCode { |
2792 public: | 2793 public: |
2793 explicit BoxDoubleSlowPath(BoxDoubleInstr* instruction) | 2794 explicit BoxDoubleSlowPath(BoxDoubleInstr* instruction) |
2794 : instruction_(instruction) { } | 2795 : instruction_(instruction) { } |
2795 | 2796 |
(...skipping 27 matching lines...) Expand all Loading... | |
2823 void BoxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2824 void BoxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2824 BoxDoubleSlowPath* slow_path = new BoxDoubleSlowPath(this); | 2825 BoxDoubleSlowPath* slow_path = new BoxDoubleSlowPath(this); |
2825 compiler->AddSlowPathCode(slow_path); | 2826 compiler->AddSlowPathCode(slow_path); |
2826 | 2827 |
2827 Register out_reg = locs()->out().reg(); | 2828 Register out_reg = locs()->out().reg(); |
2828 XmmRegister value = locs()->in(0).fpu_reg(); | 2829 XmmRegister value = locs()->in(0).fpu_reg(); |
2829 | 2830 |
2830 __ TryAllocate(compiler->double_class(), | 2831 __ TryAllocate(compiler->double_class(), |
2831 slow_path->entry_label(), | 2832 slow_path->entry_label(), |
2832 Assembler::kFarJump, | 2833 Assembler::kFarJump, |
2833 out_reg); | 2834 out_reg, |
2835 locs()->temp(0).reg()); | |
2834 __ Bind(slow_path->exit_label()); | 2836 __ Bind(slow_path->exit_label()); |
2835 __ movsd(FieldAddress(out_reg, Double::value_offset()), value); | 2837 __ movsd(FieldAddress(out_reg, Double::value_offset()), value); |
2836 } | 2838 } |
2837 | 2839 |
2838 | 2840 |
2839 LocationSummary* UnboxDoubleInstr::MakeLocationSummary() const { | 2841 LocationSummary* UnboxDoubleInstr::MakeLocationSummary() const { |
2840 const intptr_t kNumInputs = 1; | 2842 const intptr_t kNumInputs = 1; |
2841 const intptr_t value_cid = value()->Type()->ToCid(); | 2843 const intptr_t value_cid = value()->Type()->ToCid(); |
2842 const bool needs_temp = ((value_cid != kSmiCid) && (value_cid != kDoubleCid)); | 2844 const bool needs_temp = ((value_cid != kSmiCid) && (value_cid != kDoubleCid)); |
2843 const bool needs_writable_input = (value_cid == kSmiCid); | 2845 const bool needs_writable_input = (value_cid == kSmiCid); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2877 __ movl(temp, value); | 2879 __ movl(temp, value); |
2878 __ SmiUntag(temp); | 2880 __ SmiUntag(temp); |
2879 __ cvtsi2sd(result, temp); | 2881 __ cvtsi2sd(result, temp); |
2880 __ Bind(&done); | 2882 __ Bind(&done); |
2881 } | 2883 } |
2882 } | 2884 } |
2883 | 2885 |
2884 | 2886 |
2885 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary() const { | 2887 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary() const { |
2886 const intptr_t kNumInputs = 1; | 2888 const intptr_t kNumInputs = 1; |
2887 const intptr_t kNumTemps = 0; | 2889 const intptr_t kNumTemps = 1; |
2888 LocationSummary* summary = | 2890 LocationSummary* summary = |
2889 new LocationSummary(kNumInputs, | 2891 new LocationSummary(kNumInputs, |
2890 kNumTemps, | 2892 kNumTemps, |
2891 LocationSummary::kCallOnSlowPath); | 2893 LocationSummary::kCallOnSlowPath); |
2892 summary->set_in(0, Location::RequiresFpuRegister()); | 2894 summary->set_in(0, Location::RequiresFpuRegister()); |
2895 summary->set_temp(0, Location::RequiresRegister()); | |
2893 summary->set_out(Location::RequiresRegister()); | 2896 summary->set_out(Location::RequiresRegister()); |
2894 return summary; | 2897 return summary; |
2895 } | 2898 } |
2896 | 2899 |
2897 | 2900 |
2898 class BoxFloat32x4SlowPath : public SlowPathCode { | 2901 class BoxFloat32x4SlowPath : public SlowPathCode { |
2899 public: | 2902 public: |
2900 explicit BoxFloat32x4SlowPath(BoxFloat32x4Instr* instruction) | 2903 explicit BoxFloat32x4SlowPath(BoxFloat32x4Instr* instruction) |
2901 : instruction_(instruction) { } | 2904 : instruction_(instruction) { } |
2902 | 2905 |
(...skipping 27 matching lines...) Expand all Loading... | |
2930 void BoxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2933 void BoxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2931 BoxFloat32x4SlowPath* slow_path = new BoxFloat32x4SlowPath(this); | 2934 BoxFloat32x4SlowPath* slow_path = new BoxFloat32x4SlowPath(this); |
2932 compiler->AddSlowPathCode(slow_path); | 2935 compiler->AddSlowPathCode(slow_path); |
2933 | 2936 |
2934 Register out_reg = locs()->out().reg(); | 2937 Register out_reg = locs()->out().reg(); |
2935 XmmRegister value = locs()->in(0).fpu_reg(); | 2938 XmmRegister value = locs()->in(0).fpu_reg(); |
2936 | 2939 |
2937 __ TryAllocate(compiler->float32x4_class(), | 2940 __ TryAllocate(compiler->float32x4_class(), |
2938 slow_path->entry_label(), | 2941 slow_path->entry_label(), |
2939 Assembler::kFarJump, | 2942 Assembler::kFarJump, |
2940 out_reg); | 2943 out_reg, |
2944 locs()->temp(0).reg()); | |
2941 __ Bind(slow_path->exit_label()); | 2945 __ Bind(slow_path->exit_label()); |
2942 __ movups(FieldAddress(out_reg, Float32x4::value_offset()), value); | 2946 __ movups(FieldAddress(out_reg, Float32x4::value_offset()), value); |
2943 } | 2947 } |
2944 | 2948 |
2945 | 2949 |
2946 LocationSummary* UnboxFloat32x4Instr::MakeLocationSummary() const { | 2950 LocationSummary* UnboxFloat32x4Instr::MakeLocationSummary() const { |
2947 const intptr_t value_cid = value()->Type()->ToCid(); | 2951 const intptr_t value_cid = value()->Type()->ToCid(); |
2948 const intptr_t kNumInputs = 1; | 2952 const intptr_t kNumInputs = 1; |
2949 const intptr_t kNumTemps = value_cid == kFloat32x4Cid ? 0 : 1; | 2953 const intptr_t kNumTemps = value_cid == kFloat32x4Cid ? 0 : 1; |
2950 LocationSummary* summary = | 2954 LocationSummary* summary = |
(...skipping 20 matching lines...) Expand all Loading... | |
2971 __ j(ZERO, deopt); | 2975 __ j(ZERO, deopt); |
2972 __ CompareClassId(value, kFloat32x4Cid, temp); | 2976 __ CompareClassId(value, kFloat32x4Cid, temp); |
2973 __ j(NOT_EQUAL, deopt); | 2977 __ j(NOT_EQUAL, deopt); |
2974 } | 2978 } |
2975 __ movups(result, FieldAddress(value, Float32x4::value_offset())); | 2979 __ movups(result, FieldAddress(value, Float32x4::value_offset())); |
2976 } | 2980 } |
2977 | 2981 |
2978 | 2982 |
2979 LocationSummary* BoxUint32x4Instr::MakeLocationSummary() const { | 2983 LocationSummary* BoxUint32x4Instr::MakeLocationSummary() const { |
2980 const intptr_t kNumInputs = 1; | 2984 const intptr_t kNumInputs = 1; |
2981 const intptr_t kNumTemps = 0; | 2985 const intptr_t kNumTemps = 1; |
2982 LocationSummary* summary = | 2986 LocationSummary* summary = |
2983 new LocationSummary(kNumInputs, | 2987 new LocationSummary(kNumInputs, |
2984 kNumTemps, | 2988 kNumTemps, |
2985 LocationSummary::kCallOnSlowPath); | 2989 LocationSummary::kCallOnSlowPath); |
2986 summary->set_in(0, Location::RequiresFpuRegister()); | 2990 summary->set_in(0, Location::RequiresFpuRegister()); |
2991 summary->set_temp(0, Location::RequiresRegister()); | |
2987 summary->set_out(Location::RequiresRegister()); | 2992 summary->set_out(Location::RequiresRegister()); |
2988 return summary; | 2993 return summary; |
2989 } | 2994 } |
2990 | 2995 |
2991 | 2996 |
2992 class BoxUint32x4SlowPath : public SlowPathCode { | 2997 class BoxUint32x4SlowPath : public SlowPathCode { |
2993 public: | 2998 public: |
2994 explicit BoxUint32x4SlowPath(BoxUint32x4Instr* instruction) | 2999 explicit BoxUint32x4SlowPath(BoxUint32x4Instr* instruction) |
2995 : instruction_(instruction) { } | 3000 : instruction_(instruction) { } |
2996 | 3001 |
(...skipping 27 matching lines...) Expand all Loading... | |
3024 void BoxUint32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3029 void BoxUint32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3025 BoxUint32x4SlowPath* slow_path = new BoxUint32x4SlowPath(this); | 3030 BoxUint32x4SlowPath* slow_path = new BoxUint32x4SlowPath(this); |
3026 compiler->AddSlowPathCode(slow_path); | 3031 compiler->AddSlowPathCode(slow_path); |
3027 | 3032 |
3028 Register out_reg = locs()->out().reg(); | 3033 Register out_reg = locs()->out().reg(); |
3029 XmmRegister value = locs()->in(0).fpu_reg(); | 3034 XmmRegister value = locs()->in(0).fpu_reg(); |
3030 | 3035 |
3031 __ TryAllocate(compiler->uint32x4_class(), | 3036 __ TryAllocate(compiler->uint32x4_class(), |
3032 slow_path->entry_label(), | 3037 slow_path->entry_label(), |
3033 Assembler::kFarJump, | 3038 Assembler::kFarJump, |
3034 out_reg); | 3039 out_reg, |
3040 locs()->temp(0).reg()); | |
3035 __ Bind(slow_path->exit_label()); | 3041 __ Bind(slow_path->exit_label()); |
3036 __ movups(FieldAddress(out_reg, Uint32x4::value_offset()), value); | 3042 __ movups(FieldAddress(out_reg, Uint32x4::value_offset()), value); |
3037 } | 3043 } |
3038 | 3044 |
3039 | 3045 |
3040 LocationSummary* UnboxUint32x4Instr::MakeLocationSummary() const { | 3046 LocationSummary* UnboxUint32x4Instr::MakeLocationSummary() const { |
3041 const intptr_t value_cid = value()->Type()->ToCid(); | 3047 const intptr_t value_cid = value()->Type()->ToCid(); |
3042 const intptr_t kNumInputs = 1; | 3048 const intptr_t kNumInputs = 1; |
3043 const intptr_t kNumTemps = value_cid == kUint32x4Cid ? 0 : 1; | 3049 const intptr_t kNumTemps = value_cid == kUint32x4Cid ? 0 : 1; |
3044 LocationSummary* summary = | 3050 LocationSummary* summary = |
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4487 | 4493 |
4488 __ SmiTag(EAX); | 4494 __ SmiTag(EAX); |
4489 __ movl(out_reg, EAX); | 4495 __ movl(out_reg, EAX); |
4490 __ jmp(&done); | 4496 __ jmp(&done); |
4491 | 4497 |
4492 __ Bind(¬_smi); | 4498 __ Bind(¬_smi); |
4493 __ TryAllocate( | 4499 __ TryAllocate( |
4494 Class::ZoneHandle(Isolate::Current()->object_store()->mint_class()), | 4500 Class::ZoneHandle(Isolate::Current()->object_store()->mint_class()), |
4495 slow_path->entry_label(), | 4501 slow_path->entry_label(), |
4496 Assembler::kFarJump, | 4502 Assembler::kFarJump, |
4497 out_reg); | 4503 out_reg, |
4504 EDX); | |
4498 __ Bind(slow_path->exit_label()); | 4505 __ Bind(slow_path->exit_label()); |
4499 __ movsd(FieldAddress(out_reg, Mint::value_offset()), value); | 4506 __ movsd(FieldAddress(out_reg, Mint::value_offset()), value); |
4500 __ Bind(&done); | 4507 __ Bind(&done); |
4501 } | 4508 } |
4502 | 4509 |
4503 | 4510 |
4504 LocationSummary* BinaryMintOpInstr::MakeLocationSummary() const { | 4511 LocationSummary* BinaryMintOpInstr::MakeLocationSummary() const { |
4505 const intptr_t kNumInputs = 2; | 4512 const intptr_t kNumInputs = 2; |
4506 switch (op_kind()) { | 4513 switch (op_kind()) { |
4507 case Token::kBIT_AND: | 4514 case Token::kBIT_AND: |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5177 PcDescriptors::kOther, | 5184 PcDescriptors::kOther, |
5178 locs()); | 5185 locs()); |
5179 __ Drop(2); // Discard type arguments and receiver. | 5186 __ Drop(2); // Discard type arguments and receiver. |
5180 } | 5187 } |
5181 | 5188 |
5182 } // namespace dart | 5189 } // namespace dart |
5183 | 5190 |
5184 #undef __ | 5191 #undef __ |
5185 | 5192 |
5186 #endif // defined TARGET_ARCH_IA32 | 5193 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |