Chromium Code Reviews| 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 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 4307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4318 } | 4318 } |
| 4319 ASSERT((Smi::Cast(length_loc.constant()).Value() <= | 4319 ASSERT((Smi::Cast(length_loc.constant()).Value() <= |
| 4320 Smi::Cast(index_loc.constant()).Value()) || | 4320 Smi::Cast(index_loc.constant()).Value()) || |
| 4321 (Smi::Cast(index_loc.constant()).Value() < 0)); | 4321 (Smi::Cast(index_loc.constant()).Value() < 0)); |
| 4322 // Unconditionally deoptimize for constant bounds checks because they | 4322 // Unconditionally deoptimize for constant bounds checks because they |
| 4323 // only occur only when index is out-of-bounds. | 4323 // only occur only when index is out-of-bounds. |
| 4324 __ b(deopt); | 4324 __ b(deopt); |
| 4325 return; | 4325 return; |
| 4326 } | 4326 } |
| 4327 | 4327 |
| 4328 intptr_t guarded_array_length = -1; | |
|
srdjan
2013/08/22 22:02:43
Instead of checking here, move the code to CheckAr
| |
| 4329 if (array_ != NULL) { | |
| 4330 if (array_->guarded_list_length() >= 0) { | |
| 4331 guarded_array_length = array_->guarded_list_length(); | |
| 4332 } | |
| 4333 } | |
| 4334 | |
| 4335 if (index_loc.IsConstant() && guarded_array_length >= 0) { | |
| 4336 const Object& index = Smi::Cast(index_loc.constant()); | |
| 4337 int32_t i = reinterpret_cast<int32_t>(index.raw()); | |
| 4338 if (i >= guarded_array_length) { | |
| 4339 // We know this bounds check will trigger a deoptimization. | |
| 4340 __ b(deopt); | |
| 4341 } | |
| 4342 // Nothing to emit. | |
| 4343 return; | |
| 4344 } | |
| 4345 | |
| 4328 if (index_loc.IsConstant()) { | 4346 if (index_loc.IsConstant()) { |
| 4329 Register length = length_loc.reg(); | 4347 Register length = length_loc.reg(); |
| 4330 const Smi& index = Smi::Cast(index_loc.constant()); | 4348 const Smi& index = Smi::Cast(index_loc.constant()); |
| 4331 __ CompareImmediate(length, reinterpret_cast<int32_t>(index.raw())); | 4349 __ CompareImmediate(length, reinterpret_cast<int32_t>(index.raw())); |
| 4332 __ b(deopt, LS); | 4350 __ b(deopt, LS); |
| 4333 } else if (length_loc.IsConstant()) { | 4351 } else if (length_loc.IsConstant()) { |
| 4334 const Smi& length = Smi::Cast(length_loc.constant()); | 4352 const Smi& length = Smi::Cast(length_loc.constant()); |
| 4335 Register index = index_loc.reg(); | 4353 Register index = index_loc.reg(); |
| 4336 __ CompareImmediate(index, reinterpret_cast<int32_t>(length.raw())); | 4354 __ CompareImmediate(index, reinterpret_cast<int32_t>(length.raw())); |
| 4337 __ b(deopt, CS); | 4355 __ b(deopt, CS); |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4643 compiler->GenerateCall(token_pos(), | 4661 compiler->GenerateCall(token_pos(), |
| 4644 &label, | 4662 &label, |
| 4645 PcDescriptors::kOther, | 4663 PcDescriptors::kOther, |
| 4646 locs()); | 4664 locs()); |
| 4647 __ Drop(2); // Discard type arguments and receiver. | 4665 __ Drop(2); // Discard type arguments and receiver. |
| 4648 } | 4666 } |
| 4649 | 4667 |
| 4650 } // namespace dart | 4668 } // namespace dart |
| 4651 | 4669 |
| 4652 #endif // defined TARGET_ARCH_ARM | 4670 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |