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 3293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3304 summary->set_in(0, needs_writable_input | 3304 summary->set_in(0, needs_writable_input |
3305 ? Location::WritableRegister() | 3305 ? Location::WritableRegister() |
3306 : Location::RequiresRegister()); | 3306 : Location::RequiresRegister()); |
3307 if (needs_temp) summary->set_temp(0, Location::RequiresRegister()); | 3307 if (needs_temp) summary->set_temp(0, Location::RequiresRegister()); |
3308 summary->set_out(0, Location::RequiresFpuRegister()); | 3308 summary->set_out(0, Location::RequiresFpuRegister()); |
3309 return summary; | 3309 return summary; |
3310 } | 3310 } |
3311 | 3311 |
3312 | 3312 |
3313 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3313 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3314 const intptr_t value_cid = value()->Type()->ToCid(); | 3314 CompileType* value_type = value()->Type(); |
| 3315 const intptr_t value_cid = value_type->ToCid(); |
3315 const Register value = locs()->in(0).reg(); | 3316 const Register value = locs()->in(0).reg(); |
3316 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); | 3317 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); |
3317 | 3318 |
3318 if (value_cid == kDoubleCid) { | 3319 if (value_cid == kDoubleCid) { |
3319 __ LoadDFromOffset(result, value, Double::value_offset() - kHeapObjectTag); | 3320 __ LoadDFromOffset(result, value, Double::value_offset() - kHeapObjectTag); |
3320 } else if (value_cid == kSmiCid) { | 3321 } else if (value_cid == kSmiCid) { |
3321 __ SmiUntag(value); // Untag input before conversion. | 3322 __ SmiUntag(value); // Untag input before conversion. |
3322 __ vmovsr(STMP, value); | 3323 __ vmovsr(STMP, value); |
3323 __ vcvtdi(result, STMP); | 3324 __ vcvtdi(result, STMP); |
3324 } else { | 3325 } else { |
3325 Label* deopt = compiler->AddDeoptStub(deopt_id_, | 3326 Label* deopt = compiler->AddDeoptStub(deopt_id_, |
3326 ICData::kDeoptBinaryDoubleOp); | 3327 ICData::kDeoptBinaryDoubleOp); |
3327 Register temp = locs()->temp(0).reg(); | 3328 Register temp = locs()->temp(0).reg(); |
3328 Label is_smi, done; | 3329 if (value_type->is_nullable() && |
3329 __ tst(value, ShifterOperand(kSmiTagMask)); | 3330 (value_type->ToNullableCid() == kDoubleCid)) { |
3330 __ b(&is_smi, EQ); | 3331 __ CompareImmediate(value, reinterpret_cast<intptr_t>(Object::null())); |
3331 __ CompareClassId(value, kDoubleCid, temp); | 3332 __ b(deopt, EQ); |
3332 __ b(deopt, NE); | 3333 // It must be double now. |
3333 __ LoadDFromOffset(result, value, Double::value_offset() - kHeapObjectTag); | 3334 __ LoadDFromOffset(result, value, |
3334 __ b(&done); | 3335 Double::value_offset() - kHeapObjectTag); |
3335 __ Bind(&is_smi); | 3336 } else { |
3336 // TODO(regis): Why do we preserve value here but not above? | 3337 Label is_smi, done; |
3337 __ mov(IP, ShifterOperand(value, ASR, 1)); // Copy and untag. | 3338 __ tst(value, ShifterOperand(kSmiTagMask)); |
3338 __ vmovsr(STMP, IP); | 3339 __ b(&is_smi, EQ); |
3339 __ vcvtdi(result, STMP); | 3340 __ CompareClassId(value, kDoubleCid, temp); |
3340 __ Bind(&done); | 3341 __ b(deopt, NE); |
| 3342 __ LoadDFromOffset(result, value, |
| 3343 Double::value_offset() - kHeapObjectTag); |
| 3344 __ b(&done); |
| 3345 __ Bind(&is_smi); |
| 3346 // TODO(regis): Why do we preserve value here but not above? |
| 3347 __ mov(IP, ShifterOperand(value, ASR, 1)); // Copy and untag. |
| 3348 __ vmovsr(STMP, IP); |
| 3349 __ vcvtdi(result, STMP); |
| 3350 __ Bind(&done); |
| 3351 } |
3341 } | 3352 } |
3342 } | 3353 } |
3343 | 3354 |
3344 | 3355 |
3345 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(bool opt) const { | 3356 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(bool opt) const { |
3346 const intptr_t kNumInputs = 1; | 3357 const intptr_t kNumInputs = 1; |
3347 const intptr_t kNumTemps = 1; | 3358 const intptr_t kNumTemps = 1; |
3348 LocationSummary* summary = | 3359 LocationSummary* summary = |
3349 new LocationSummary(kNumInputs, | 3360 new LocationSummary(kNumInputs, |
3350 kNumTemps, | 3361 kNumTemps, |
(...skipping 2715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6066 compiler->GenerateCall(token_pos(), | 6077 compiler->GenerateCall(token_pos(), |
6067 &label, | 6078 &label, |
6068 PcDescriptors::kOther, | 6079 PcDescriptors::kOther, |
6069 locs()); | 6080 locs()); |
6070 __ Drop(ArgumentCount()); // Discard arguments. | 6081 __ Drop(ArgumentCount()); // Discard arguments. |
6071 } | 6082 } |
6072 | 6083 |
6073 } // namespace dart | 6084 } // namespace dart |
6074 | 6085 |
6075 #endif // defined TARGET_ARCH_ARM | 6086 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |