| 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 4266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4277 | 4277 |
| 4278 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4278 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4279 __ TraceSimMsg("BranchInstr"); | 4279 __ TraceSimMsg("BranchInstr"); |
| 4280 comparison()->EmitBranchCode(compiler, this); | 4280 comparison()->EmitBranchCode(compiler, this); |
| 4281 } | 4281 } |
| 4282 | 4282 |
| 4283 | 4283 |
| 4284 LocationSummary* CheckClassInstr::MakeLocationSummary(Isolate* isolate, | 4284 LocationSummary* CheckClassInstr::MakeLocationSummary(Isolate* isolate, |
| 4285 bool opt) const { | 4285 bool opt) const { |
| 4286 const intptr_t kNumInputs = 1; | 4286 const intptr_t kNumInputs = 1; |
| 4287 const bool need_mask_temp = IsDenseSwitch() && !IsDenseMask(ComputeCidMask()); | 4287 const intptr_t kNumTemps = !IsNullCheck() ? 1 : 0; |
| 4288 const intptr_t kNumTemps = !IsNullCheck() ? (need_mask_temp ? 2 : 1) : 0; | |
| 4289 LocationSummary* summary = new(isolate) LocationSummary( | 4288 LocationSummary* summary = new(isolate) LocationSummary( |
| 4290 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4289 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4291 summary->set_in(0, Location::RequiresRegister()); | 4290 summary->set_in(0, Location::RequiresRegister()); |
| 4292 if (!IsNullCheck()) { | 4291 if (!IsNullCheck()) { |
| 4293 summary->set_temp(0, Location::RequiresRegister()); | 4292 summary->set_temp(0, Location::RequiresRegister()); |
| 4294 if (need_mask_temp) { | |
| 4295 summary->set_temp(1, Location::RequiresRegister()); | |
| 4296 } | |
| 4297 } | 4293 } |
| 4298 return summary; | 4294 return summary; |
| 4299 } | 4295 } |
| 4300 | 4296 |
| 4301 | 4297 |
| 4302 void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4298 void CheckClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4303 const ICData::DeoptReasonId deopt_reason = licm_hoisted_ ? | 4299 const ICData::DeoptReasonId deopt_reason = licm_hoisted_ ? |
| 4304 ICData::kDeoptHoistedCheckClass : ICData::kDeoptCheckClass; | 4300 ICData::kDeoptHoistedCheckClass : ICData::kDeoptCheckClass; |
| 4305 if (IsNullCheck()) { | 4301 if (IsNullCheck()) { |
| 4306 Label* deopt = compiler->AddDeoptStub(deopt_id(), deopt_reason); | 4302 Label* deopt = compiler->AddDeoptStub(deopt_id(), deopt_reason); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4318 intptr_t cix = 0; | 4314 intptr_t cix = 0; |
| 4319 if (unary_checks().GetReceiverClassIdAt(cix) == kSmiCid) { | 4315 if (unary_checks().GetReceiverClassIdAt(cix) == kSmiCid) { |
| 4320 __ andi(CMPRES1, value, Immediate(kSmiTagMask)); | 4316 __ andi(CMPRES1, value, Immediate(kSmiTagMask)); |
| 4321 __ beq(CMPRES1, ZR, &is_ok); | 4317 __ beq(CMPRES1, ZR, &is_ok); |
| 4322 cix++; // Skip first check. | 4318 cix++; // Skip first check. |
| 4323 } else { | 4319 } else { |
| 4324 __ andi(CMPRES1, value, Immediate(kSmiTagMask)); | 4320 __ andi(CMPRES1, value, Immediate(kSmiTagMask)); |
| 4325 __ beq(CMPRES1, ZR, deopt); | 4321 __ beq(CMPRES1, ZR, deopt); |
| 4326 } | 4322 } |
| 4327 __ LoadClassId(temp, value); | 4323 __ LoadClassId(temp, value); |
| 4328 | 4324 const intptr_t num_checks = unary_checks().NumberOfChecks(); |
| 4329 if (IsDenseSwitch()) { | 4325 for (intptr_t i = cix; i < num_checks; i++) { |
| 4330 ASSERT(cids_[0] < cids_[cids_.length() - 1]); | 4326 ASSERT(unary_checks().GetReceiverClassIdAt(i) != kSmiCid); |
| 4331 __ LoadImmediate(TMP, cids_[0]); | 4327 __ LoadImmediate(TMP, unary_checks().GetReceiverClassIdAt(i)); |
| 4332 __ subu(temp, temp, TMP); | 4328 __ subu(CMPRES1, temp, TMP); |
| 4333 __ LoadImmediate(TMP, cids_[cids_.length() - 1] - cids_[0]); | 4329 if (i == (num_checks - 1)) { |
| 4334 __ BranchUnsignedGreater(temp, TMP, deopt); | 4330 __ bne(CMPRES1, ZR, deopt); |
| 4335 | 4331 } else { |
| 4336 intptr_t mask = ComputeCidMask(); | 4332 __ beq(CMPRES1, ZR, &is_ok); |
| 4337 if (!IsDenseMask(mask)) { | |
| 4338 // Only need mask if there are missing numbers in the range. | |
| 4339 ASSERT(cids_.length() > 2); | |
| 4340 Register mask_reg = locs()->temp(1).reg(); | |
| 4341 __ LoadImmediate(mask_reg, 1); | |
| 4342 __ sllv(mask_reg, mask_reg, temp); | |
| 4343 __ AndImmediate(mask_reg, mask_reg, mask); | |
| 4344 __ beq(mask_reg, ZR, deopt); | |
| 4345 } | |
| 4346 } else { | |
| 4347 const intptr_t num_checks = unary_checks().NumberOfChecks(); | |
| 4348 for (intptr_t i = cix; i < num_checks; i++) { | |
| 4349 ASSERT(unary_checks().GetReceiverClassIdAt(i) != kSmiCid); | |
| 4350 __ LoadImmediate(TMP, unary_checks().GetReceiverClassIdAt(i)); | |
| 4351 __ subu(CMPRES1, temp, TMP); | |
| 4352 if (i == (num_checks - 1)) { | |
| 4353 __ bne(CMPRES1, ZR, deopt); | |
| 4354 } else { | |
| 4355 __ beq(CMPRES1, ZR, &is_ok); | |
| 4356 } | |
| 4357 } | 4333 } |
| 4358 } | 4334 } |
| 4359 __ Bind(&is_ok); | 4335 __ Bind(&is_ok); |
| 4360 } | 4336 } |
| 4361 | 4337 |
| 4362 | 4338 |
| 4363 LocationSummary* CheckSmiInstr::MakeLocationSummary(Isolate* isolate, | 4339 LocationSummary* CheckSmiInstr::MakeLocationSummary(Isolate* isolate, |
| 4364 bool opt) const { | 4340 bool opt) const { |
| 4365 const intptr_t kNumInputs = 1; | 4341 const intptr_t kNumInputs = 1; |
| 4366 const intptr_t kNumTemps = 0; | 4342 const intptr_t kNumTemps = 0; |
| 4367 LocationSummary* summary = new(isolate) LocationSummary( | 4343 LocationSummary* summary = new(isolate) LocationSummary( |
| 4368 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4344 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4369 summary->set_in(0, Location::RequiresRegister()); | 4345 summary->set_in(0, Location::RequiresRegister()); |
| 4370 return summary; | 4346 return summary; |
| 4371 } | 4347 } |
| 4372 | 4348 |
| 4373 | 4349 |
| 4374 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4350 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4375 __ TraceSimMsg("CheckSmiInstr"); | 4351 __ TraceSimMsg("CheckSmiInstr"); |
| 4376 Register value = locs()->in(0).reg(); | 4352 Register value = locs()->in(0).reg(); |
| 4377 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckSmi); | 4353 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckSmi); |
| 4378 __ andi(CMPRES1, value, Immediate(kSmiTagMask)); | 4354 __ andi(CMPRES1, value, Immediate(kSmiTagMask)); |
| 4379 __ bne(CMPRES1, ZR, deopt); | 4355 __ bne(CMPRES1, ZR, deopt); |
| 4380 } | 4356 } |
| 4381 | 4357 |
| 4382 | 4358 |
| 4383 LocationSummary* CheckClassIdInstr::MakeLocationSummary(Isolate* isolate, | |
| 4384 bool opt) const { | |
| 4385 const intptr_t kNumInputs = 2; | |
| 4386 const intptr_t kNumTemps = 0; | |
| 4387 LocationSummary* summary = new(isolate) LocationSummary( | |
| 4388 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | |
| 4389 summary->set_in(0, Location::RequiresRegister()); | |
| 4390 summary->set_in(1, Location::RegisterOrSmiConstant(right())); | |
| 4391 return summary; | |
| 4392 } | |
| 4393 | |
| 4394 | |
| 4395 void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | |
| 4396 Register left = locs()->in(0).reg(); | |
| 4397 Location right = locs()->in(1); | |
| 4398 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckClass); | |
| 4399 if (right.IsRegister()) { | |
| 4400 __ bne(left, right.reg(), deopt); | |
| 4401 } else { | |
| 4402 ASSERT(right.IsConstant()); | |
| 4403 const Object& right_const = Smi::Cast(right.constant()); | |
| 4404 __ BranchNotEqual(left, | |
| 4405 reinterpret_cast<int32_t>(right_const.raw()), | |
| 4406 deopt); | |
| 4407 } | |
| 4408 } | |
| 4409 | |
| 4410 | |
| 4411 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Isolate* isolate, | 4359 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Isolate* isolate, |
| 4412 bool opt) const { | 4360 bool opt) const { |
| 4413 const intptr_t kNumInputs = 2; | 4361 const intptr_t kNumInputs = 2; |
| 4414 const intptr_t kNumTemps = 0; | 4362 const intptr_t kNumTemps = 0; |
| 4415 LocationSummary* locs = new(isolate) LocationSummary( | 4363 LocationSummary* locs = new(isolate) LocationSummary( |
| 4416 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4364 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4417 locs->set_in(kLengthPos, Location::RegisterOrSmiConstant(length())); | 4365 locs->set_in(kLengthPos, Location::RegisterOrSmiConstant(length())); |
| 4418 locs->set_in(kIndexPos, Location::RegisterOrSmiConstant(index())); | 4366 locs->set_in(kIndexPos, Location::RegisterOrSmiConstant(index())); |
| 4419 return locs; | 4367 return locs; |
| 4420 } | 4368 } |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4762 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 4710 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
| 4763 #if defined(DEBUG) | 4711 #if defined(DEBUG) |
| 4764 __ LoadImmediate(S4, kInvalidObjectPointer); | 4712 __ LoadImmediate(S4, kInvalidObjectPointer); |
| 4765 __ LoadImmediate(S5, kInvalidObjectPointer); | 4713 __ LoadImmediate(S5, kInvalidObjectPointer); |
| 4766 #endif | 4714 #endif |
| 4767 } | 4715 } |
| 4768 | 4716 |
| 4769 } // namespace dart | 4717 } // namespace dart |
| 4770 | 4718 |
| 4771 #endif // defined TARGET_ARCH_MIPS | 4719 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |