| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 3190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3201 const intptr_t value_cid = value_type->ToCid(); | 3201 const intptr_t value_cid = value_type->ToCid(); |
| 3202 const Register value = locs()->in(0).reg(); | 3202 const Register value = locs()->in(0).reg(); |
| 3203 const XmmRegister result = locs()->out(0).fpu_reg(); | 3203 const XmmRegister result = locs()->out(0).fpu_reg(); |
| 3204 | 3204 |
| 3205 if (value_cid == kDoubleCid) { | 3205 if (value_cid == kDoubleCid) { |
| 3206 __ movsd(result, FieldAddress(value, Double::value_offset())); | 3206 __ movsd(result, FieldAddress(value, Double::value_offset())); |
| 3207 } else if (value_cid == kSmiCid) { | 3207 } else if (value_cid == kSmiCid) { |
| 3208 __ SmiUntag(value); // Untag input before conversion. | 3208 __ SmiUntag(value); // Untag input before conversion. |
| 3209 __ cvtsi2sdq(result, value); | 3209 __ cvtsi2sdq(result, value); |
| 3210 } else { | 3210 } else { |
| 3211 Label* deopt = compiler->AddDeoptStub(deopt_id_, | 3211 Label* deopt = compiler->AddDeoptStub(GetDeoptId(), |
| 3212 ICData::kDeoptBinaryDoubleOp); | 3212 ICData::kDeoptBinaryDoubleOp); |
| 3213 if (value_type->is_nullable() && | 3213 if (value_type->is_nullable() && |
| 3214 (value_type->ToNullableCid() == kDoubleCid)) { | 3214 (value_type->ToNullableCid() == kDoubleCid)) { |
| 3215 const Immediate& raw_null = | 3215 const Immediate& raw_null = |
| 3216 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 3216 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 3217 __ cmpq(value, raw_null); | 3217 __ cmpq(value, raw_null); |
| 3218 __ j(EQUAL, deopt); | 3218 __ j(EQUAL, deopt); |
| 3219 // It must be double now. | 3219 // It must be double now. |
| 3220 __ movsd(result, FieldAddress(value, Double::value_offset())); | 3220 __ movsd(result, FieldAddress(value, Double::value_offset())); |
| 3221 } else { | 3221 } else { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3268 LocationSummary::kNoCall); | 3268 LocationSummary::kNoCall); |
| 3269 } | 3269 } |
| 3270 | 3270 |
| 3271 | 3271 |
| 3272 void UnboxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3272 void UnboxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3273 const intptr_t value_cid = value()->Type()->ToCid(); | 3273 const intptr_t value_cid = value()->Type()->ToCid(); |
| 3274 const Register value = locs()->in(0).reg(); | 3274 const Register value = locs()->in(0).reg(); |
| 3275 const XmmRegister result = locs()->out(0).fpu_reg(); | 3275 const XmmRegister result = locs()->out(0).fpu_reg(); |
| 3276 | 3276 |
| 3277 if (value_cid != kFloat32x4Cid) { | 3277 if (value_cid != kFloat32x4Cid) { |
| 3278 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass); | 3278 Label* deopt = |
| 3279 compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptCheckClass); |
| 3279 __ testq(value, Immediate(kSmiTagMask)); | 3280 __ testq(value, Immediate(kSmiTagMask)); |
| 3280 __ j(ZERO, deopt); | 3281 __ j(ZERO, deopt); |
| 3281 __ CompareClassId(value, kFloat32x4Cid); | 3282 __ CompareClassId(value, kFloat32x4Cid); |
| 3282 __ j(NOT_EQUAL, deopt); | 3283 __ j(NOT_EQUAL, deopt); |
| 3283 } | 3284 } |
| 3284 __ movups(result, FieldAddress(value, Float32x4::value_offset())); | 3285 __ movups(result, FieldAddress(value, Float32x4::value_offset())); |
| 3285 } | 3286 } |
| 3286 | 3287 |
| 3287 | 3288 |
| 3288 LocationSummary* BoxFloat64x2Instr::MakeLocationSummary(Isolate* isolate, | 3289 LocationSummary* BoxFloat64x2Instr::MakeLocationSummary(Isolate* isolate, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3321 return summary; | 3322 return summary; |
| 3322 } | 3323 } |
| 3323 | 3324 |
| 3324 | 3325 |
| 3325 void UnboxFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3326 void UnboxFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3326 const intptr_t value_cid = value()->Type()->ToCid(); | 3327 const intptr_t value_cid = value()->Type()->ToCid(); |
| 3327 const Register value = locs()->in(0).reg(); | 3328 const Register value = locs()->in(0).reg(); |
| 3328 const XmmRegister result = locs()->out(0).fpu_reg(); | 3329 const XmmRegister result = locs()->out(0).fpu_reg(); |
| 3329 | 3330 |
| 3330 if (value_cid != kFloat64x2Cid) { | 3331 if (value_cid != kFloat64x2Cid) { |
| 3331 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass); | 3332 Label* deopt = |
| 3333 compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptCheckClass); |
| 3332 __ testq(value, Immediate(kSmiTagMask)); | 3334 __ testq(value, Immediate(kSmiTagMask)); |
| 3333 __ j(ZERO, deopt); | 3335 __ j(ZERO, deopt); |
| 3334 __ CompareClassId(value, kFloat64x2Cid); | 3336 __ CompareClassId(value, kFloat64x2Cid); |
| 3335 __ j(NOT_EQUAL, deopt); | 3337 __ j(NOT_EQUAL, deopt); |
| 3336 } | 3338 } |
| 3337 __ movups(result, FieldAddress(value, Float64x2::value_offset())); | 3339 __ movups(result, FieldAddress(value, Float64x2::value_offset())); |
| 3338 } | 3340 } |
| 3339 | 3341 |
| 3340 | 3342 |
| 3341 LocationSummary* BoxInt32x4Instr::MakeLocationSummary(Isolate* isolate, | 3343 LocationSummary* BoxInt32x4Instr::MakeLocationSummary(Isolate* isolate, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3373 return summary; | 3375 return summary; |
| 3374 } | 3376 } |
| 3375 | 3377 |
| 3376 | 3378 |
| 3377 void UnboxInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3379 void UnboxInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3378 const intptr_t value_cid = value()->Type()->ToCid(); | 3380 const intptr_t value_cid = value()->Type()->ToCid(); |
| 3379 const Register value = locs()->in(0).reg(); | 3381 const Register value = locs()->in(0).reg(); |
| 3380 const XmmRegister result = locs()->out(0).fpu_reg(); | 3382 const XmmRegister result = locs()->out(0).fpu_reg(); |
| 3381 | 3383 |
| 3382 if (value_cid != kInt32x4Cid) { | 3384 if (value_cid != kInt32x4Cid) { |
| 3383 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass); | 3385 Label* deopt = |
| 3386 compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptCheckClass); |
| 3384 __ testq(value, Immediate(kSmiTagMask)); | 3387 __ testq(value, Immediate(kSmiTagMask)); |
| 3385 __ j(ZERO, deopt); | 3388 __ j(ZERO, deopt); |
| 3386 __ CompareClassId(value, kInt32x4Cid); | 3389 __ CompareClassId(value, kInt32x4Cid); |
| 3387 __ j(NOT_EQUAL, deopt); | 3390 __ j(NOT_EQUAL, deopt); |
| 3388 } | 3391 } |
| 3389 __ movups(result, FieldAddress(value, Int32x4::value_offset())); | 3392 __ movups(result, FieldAddress(value, Int32x4::value_offset())); |
| 3390 } | 3393 } |
| 3391 | 3394 |
| 3392 | 3395 |
| 3393 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Isolate* isolate, | 3396 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Isolate* isolate, |
| (...skipping 2197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5591 summary->set_temp(0, Location::RequiresRegister()); | 5594 summary->set_temp(0, Location::RequiresRegister()); |
| 5592 } | 5595 } |
| 5593 return summary; | 5596 return summary; |
| 5594 } | 5597 } |
| 5595 | 5598 |
| 5596 | 5599 |
| 5597 void UnboxIntNInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5600 void UnboxIntNInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5598 const intptr_t value_cid = value()->Type()->ToCid(); | 5601 const intptr_t value_cid = value()->Type()->ToCid(); |
| 5599 const Register value = locs()->in(0).reg(); | 5602 const Register value = locs()->in(0).reg(); |
| 5600 Label* deopt = CanDeoptimize() ? | 5603 Label* deopt = CanDeoptimize() ? |
| 5601 compiler->AddDeoptStub(deopt_id_, ICData::kDeoptUnboxInteger) : NULL; | 5604 compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptUnboxInteger) : NULL; |
| 5602 ASSERT(value == locs()->out(0).reg()); | 5605 ASSERT(value == locs()->out(0).reg()); |
| 5603 | 5606 |
| 5604 if (value_cid == kSmiCid) { | 5607 if (value_cid == kSmiCid) { |
| 5605 __ SmiUntag(value); | 5608 __ SmiUntag(value); |
| 5606 } else if (value_cid == kMintCid) { | 5609 } else if (value_cid == kMintCid) { |
| 5607 __ movq(value, FieldAddress(value, Mint::value_offset())); | 5610 __ movq(value, FieldAddress(value, Mint::value_offset())); |
| 5608 } else { | 5611 } else { |
| 5609 Label done; | 5612 Label done; |
| 5610 // Optimistically untag value. | 5613 // Optimistically untag value. |
| 5611 __ SmiUntagOrCheckClass(value, kMintCid, &done); | 5614 __ SmiUntagOrCheckClass(value, kMintCid, &done); |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5967 __ movq(R10, Immediate(kInvalidObjectPointer)); | 5970 __ movq(R10, Immediate(kInvalidObjectPointer)); |
| 5968 __ movq(RBX, Immediate(kInvalidObjectPointer)); | 5971 __ movq(RBX, Immediate(kInvalidObjectPointer)); |
| 5969 #endif | 5972 #endif |
| 5970 } | 5973 } |
| 5971 | 5974 |
| 5972 } // namespace dart | 5975 } // namespace dart |
| 5973 | 5976 |
| 5974 #undef __ | 5977 #undef __ |
| 5975 | 5978 |
| 5976 #endif // defined TARGET_ARCH_X64 | 5979 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |