| 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 4661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4672 if (IsNullCheck()) { | 4672 if (IsNullCheck()) { |
| 4673 __ BranchEqual(locs()->in(0).reg(), Object::null_object(), deopt); | 4673 __ BranchEqual(locs()->in(0).reg(), Object::null_object(), deopt); |
| 4674 return; | 4674 return; |
| 4675 } | 4675 } |
| 4676 | 4676 |
| 4677 ASSERT((unary_checks().GetReceiverClassIdAt(0) != kSmiCid) || | 4677 ASSERT((unary_checks().GetReceiverClassIdAt(0) != kSmiCid) || |
| 4678 (unary_checks().NumberOfChecks() > 1)); | 4678 (unary_checks().NumberOfChecks() > 1)); |
| 4679 Register value = locs()->in(0).reg(); | 4679 Register value = locs()->in(0).reg(); |
| 4680 Register temp = locs()->temp(0).reg(); | 4680 Register temp = locs()->temp(0).reg(); |
| 4681 Label is_ok; | 4681 Label is_ok; |
| 4682 intptr_t cix = 0; | 4682 if (unary_checks().GetReceiverClassIdAt(0) == kSmiCid) { |
| 4683 if (unary_checks().GetReceiverClassIdAt(cix) == kSmiCid) { | |
| 4684 __ andi(CMPRES1, value, Immediate(kSmiTagMask)); | 4683 __ andi(CMPRES1, value, Immediate(kSmiTagMask)); |
| 4685 __ beq(CMPRES1, ZR, &is_ok); | 4684 __ beq(CMPRES1, ZR, &is_ok); |
| 4686 cix++; // Skip first check. | |
| 4687 } else { | 4685 } else { |
| 4688 __ andi(CMPRES1, value, Immediate(kSmiTagMask)); | 4686 __ andi(CMPRES1, value, Immediate(kSmiTagMask)); |
| 4689 __ beq(CMPRES1, ZR, deopt); | 4687 __ beq(CMPRES1, ZR, deopt); |
| 4690 } | 4688 } |
| 4691 __ LoadClassId(temp, value); | 4689 __ LoadClassId(temp, value); |
| 4692 | 4690 |
| 4693 if (IsDenseSwitch()) { | 4691 if (IsDenseSwitch()) { |
| 4694 ASSERT(cids_[0] < cids_[cids_.length() - 1]); | 4692 ASSERT(cids_[0] < cids_[cids_.length() - 1]); |
| 4695 __ LoadImmediate(TMP, cids_[0]); | 4693 __ LoadImmediate(TMP, cids_[0]); |
| 4696 __ subu(temp, temp, TMP); | 4694 __ subu(temp, temp, TMP); |
| 4697 __ LoadImmediate(TMP, cids_[cids_.length() - 1] - cids_[0]); | 4695 __ LoadImmediate(TMP, cids_[cids_.length() - 1] - cids_[0]); |
| 4698 __ BranchUnsignedGreater(temp, TMP, deopt); | 4696 __ BranchUnsignedGreater(temp, TMP, deopt); |
| 4699 | 4697 |
| 4700 intptr_t mask = ComputeCidMask(); | 4698 intptr_t mask = ComputeCidMask(); |
| 4701 if (!IsDenseMask(mask)) { | 4699 if (!IsDenseMask(mask)) { |
| 4702 // Only need mask if there are missing numbers in the range. | 4700 // Only need mask if there are missing numbers in the range. |
| 4703 ASSERT(cids_.length() > 2); | 4701 ASSERT(cids_.length() > 2); |
| 4704 Register mask_reg = locs()->temp(1).reg(); | 4702 Register mask_reg = locs()->temp(1).reg(); |
| 4705 __ LoadImmediate(mask_reg, 1); | 4703 __ LoadImmediate(mask_reg, 1); |
| 4706 __ sllv(mask_reg, mask_reg, temp); | 4704 __ sllv(mask_reg, mask_reg, temp); |
| 4707 __ AndImmediate(mask_reg, mask_reg, mask); | 4705 __ AndImmediate(mask_reg, mask_reg, mask); |
| 4708 __ beq(mask_reg, ZR, deopt); | 4706 __ beq(mask_reg, ZR, deopt); |
| 4709 } | 4707 } |
| 4710 } else { | 4708 } else { |
| 4711 const intptr_t num_checks = unary_checks().NumberOfChecks(); | 4709 GrowableArray<CidTarget> sorted_ic_data; |
| 4712 for (intptr_t i = cix; i < num_checks; i++) { | 4710 FlowGraphCompiler::SortICDataByCount(unary_checks(), |
| 4713 ASSERT(unary_checks().GetReceiverClassIdAt(i) != kSmiCid); | 4711 &sorted_ic_data, |
| 4714 __ LoadImmediate(TMP, unary_checks().GetReceiverClassIdAt(i)); | 4712 /* drop_smi = */ true); |
| 4713 const intptr_t num_checks = sorted_ic_data.length(); |
| 4714 for (intptr_t i = 0; i < num_checks; i++) { |
| 4715 const intptr_t cid = sorted_ic_data[i].cid; |
| 4716 ASSERT(cid != kSmiCid); |
| 4717 __ LoadImmediate(TMP, cid); |
| 4715 __ subu(CMPRES1, temp, TMP); | 4718 __ subu(CMPRES1, temp, TMP); |
| 4716 if (i == (num_checks - 1)) { | 4719 if (i == (num_checks - 1)) { |
| 4717 __ bne(CMPRES1, ZR, deopt); | 4720 __ bne(CMPRES1, ZR, deopt); |
| 4718 } else { | 4721 } else { |
| 4719 __ beq(CMPRES1, ZR, &is_ok); | 4722 __ beq(CMPRES1, ZR, &is_ok); |
| 4720 } | 4723 } |
| 4721 } | 4724 } |
| 4722 } | 4725 } |
| 4723 __ Bind(&is_ok); | 4726 __ Bind(&is_ok); |
| 4724 } | 4727 } |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5617 1, | 5620 1, |
| 5618 locs()); | 5621 locs()); |
| 5619 __ lw(result, Address(SP, 1 * kWordSize)); | 5622 __ lw(result, Address(SP, 1 * kWordSize)); |
| 5620 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 5623 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
| 5621 } | 5624 } |
| 5622 | 5625 |
| 5623 | 5626 |
| 5624 } // namespace dart | 5627 } // namespace dart |
| 5625 | 5628 |
| 5626 #endif // defined TARGET_ARCH_MIPS | 5629 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |