OLD | NEW |
---|---|
1 | 1 |
2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 2 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
3 // for details. All rights reserved. Use of this source code is governed by a | 3 // for details. All rights reserved. Use of this source code is governed by a |
4 // BSD-style license that can be found in the LICENSE file. | 4 // BSD-style license that can be found in the LICENSE file. |
5 | 5 |
6 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. | 6 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
7 #if defined(TARGET_ARCH_ARM) | 7 #if defined(TARGET_ARCH_ARM) |
8 | 8 |
9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
10 | 10 |
(...skipping 6282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6293 const Register value = locs()->in(0).reg(); | 6293 const Register value = locs()->in(0).reg(); |
6294 const Register temp = locs()->temp(0).reg(); | 6294 const Register temp = locs()->temp(0).reg(); |
6295 Label is_ok; | 6295 Label is_ok; |
6296 if (unary_checks().GetReceiverClassIdAt(0) == kSmiCid) { | 6296 if (unary_checks().GetReceiverClassIdAt(0) == kSmiCid) { |
6297 __ tst(value, Operand(kSmiTagMask)); | 6297 __ tst(value, Operand(kSmiTagMask)); |
6298 __ b(&is_ok, EQ); | 6298 __ b(&is_ok, EQ); |
6299 } else { | 6299 } else { |
6300 __ tst(value, Operand(kSmiTagMask)); | 6300 __ tst(value, Operand(kSmiTagMask)); |
6301 __ b(deopt, EQ); | 6301 __ b(deopt, EQ); |
6302 } | 6302 } |
6303 __ LoadClassId(temp, value); | 6303 Register biased_cid = temp; |
6304 __ LoadClassId(biased_cid, value); | |
6304 | 6305 |
6305 if (IsDenseSwitch()) { | 6306 GrowableArray<CidRangeTarget> sorted_ic_data; |
6307 FlowGraphCompiler::SortICDataByCount(unary_checks(), &sorted_ic_data, | |
6308 /* drop_smi = */ true); | |
6309 | |
6310 if (sorted_ic_data.length() > 4 && IsDenseSwitch()) { | |
Vyacheslav Egorov (Google)
2017/03/10 10:31:30
What is this magical 4? Is this the same 4 as FLAG
erikcorry
2017/03/10 13:30:01
Accidental change, reverted.
| |
6306 ASSERT(cids_[0] < cids_[cids_.length() - 1]); | 6311 ASSERT(cids_[0] < cids_[cids_.length() - 1]); |
6307 __ AddImmediate(temp, -cids_[0]); | 6312 __ AddImmediate(biased_cid, -cids_[0]); |
6308 __ CompareImmediate(temp, cids_[cids_.length() - 1] - cids_[0]); | 6313 __ CompareImmediate(biased_cid, cids_[cids_.length() - 1] - cids_[0]); |
6309 __ b(deopt, HI); | 6314 __ b(deopt, HI); |
6310 | 6315 |
6311 intptr_t mask = ComputeCidMask(); | 6316 intptr_t mask = ComputeCidMask(); |
6312 if (!IsDenseMask(mask)) { | 6317 if (!IsDenseMask(mask)) { |
6313 // Only need mask if there are missing numbers in the range. | 6318 // Only need mask if there are missing numbers in the range. |
6314 ASSERT(cids_.length() > 2); | 6319 ASSERT(cids_.length() > 2); |
6315 Register mask_reg = locs()->temp(1).reg(); | 6320 Register mask_reg = locs()->temp(1).reg(); |
6316 __ LoadImmediate(mask_reg, 1); | 6321 __ LoadImmediate(mask_reg, 1); |
6317 __ Lsl(mask_reg, mask_reg, temp); | 6322 __ Lsl(mask_reg, mask_reg, biased_cid); |
6318 __ TestImmediate(mask_reg, mask); | 6323 __ TestImmediate(mask_reg, mask); |
6319 __ b(deopt, EQ); | 6324 __ b(deopt, EQ); |
6320 } | 6325 } |
6321 } else { | 6326 } else { |
6322 GrowableArray<CidTarget> sorted_ic_data; | |
6323 FlowGraphCompiler::SortICDataByCount(unary_checks(), &sorted_ic_data, | |
6324 /* drop_smi = */ true); | |
6325 const intptr_t num_checks = sorted_ic_data.length(); | 6327 const intptr_t num_checks = sorted_ic_data.length(); |
6328 int bias = 0; | |
6326 for (intptr_t i = 0; i < num_checks; i++) { | 6329 for (intptr_t i = 0; i < num_checks; i++) { |
6327 const intptr_t cid = sorted_ic_data[i].cid; | 6330 const intptr_t cid_start = sorted_ic_data[i].cid_start; |
6328 ASSERT(cid != kSmiCid); | 6331 const intptr_t cid_end = sorted_ic_data[i].cid_end; |
6329 __ CompareImmediate(temp, cid); | 6332 ASSERT(cid_start > kSmiCid || cid_end < kSmiCid); |
6333 Condition no_match, match; | |
6334 if (cid_start == cid_end) { | |
6335 __ CompareImmediate(biased_cid, cid_start - bias); | |
6336 no_match = NE; | |
6337 match = EQ; | |
6338 } else { | |
6339 // For class ID ranges use a subtract followed by an unsigned | |
6340 // comparison to check both ends of the ranges with one comparison. | |
6341 __ AddImmediate(biased_cid, biased_cid, bias - cid_start); | |
6342 bias = cid_start; | |
6343 __ CompareImmediate(biased_cid, cid_end - cid_start); | |
6344 no_match = HI; // Unsigned higher. | |
6345 match = LS; // Unsigned lower or same. | |
6346 } | |
6330 if (i == (num_checks - 1)) { | 6347 if (i == (num_checks - 1)) { |
6331 __ b(deopt, NE); | 6348 __ b(deopt, no_match); |
6332 } else { | 6349 } else { |
6333 __ b(&is_ok, EQ); | 6350 __ b(&is_ok, match); |
6334 } | 6351 } |
6335 } | 6352 } |
6336 } | 6353 } |
6337 __ Bind(&is_ok); | 6354 __ Bind(&is_ok); |
6338 } | 6355 } |
6339 | 6356 |
6340 | 6357 |
6341 LocationSummary* CheckSmiInstr::MakeLocationSummary(Zone* zone, | 6358 LocationSummary* CheckSmiInstr::MakeLocationSummary(Zone* zone, |
6342 bool opt) const { | 6359 bool opt) const { |
6343 const intptr_t kNumInputs = 1; | 6360 const intptr_t kNumInputs = 1; |
(...skipping 882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7226 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), | 7243 compiler->GenerateRuntimeCall(TokenPosition::kNoSource, deopt_id(), |
7227 kGrowRegExpStackRuntimeEntry, 1, locs()); | 7244 kGrowRegExpStackRuntimeEntry, 1, locs()); |
7228 __ Drop(1); | 7245 __ Drop(1); |
7229 __ Pop(result); | 7246 __ Pop(result); |
7230 } | 7247 } |
7231 | 7248 |
7232 | 7249 |
7233 } // namespace dart | 7250 } // namespace dart |
7234 | 7251 |
7235 #endif // defined TARGET_ARCH_ARM | 7252 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |