| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 3011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3022 return result; | 3022 return result; |
| 3023 } | 3023 } |
| 3024 | 3024 |
| 3025 | 3025 |
| 3026 void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3026 void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3027 Register result = locs()->out().reg(); | 3027 Register result = locs()->out().reg(); |
| 3028 Register value_obj = locs()->in(0).reg(); | 3028 Register value_obj = locs()->in(0).reg(); |
| 3029 ASSERT(result == R0); | 3029 ASSERT(result == R0); |
| 3030 ASSERT(result != value_obj); | 3030 ASSERT(result != value_obj); |
| 3031 __ LoadDFromOffset(DTMP, value_obj, Double::value_offset() - kHeapObjectTag); | 3031 __ LoadDFromOffset(DTMP, value_obj, Double::value_offset() - kHeapObjectTag); |
| 3032 |
| 3033 Label do_call, done; |
| 3034 // First check for NaN. Checking for minint after the conversion doesn't work |
| 3035 // on ARM because vcvtid gives 0 for NaN. |
| 3036 __ vcmpd(DTMP, DTMP); |
| 3037 __ vmstat(); |
| 3038 __ b(&do_call, VS); |
| 3039 |
| 3032 __ vcvtid(STMP, DTMP); | 3040 __ vcvtid(STMP, DTMP); |
| 3033 __ vmovrs(result, STMP); | 3041 __ vmovrs(result, STMP); |
| 3034 // Overflow is signaled with minint. | 3042 // Overflow is signaled with minint. |
| 3035 Label do_call, done; | 3043 |
| 3036 // Check for overflow and that it fits into Smi. | 3044 // Check for overflow and that it fits into Smi. |
| 3037 __ CompareImmediate(result, 0xC0000000); | 3045 __ CompareImmediate(result, 0xC0000000); |
| 3038 __ b(&do_call, MI); | 3046 __ b(&do_call, MI); |
| 3039 __ SmiTag(result); | 3047 __ SmiTag(result); |
| 3040 __ b(&done); | 3048 __ b(&done); |
| 3041 __ Bind(&do_call); | 3049 __ Bind(&do_call); |
| 3042 __ Push(value_obj); | 3050 __ Push(value_obj); |
| 3043 ASSERT(instance_call()->HasICData()); | 3051 ASSERT(instance_call()->HasICData()); |
| 3044 const ICData& ic_data = *instance_call()->ic_data(); | 3052 const ICData& ic_data = *instance_call()->ic_data(); |
| 3045 ASSERT((ic_data.NumberOfChecks() == 1)); | 3053 ASSERT((ic_data.NumberOfChecks() == 1)); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 3064 result->set_in(0, Location::RequiresFpuRegister()); | 3072 result->set_in(0, Location::RequiresFpuRegister()); |
| 3065 result->set_out(Location::RequiresRegister()); | 3073 result->set_out(Location::RequiresRegister()); |
| 3066 return result; | 3074 return result; |
| 3067 } | 3075 } |
| 3068 | 3076 |
| 3069 | 3077 |
| 3070 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3078 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3071 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptDoubleToSmi); | 3079 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptDoubleToSmi); |
| 3072 Register result = locs()->out().reg(); | 3080 Register result = locs()->out().reg(); |
| 3073 DRegister value = locs()->in(0).fpu_reg(); | 3081 DRegister value = locs()->in(0).fpu_reg(); |
| 3082 // First check for NaN. Checking for minint after the conversion doesn't work |
| 3083 // on ARM because vcvtid gives 0 for NaN. |
| 3084 __ vcmpd(value, value); |
| 3085 __ vmstat(); |
| 3086 __ b(deopt, VS); |
| 3087 |
| 3074 __ vcvtid(STMP, value); | 3088 __ vcvtid(STMP, value); |
| 3075 __ vmovrs(result, STMP); | 3089 __ vmovrs(result, STMP); |
| 3076 // Check for overflow and that it fits into Smi. | 3090 // Check for overflow and that it fits into Smi. |
| 3077 __ CompareImmediate(result, 0xC0000000); | 3091 __ CompareImmediate(result, 0xC0000000); |
| 3078 __ b(deopt, MI); | 3092 __ b(deopt, MI); |
| 3079 __ SmiTag(result); | 3093 __ SmiTag(result); |
| 3080 } | 3094 } |
| 3081 | 3095 |
| 3082 | 3096 |
| 3083 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary() const { | 3097 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary() const { |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3648 compiler->GenerateCall(token_pos(), | 3662 compiler->GenerateCall(token_pos(), |
| 3649 &label, | 3663 &label, |
| 3650 PcDescriptors::kOther, | 3664 PcDescriptors::kOther, |
| 3651 locs()); | 3665 locs()); |
| 3652 __ Drop(2); // Discard type arguments and receiver. | 3666 __ Drop(2); // Discard type arguments and receiver. |
| 3653 } | 3667 } |
| 3654 | 3668 |
| 3655 } // namespace dart | 3669 } // namespace dart |
| 3656 | 3670 |
| 3657 #endif // defined TARGET_ARCH_ARM | 3671 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |