| 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 5001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5012 LocationSummary* result = new LocationSummary( | 5012 LocationSummary* result = new LocationSummary( |
| 5013 kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5013 kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5014 result->set_in(0, Location::RequiresFpuRegister()); | 5014 result->set_in(0, Location::RequiresFpuRegister()); |
| 5015 result->set_out(0, Location::RequiresRegister()); | 5015 result->set_out(0, Location::RequiresRegister()); |
| 5016 return result; | 5016 return result; |
| 5017 } | 5017 } |
| 5018 | 5018 |
| 5019 | 5019 |
| 5020 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5020 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5021 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi); | 5021 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi); |
| 5022 Register result = locs()->out(0).reg(); | 5022 const Register result = locs()->out(0).reg(); |
| 5023 DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); | 5023 const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); |
| 5024 // First check for NaN. Checking for minint after the conversion doesn't work | 5024 // First check for NaN. Checking for minint after the conversion doesn't work |
| 5025 // on ARM because vcvtid gives 0 for NaN. | 5025 // on ARM because vcvtid gives 0 for NaN. |
| 5026 __ vcmpd(value, value); | 5026 __ vcmpd(value, value); |
| 5027 __ vmstat(); | 5027 __ vmstat(); |
| 5028 __ b(deopt, VS); | 5028 __ b(deopt, VS); |
| 5029 | 5029 |
| 5030 __ vcvtid(STMP, value); | 5030 __ vcvtid(STMP, value); |
| 5031 __ vmovrs(result, STMP); | 5031 __ vmovrs(result, STMP); |
| 5032 // Check for overflow and that it fits into Smi. | 5032 // Check for overflow and that it fits into Smi. |
| 5033 __ CompareImmediate(result, 0xC0000000); | 5033 __ CompareImmediate(result, 0xC0000000); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5119 // Pseudo code: | 5119 // Pseudo code: |
| 5120 // if (exponent == 0.0) return 1.0; | 5120 // if (exponent == 0.0) return 1.0; |
| 5121 // if (base == 1.0) return 1.0; | 5121 // if (base == 1.0) return 1.0; |
| 5122 // if (base.isNaN || exponent.isNaN) { | 5122 // if (base.isNaN || exponent.isNaN) { |
| 5123 // return double.NAN; | 5123 // return double.NAN; |
| 5124 // } | 5124 // } |
| 5125 // if (base != -Infinity && exponent == 0.5) { | 5125 // if (base != -Infinity && exponent == 0.5) { |
| 5126 // if (base == 0.0) return 0.0; | 5126 // if (base == 0.0) return 0.0; |
| 5127 // return sqrt(value); | 5127 // return sqrt(value); |
| 5128 // } | 5128 // } |
| 5129 DRegister base = EvenDRegisterOf(locs()->in(0).fpu_reg()); | 5129 const DRegister base = EvenDRegisterOf(locs()->in(0).fpu_reg()); |
| 5130 DRegister exp = EvenDRegisterOf(locs()->in(1).fpu_reg()); | 5130 const DRegister exp = EvenDRegisterOf(locs()->in(1).fpu_reg()); |
| 5131 DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); | 5131 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); |
| 5132 Register temp = locs()->temp(0).reg(); | 5132 const Register temp = locs()->temp(0).reg(); |
| 5133 DRegister saved_base = EvenDRegisterOf(locs()->temp(1).fpu_reg()); | 5133 const DRegister saved_base = EvenDRegisterOf(locs()->temp(1).fpu_reg()); |
| 5134 ASSERT((base == result) && (result != saved_base)); | 5134 ASSERT((base == result) && (result != saved_base)); |
| 5135 | 5135 |
| 5136 Label try_sqrt, check_base, return_nan; | 5136 Label try_sqrt, check_base, return_nan; |
| 5137 __ vmovd(saved_base, base); | 5137 __ vmovd(saved_base, base); |
| 5138 __ LoadDImmediate(DTMP, 0.0, temp); | 5138 __ LoadDImmediate(DTMP, 0.0, temp); |
| 5139 __ LoadDImmediate(result, 1.0, temp); | 5139 __ LoadDImmediate(result, 1.0, temp); |
| 5140 // exponent == 0.0 -> return 1.0; | 5140 // exponent == 0.0 -> return 1.0; |
| 5141 __ vcmpd(exp, DTMP); | 5141 __ vcmpd(exp, DTMP); |
| 5142 __ vmstat(); | 5142 __ vmstat(); |
| 5143 __ b(&check_base, VS); // NaN -> check base. | 5143 __ b(&check_base, VS); // NaN -> check base. |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6081 compiler->GenerateCall(token_pos(), | 6081 compiler->GenerateCall(token_pos(), |
| 6082 &label, | 6082 &label, |
| 6083 PcDescriptors::kOther, | 6083 PcDescriptors::kOther, |
| 6084 locs()); | 6084 locs()); |
| 6085 __ Drop(ArgumentCount()); // Discard arguments. | 6085 __ Drop(ArgumentCount()); // Discard arguments. |
| 6086 } | 6086 } |
| 6087 | 6087 |
| 6088 } // namespace dart | 6088 } // namespace dart |
| 6089 | 6089 |
| 6090 #endif // defined TARGET_ARCH_ARM | 6090 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |