| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 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 5081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5092 __ CompareObject(locs()->in(0).reg(), Object::null_object(), PP); | 5092 __ CompareObject(locs()->in(0).reg(), Object::null_object(), PP); |
| 5093 __ b(deopt, EQ); | 5093 __ b(deopt, EQ); |
| 5094 return; | 5094 return; |
| 5095 } | 5095 } |
| 5096 | 5096 |
| 5097 ASSERT((unary_checks().GetReceiverClassIdAt(0) != kSmiCid) || | 5097 ASSERT((unary_checks().GetReceiverClassIdAt(0) != kSmiCid) || |
| 5098 (unary_checks().NumberOfChecks() > 1)); | 5098 (unary_checks().NumberOfChecks() > 1)); |
| 5099 const Register value = locs()->in(0).reg(); | 5099 const Register value = locs()->in(0).reg(); |
| 5100 const Register temp = locs()->temp(0).reg(); | 5100 const Register temp = locs()->temp(0).reg(); |
| 5101 Label is_ok; | 5101 Label is_ok; |
| 5102 intptr_t cix = 0; | 5102 if (unary_checks().GetReceiverClassIdAt(0) == kSmiCid) { |
| 5103 if (unary_checks().GetReceiverClassIdAt(cix) == kSmiCid) { | |
| 5104 __ tsti(value, Immediate(kSmiTagMask)); | 5103 __ tsti(value, Immediate(kSmiTagMask)); |
| 5105 __ b(&is_ok, EQ); | 5104 __ b(&is_ok, EQ); |
| 5106 cix++; // Skip first check. | |
| 5107 } else { | 5105 } else { |
| 5108 __ tsti(value, Immediate(kSmiTagMask)); | 5106 __ tsti(value, Immediate(kSmiTagMask)); |
| 5109 __ b(deopt, EQ); | 5107 __ b(deopt, EQ); |
| 5110 } | 5108 } |
| 5111 __ LoadClassId(temp, value, PP); | 5109 __ LoadClassId(temp, value, PP); |
| 5112 | 5110 |
| 5113 if (IsDenseSwitch()) { | 5111 if (IsDenseSwitch()) { |
| 5114 ASSERT(cids_[0] < cids_[cids_.length() - 1]); | 5112 ASSERT(cids_[0] < cids_[cids_.length() - 1]); |
| 5115 __ AddImmediate(temp, temp, -cids_[0], PP); | 5113 __ AddImmediate(temp, temp, -cids_[0], PP); |
| 5116 __ CompareImmediate(temp, cids_[cids_.length() - 1] - cids_[0], PP); | 5114 __ CompareImmediate(temp, cids_[cids_.length() - 1] - cids_[0], PP); |
| 5117 __ b(deopt, HI); | 5115 __ b(deopt, HI); |
| 5118 | 5116 |
| 5119 intptr_t mask = ComputeCidMask(); | 5117 intptr_t mask = ComputeCidMask(); |
| 5120 if (!IsDenseMask(mask)) { | 5118 if (!IsDenseMask(mask)) { |
| 5121 // Only need mask if there are missing numbers in the range. | 5119 // Only need mask if there are missing numbers in the range. |
| 5122 ASSERT(cids_.length() > 2); | 5120 ASSERT(cids_.length() > 2); |
| 5123 Register mask_reg = locs()->temp(1).reg(); | 5121 Register mask_reg = locs()->temp(1).reg(); |
| 5124 __ LoadImmediate(mask_reg, 1, PP); | 5122 __ LoadImmediate(mask_reg, 1, PP); |
| 5125 __ lslv(mask_reg, mask_reg, temp); | 5123 __ lslv(mask_reg, mask_reg, temp); |
| 5126 __ TestImmediate(mask_reg, mask, PP); | 5124 __ TestImmediate(mask_reg, mask, PP); |
| 5127 __ b(deopt, EQ); | 5125 __ b(deopt, EQ); |
| 5128 } | 5126 } |
| 5129 | 5127 |
| 5130 } else { | 5128 } else { |
| 5131 const intptr_t num_checks = unary_checks().NumberOfChecks(); | 5129 GrowableArray<CidTarget> sorted_ic_data; |
| 5132 for (intptr_t i = cix; i < num_checks; i++) { | 5130 FlowGraphCompiler::SortICDataByCount(unary_checks(), |
| 5133 ASSERT(unary_checks().GetReceiverClassIdAt(i) != kSmiCid); | 5131 &sorted_ic_data, |
| 5134 __ CompareImmediate(temp, unary_checks().GetReceiverClassIdAt(i), PP); | 5132 /* drop_smi = */ true); |
| 5133 const intptr_t num_checks = sorted_ic_data.length(); |
| 5134 for (intptr_t i = 0; i < num_checks; i++) { |
| 5135 const intptr_t cid = sorted_ic_data[i].cid; |
| 5136 ASSERT(cid != kSmiCid); |
| 5137 __ CompareImmediate(temp, cid, PP); |
| 5135 if (i == (num_checks - 1)) { | 5138 if (i == (num_checks - 1)) { |
| 5136 __ b(deopt, NE); | 5139 __ b(deopt, NE); |
| 5137 } else { | 5140 } else { |
| 5138 __ b(&is_ok, EQ); | 5141 __ b(&is_ok, EQ); |
| 5139 } | 5142 } |
| 5140 } | 5143 } |
| 5141 } | 5144 } |
| 5142 __ Bind(&is_ok); | 5145 __ Bind(&is_ok); |
| 5143 } | 5146 } |
| 5144 | 5147 |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5634 1, | 5637 1, |
| 5635 locs()); | 5638 locs()); |
| 5636 __ Drop(1); | 5639 __ Drop(1); |
| 5637 __ Pop(result); | 5640 __ Pop(result); |
| 5638 } | 5641 } |
| 5639 | 5642 |
| 5640 | 5643 |
| 5641 } // namespace dart | 5644 } // namespace dart |
| 5642 | 5645 |
| 5643 #endif // defined TARGET_ARCH_ARM64 | 5646 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |