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/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 3881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3892 switch (op_kind()) { | 3892 switch (op_kind()) { |
3893 case Token::kADD: __ addsd(left, right); break; | 3893 case Token::kADD: __ addsd(left, right); break; |
3894 case Token::kSUB: __ subsd(left, right); break; | 3894 case Token::kSUB: __ subsd(left, right); break; |
3895 case Token::kMUL: __ mulsd(left, right); break; | 3895 case Token::kMUL: __ mulsd(left, right); break; |
3896 case Token::kDIV: __ divsd(left, right); break; | 3896 case Token::kDIV: __ divsd(left, right); break; |
3897 default: UNREACHABLE(); | 3897 default: UNREACHABLE(); |
3898 } | 3898 } |
3899 } | 3899 } |
3900 | 3900 |
3901 | 3901 |
| 3902 LocationSummary* DoubleTestOpInstr::MakeLocationSummary(Zone* zone, |
| 3903 bool opt) const { |
| 3904 const intptr_t kNumInputs = 1; |
| 3905 const intptr_t kNumTemps = 0; |
| 3906 LocationSummary* summary = new(zone) LocationSummary( |
| 3907 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3908 summary->set_in(0, Location::RequiresFpuRegister()); |
| 3909 summary->set_out(0, Location::RequiresRegister()); |
| 3910 return summary; |
| 3911 } |
| 3912 |
| 3913 |
| 3914 void DoubleTestOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3915 ASSERT(compiler->is_optimizing()); |
| 3916 const XmmRegister value = locs()->in(0).fpu_reg(); |
| 3917 const Register result = locs()->out(0).reg(); |
| 3918 if (op_kind() == MethodRecognizer::kDouble_getIsNaN) { |
| 3919 Label is_nan; |
| 3920 __ LoadObject(result, Bool::True()); |
| 3921 __ comisd(value, value); |
| 3922 __ j(PARITY_EVEN, &is_nan, Assembler::kNearJump); |
| 3923 __ LoadObject(result, Bool::False()); |
| 3924 __ Bind(&is_nan); |
| 3925 } else { |
| 3926 ASSERT(op_kind() == MethodRecognizer::kDouble_getIsInfinite); |
| 3927 Label not_inf, done; |
| 3928 __ AddImmediate(ESP, Immediate(-kDoubleSize)); |
| 3929 __ movsd(Address(ESP, 0), value); |
| 3930 __ movl(result, Address(ESP, 0)); |
| 3931 // If the low word isn't zero, then it isn't infinity. |
| 3932 __ cmpl(result, Immediate(0)); |
| 3933 __ j(NOT_EQUAL, ¬_inf, Assembler::kNearJump); |
| 3934 // Check the high word. |
| 3935 __ movl(result, Address(ESP, kWordSize)); |
| 3936 // Mask off sign bit. |
| 3937 __ andl(result, Immediate(0x7FFFFFFF)); |
| 3938 // Compare with +infinity. |
| 3939 __ cmpl(result, Immediate(0x7FF00000)); |
| 3940 __ j(NOT_EQUAL, ¬_inf, Assembler::kNearJump); |
| 3941 __ LoadObject(result, Bool::True()); |
| 3942 __ jmp(&done); |
| 3943 |
| 3944 __ Bind(¬_inf); |
| 3945 __ LoadObject(result, Bool::False()); |
| 3946 __ Bind(&done); |
| 3947 __ AddImmediate(ESP, Immediate(kDoubleSize)); |
| 3948 } |
| 3949 } |
| 3950 |
| 3951 |
3902 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, | 3952 LocationSummary* BinaryFloat32x4OpInstr::MakeLocationSummary(Zone* zone, |
3903 bool opt) const { | 3953 bool opt) const { |
3904 const intptr_t kNumInputs = 2; | 3954 const intptr_t kNumInputs = 2; |
3905 const intptr_t kNumTemps = 0; | 3955 const intptr_t kNumTemps = 0; |
3906 LocationSummary* summary = new(zone) LocationSummary( | 3956 LocationSummary* summary = new(zone) LocationSummary( |
3907 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 3957 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
3908 summary->set_in(0, Location::RequiresFpuRegister()); | 3958 summary->set_in(0, Location::RequiresFpuRegister()); |
3909 summary->set_in(1, Location::RequiresFpuRegister()); | 3959 summary->set_in(1, Location::RequiresFpuRegister()); |
3910 summary->set_out(0, Location::SameAsFirstInput()); | 3960 summary->set_out(0, Location::SameAsFirstInput()); |
3911 return summary; | 3961 return summary; |
(...skipping 2970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6882 __ Drop(1); | 6932 __ Drop(1); |
6883 __ popl(result); | 6933 __ popl(result); |
6884 } | 6934 } |
6885 | 6935 |
6886 | 6936 |
6887 } // namespace dart | 6937 } // namespace dart |
6888 | 6938 |
6889 #undef __ | 6939 #undef __ |
6890 | 6940 |
6891 #endif // defined TARGET_ARCH_IA32 | 6941 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |