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 3271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3282 summary->set_in(0, needs_writable_input | 3282 summary->set_in(0, needs_writable_input |
3283 ? Location::WritableRegister() | 3283 ? Location::WritableRegister() |
3284 : Location::RequiresRegister()); | 3284 : Location::RequiresRegister()); |
3285 if (needs_temp) summary->set_temp(0, Location::RequiresRegister()); | 3285 if (needs_temp) summary->set_temp(0, Location::RequiresRegister()); |
3286 summary->set_out(0, Location::RequiresFpuRegister()); | 3286 summary->set_out(0, Location::RequiresFpuRegister()); |
3287 return summary; | 3287 return summary; |
3288 } | 3288 } |
3289 | 3289 |
3290 | 3290 |
3291 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3291 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3292 const intptr_t value_cid = value()->Type()->ToCid(); | 3292 CompileType* value_type = value()->Type(); |
| 3293 const intptr_t value_cid = value_type->ToCid(); |
3293 const Register value = locs()->in(0).reg(); | 3294 const Register value = locs()->in(0).reg(); |
3294 const XmmRegister result = locs()->out(0).fpu_reg(); | 3295 const XmmRegister result = locs()->out(0).fpu_reg(); |
3295 | 3296 |
3296 if (value_cid == kDoubleCid) { | 3297 if (value_cid == kDoubleCid) { |
3297 __ movsd(result, FieldAddress(value, Double::value_offset())); | 3298 __ movsd(result, FieldAddress(value, Double::value_offset())); |
3298 } else if (value_cid == kSmiCid) { | 3299 } else if (value_cid == kSmiCid) { |
3299 __ SmiUntag(value); // Untag input before conversion. | 3300 __ SmiUntag(value); // Untag input before conversion. |
3300 __ cvtsi2sd(result, value); | 3301 __ cvtsi2sd(result, value); |
3301 } else { | 3302 } else { |
3302 Label* deopt = compiler->AddDeoptStub(deopt_id_, | 3303 Label* deopt = compiler->AddDeoptStub(deopt_id_, |
3303 ICData::kDeoptBinaryDoubleOp); | 3304 ICData::kDeoptBinaryDoubleOp); |
3304 Register temp = locs()->temp(0).reg(); | 3305 Register temp = locs()->temp(0).reg(); |
3305 Label is_smi, done; | 3306 if (value_type->is_nullable() && |
3306 __ testl(value, Immediate(kSmiTagMask)); | 3307 (value_type->ToNullableCid() == kDoubleCid)) { |
3307 __ j(ZERO, &is_smi); | 3308 const Immediate& raw_null = |
3308 __ CompareClassId(value, kDoubleCid, temp); | 3309 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
3309 __ j(NOT_EQUAL, deopt); | 3310 __ cmpl(value, raw_null); |
3310 __ movsd(result, FieldAddress(value, Double::value_offset())); | 3311 __ j(EQUAL, deopt); |
3311 __ jmp(&done); | 3312 // It must be double now. |
3312 __ Bind(&is_smi); | 3313 __ movsd(result, FieldAddress(value, Double::value_offset())); |
3313 __ movl(temp, value); | 3314 } else { |
3314 __ SmiUntag(temp); | 3315 Label is_smi, done; |
3315 __ cvtsi2sd(result, temp); | 3316 __ testl(value, Immediate(kSmiTagMask)); |
3316 __ Bind(&done); | 3317 __ j(ZERO, &is_smi); |
| 3318 __ CompareClassId(value, kDoubleCid, temp); |
| 3319 __ j(NOT_EQUAL, deopt); |
| 3320 __ movsd(result, FieldAddress(value, Double::value_offset())); |
| 3321 __ jmp(&done); |
| 3322 __ Bind(&is_smi); |
| 3323 __ movl(temp, value); |
| 3324 __ SmiUntag(temp); |
| 3325 __ cvtsi2sd(result, temp); |
| 3326 __ Bind(&done); |
| 3327 } |
3317 } | 3328 } |
3318 } | 3329 } |
3319 | 3330 |
3320 | 3331 |
3321 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(bool opt) const { | 3332 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(bool opt) const { |
3322 const intptr_t kNumInputs = 1; | 3333 const intptr_t kNumInputs = 1; |
3323 const intptr_t kNumTemps = 0; | 3334 const intptr_t kNumTemps = 0; |
3324 LocationSummary* summary = | 3335 LocationSummary* summary = |
3325 new LocationSummary(kNumInputs, | 3336 new LocationSummary(kNumInputs, |
3326 kNumTemps, | 3337 kNumTemps, |
(...skipping 2684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6011 PcDescriptors::kOther, | 6022 PcDescriptors::kOther, |
6012 locs()); | 6023 locs()); |
6013 __ Drop(ArgumentCount()); // Discard arguments. | 6024 __ Drop(ArgumentCount()); // Discard arguments. |
6014 } | 6025 } |
6015 | 6026 |
6016 } // namespace dart | 6027 } // namespace dart |
6017 | 6028 |
6018 #undef __ | 6029 #undef __ |
6019 | 6030 |
6020 #endif // defined TARGET_ARCH_IA32 | 6031 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |