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/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 4188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4199 return result; | 4199 return result; |
4200 } | 4200 } |
4201 | 4201 |
4202 | 4202 |
4203 void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4203 void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
4204 Register result = locs()->out(0).reg(); | 4204 Register result = locs()->out(0).reg(); |
4205 Register value_obj = locs()->in(0).reg(); | 4205 Register value_obj = locs()->in(0).reg(); |
4206 ASSERT(result == V0); | 4206 ASSERT(result == V0); |
4207 ASSERT(result != value_obj); | 4207 ASSERT(result != value_obj); |
4208 __ LoadDFromOffset(DTMP, value_obj, Double::value_offset() - kHeapObjectTag); | 4208 __ LoadDFromOffset(DTMP, value_obj, Double::value_offset() - kHeapObjectTag); |
4209 __ cvtwd(STMP1, DTMP); | 4209 __ truncwd(STMP1, DTMP); |
4210 __ mfc1(result, STMP1); | 4210 __ mfc1(result, STMP1); |
4211 | 4211 |
4212 // Overflow is signaled with minint. | 4212 // Overflow is signaled with minint. |
4213 Label do_call, done; | 4213 Label do_call, done; |
4214 // Check for overflow and that it fits into Smi. | 4214 // Check for overflow and that it fits into Smi. |
4215 __ LoadImmediate(TMP, 0xC0000000); | 4215 __ LoadImmediate(TMP, 0xC0000000); |
4216 __ subu(CMPRES1, result, TMP); | 4216 __ subu(CMPRES1, result, TMP); |
4217 __ bltz(CMPRES1, &do_call); | 4217 __ bltz(CMPRES1, &do_call); |
4218 __ SmiTag(result); | 4218 __ SmiTag(result); |
4219 __ b(&done); | 4219 __ b(&done); |
4220 __ Bind(&do_call); | 4220 __ Bind(&do_call); |
4221 __ Push(value_obj); | 4221 __ Push(value_obj); |
4222 ASSERT(instance_call()->HasICData()); | 4222 ASSERT(instance_call()->HasICData()); |
4223 const ICData& ic_data = *instance_call()->ic_data(); | 4223 const ICData& ic_data = *instance_call()->ic_data(); |
4224 ASSERT((ic_data.NumberOfChecks() == 1)); | 4224 ASSERT((ic_data.NumberOfChecks() == 1)); |
4225 const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(0)); | 4225 const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(0)); |
4226 | 4226 |
4227 const intptr_t kNumberOfArguments = 1; | 4227 const intptr_t kNumberOfArguments = 1; |
4228 compiler->GenerateStaticCall(deopt_id(), | 4228 compiler->GenerateStaticCall(deopt_id(), |
4229 instance_call()->token_pos(), | 4229 instance_call()->token_pos(), |
4230 target, | 4230 target, |
4231 kNumberOfArguments, | 4231 kNumberOfArguments, |
4232 Object::null_array(), // No argument names., | 4232 Object::null_array(), // No argument names. |
4233 locs(), | 4233 locs(), |
4234 ICData::Handle()); | 4234 ICData::Handle()); |
4235 __ Bind(&done); | 4235 __ Bind(&done); |
4236 } | 4236 } |
4237 | 4237 |
4238 | 4238 |
4239 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, | 4239 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, |
4240 bool opt) const { | 4240 bool opt) const { |
4241 const intptr_t kNumInputs = 1; | 4241 const intptr_t kNumInputs = 1; |
4242 const intptr_t kNumTemps = 0; | 4242 const intptr_t kNumTemps = 0; |
4243 LocationSummary* result = new(zone) LocationSummary( | 4243 LocationSummary* result = new(zone) LocationSummary( |
4244 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4244 zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
4245 result->set_in(0, Location::RequiresFpuRegister()); | 4245 result->set_in(0, Location::RequiresFpuRegister()); |
4246 result->set_out(0, Location::RequiresRegister()); | 4246 result->set_out(0, Location::RequiresRegister()); |
4247 return result; | 4247 return result; |
4248 } | 4248 } |
4249 | 4249 |
4250 | 4250 |
4251 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4251 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
4252 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi); | 4252 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi); |
4253 Register result = locs()->out(0).reg(); | 4253 Register result = locs()->out(0).reg(); |
4254 DRegister value = locs()->in(0).fpu_reg(); | 4254 DRegister value = locs()->in(0).fpu_reg(); |
4255 __ cvtwd(STMP1, value); | 4255 __ truncwd(STMP1, value); |
4256 __ mfc1(result, STMP1); | 4256 __ mfc1(result, STMP1); |
4257 | 4257 |
4258 // Check for overflow and that it fits into Smi. | 4258 // Check for overflow and that it fits into Smi. |
4259 __ LoadImmediate(TMP, 0xC0000000); | 4259 __ LoadImmediate(TMP, 0xC0000000); |
4260 __ subu(CMPRES1, result, TMP); | 4260 __ subu(CMPRES1, result, TMP); |
4261 __ bltz(CMPRES1, deopt); | 4261 __ bltz(CMPRES1, deopt); |
4262 __ SmiTag(result); | 4262 __ SmiTag(result); |
4263 } | 4263 } |
4264 | 4264 |
4265 | 4265 |
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5598 1, | 5598 1, |
5599 locs()); | 5599 locs()); |
5600 __ lw(result, Address(SP, 1 * kWordSize)); | 5600 __ lw(result, Address(SP, 1 * kWordSize)); |
5601 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 5601 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
5602 } | 5602 } |
5603 | 5603 |
5604 | 5604 |
5605 } // namespace dart | 5605 } // namespace dart |
5606 | 5606 |
5607 #endif // defined TARGET_ARCH_MIPS | 5607 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |