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() && (value_type->cid() == kDoubleCid)) { |
| 3060 __ BranchEqual(value, reinterpret_cast<int32_t>(Object::null()), deopt); |
| 3061 // It must be double now. |
| 3062 __ LoadDFromOffset(result, value, |
| 3063 Double::value_offset() - kHeapObjectTag); |
| 3064 } else { |
| 3065 Label is_smi, done; |
3059 | 3066 |
3060 __ andi(CMPRES1, value, Immediate(kSmiTagMask)); | 3067 __ andi(CMPRES1, value, Immediate(kSmiTagMask)); |
3061 __ beq(CMPRES1, ZR, &is_smi); | 3068 __ beq(CMPRES1, ZR, &is_smi); |
3062 __ LoadClassId(CMPRES1, value); | 3069 __ LoadClassId(CMPRES1, value); |
3063 __ BranchNotEqual(CMPRES1, kDoubleCid, deopt); | 3070 __ BranchNotEqual(CMPRES1, kDoubleCid, deopt); |
3064 __ LoadDFromOffset(result, value, Double::value_offset() - kHeapObjectTag); | 3071 __ LoadDFromOffset(result, value, |
3065 __ b(&done); | 3072 Double::value_offset() - kHeapObjectTag); |
3066 __ Bind(&is_smi); | 3073 __ b(&done); |
3067 // TODO(regis): Why do we preserve value here but not above? | 3074 __ Bind(&is_smi); |
3068 __ sra(TMP, value, 1); | 3075 // TODO(regis): Why do we preserve value here but not above? |
3069 __ mtc1(TMP, STMP1); | 3076 __ sra(TMP, value, 1); |
3070 __ cvtdw(result, STMP1); | 3077 __ mtc1(TMP, STMP1); |
3071 __ Bind(&done); | 3078 __ cvtdw(result, STMP1); |
| 3079 __ Bind(&done); |
| 3080 } |
3072 } | 3081 } |
3073 } | 3082 } |
3074 | 3083 |
3075 | 3084 |
3076 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(bool opt) const { | 3085 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(bool opt) const { |
3077 UNIMPLEMENTED(); | 3086 UNIMPLEMENTED(); |
3078 return NULL; | 3087 return NULL; |
3079 } | 3088 } |
3080 | 3089 |
3081 | 3090 |
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4487 compiler->GenerateCall(token_pos(), | 4496 compiler->GenerateCall(token_pos(), |
4488 &label, | 4497 &label, |
4489 PcDescriptors::kOther, | 4498 PcDescriptors::kOther, |
4490 locs()); | 4499 locs()); |
4491 __ Drop(ArgumentCount()); // Discard arguments. | 4500 __ Drop(ArgumentCount()); // Discard arguments. |
4492 } | 4501 } |
4493 | 4502 |
4494 } // namespace dart | 4503 } // namespace dart |
4495 | 4504 |
4496 #endif // defined TARGET_ARCH_MIPS | 4505 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |