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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 3024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3035 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); | 3035 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
3036 summary->set_in(0, needs_writable_input | 3036 summary->set_in(0, needs_writable_input |
3037 ? Location::WritableRegister() | 3037 ? Location::WritableRegister() |
3038 : Location::RequiresRegister()); | 3038 : Location::RequiresRegister()); |
3039 summary->set_out(0, Location::RequiresFpuRegister()); | 3039 summary->set_out(0, Location::RequiresFpuRegister()); |
3040 return summary; | 3040 return summary; |
3041 } | 3041 } |
3042 | 3042 |
3043 | 3043 |
3044 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3044 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
3045 const intptr_t value_cid = value()->Type()->ToCid(); | 3045 CompileType* value_type = value()->Type(); |
| 3046 const intptr_t value_cid = value_type->ToCid(); |
3046 const Register value = locs()->in(0).reg(); | 3047 const Register value = locs()->in(0).reg(); |
3047 const DRegister result = locs()->out(0).fpu_reg(); | 3048 const DRegister result = locs()->out(0).fpu_reg(); |
3048 | 3049 |
3049 if (value_cid == kDoubleCid) { | 3050 if (value_cid == kDoubleCid) { |
3050 __ LoadDFromOffset(result, value, Double::value_offset() - kHeapObjectTag); | 3051 __ LoadDFromOffset(result, value, Double::value_offset() - kHeapObjectTag); |
3051 } else if (value_cid == kSmiCid) { | 3052 } else if (value_cid == kSmiCid) { |
3052 __ SmiUntag(value); // Untag input before conversion. | 3053 __ SmiUntag(value); // Untag input before conversion. |
3053 __ mtc1(value, STMP1); | 3054 __ mtc1(value, STMP1); |
3054 __ cvtdw(result, STMP1); | 3055 __ cvtdw(result, STMP1); |
3055 } else { | 3056 } else { |
3056 Label* deopt = compiler->AddDeoptStub(deopt_id_, | 3057 Label* deopt = compiler->AddDeoptStub(deopt_id_, |
3057 ICData::kDeoptBinaryDoubleOp); | 3058 ICData::kDeoptBinaryDoubleOp); |
3058 Label is_smi, done; | 3059 if (value_type->is_nullable() && |
| 3060 (value_type->ToNullableCid() == kDoubleCid)) { |
| 3061 __ BranchEqual(value, reinterpret_cast<int32_t>(Object::null()), deopt); |
| 3062 // It must be double now. |
| 3063 __ LoadDFromOffset(result, value, |
| 3064 Double::value_offset() - kHeapObjectTag); |
| 3065 } else { |
| 3066 Label is_smi, done; |
3059 | 3067 |
3060 __ andi(CMPRES1, value, Immediate(kSmiTagMask)); | 3068 __ andi(CMPRES1, value, Immediate(kSmiTagMask)); |
3061 __ beq(CMPRES1, ZR, &is_smi); | 3069 __ beq(CMPRES1, ZR, &is_smi); |
3062 __ LoadClassId(CMPRES1, value); | 3070 __ LoadClassId(CMPRES1, value); |
3063 __ BranchNotEqual(CMPRES1, kDoubleCid, deopt); | 3071 __ BranchNotEqual(CMPRES1, kDoubleCid, deopt); |
3064 __ LoadDFromOffset(result, value, Double::value_offset() - kHeapObjectTag); | 3072 __ LoadDFromOffset(result, value, |
3065 __ b(&done); | 3073 Double::value_offset() - kHeapObjectTag); |
3066 __ Bind(&is_smi); | 3074 __ b(&done); |
3067 // TODO(regis): Why do we preserve value here but not above? | 3075 __ Bind(&is_smi); |
3068 __ sra(TMP, value, 1); | 3076 // TODO(regis): Why do we preserve value here but not above? |
3069 __ mtc1(TMP, STMP1); | 3077 __ sra(TMP, value, 1); |
3070 __ cvtdw(result, STMP1); | 3078 __ mtc1(TMP, STMP1); |
3071 __ Bind(&done); | 3079 __ cvtdw(result, STMP1); |
| 3080 __ Bind(&done); |
| 3081 } |
3072 } | 3082 } |
3073 } | 3083 } |
3074 | 3084 |
3075 | 3085 |
3076 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(bool opt) const { | 3086 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(bool opt) const { |
3077 UNIMPLEMENTED(); | 3087 UNIMPLEMENTED(); |
3078 return NULL; | 3088 return NULL; |
3079 } | 3089 } |
3080 | 3090 |
3081 | 3091 |
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4487 compiler->GenerateCall(token_pos(), | 4497 compiler->GenerateCall(token_pos(), |
4488 &label, | 4498 &label, |
4489 PcDescriptors::kOther, | 4499 PcDescriptors::kOther, |
4490 locs()); | 4500 locs()); |
4491 __ Drop(ArgumentCount()); // Discard arguments. | 4501 __ Drop(ArgumentCount()); // Discard arguments. |
4492 } | 4502 } |
4493 | 4503 |
4494 } // namespace dart | 4504 } // namespace dart |
4495 | 4505 |
4496 #endif // defined TARGET_ARCH_MIPS | 4506 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |