| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2486 } | 2486 } |
| 2487 | 2487 |
| 2488 | 2488 |
| 2489 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2489 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2490 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckArrayBound); | 2490 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckArrayBound); |
| 2491 | 2491 |
| 2492 Location length_loc = locs()->in(kLengthPos); | 2492 Location length_loc = locs()->in(kLengthPos); |
| 2493 Location index_loc = locs()->in(kIndexPos); | 2493 Location index_loc = locs()->in(kIndexPos); |
| 2494 | 2494 |
| 2495 if (length_loc.IsConstant() && index_loc.IsConstant()) { | 2495 if (length_loc.IsConstant() && index_loc.IsConstant()) { |
| 2496 // TODO(srdjan): remove this code once failures are fixed. |
| 2497 if ((Smi::Cast(length_loc.constant()).Value() > |
| 2498 Smi::Cast(index_loc.constant()).Value()) && |
| 2499 (Smi::Cast(index_loc.constant()).Value() >= 0)) { |
| 2500 // This CheckArrayBoundInstr should have been eliminated. |
| 2501 return; |
| 2502 } |
| 2496 ASSERT((Smi::Cast(length_loc.constant()).Value() <= | 2503 ASSERT((Smi::Cast(length_loc.constant()).Value() <= |
| 2497 Smi::Cast(index_loc.constant()).Value()) || | 2504 Smi::Cast(index_loc.constant()).Value()) || |
| 2498 (Smi::Cast(index_loc.constant()).Value() < 0)); | 2505 (Smi::Cast(index_loc.constant()).Value() < 0)); |
| 2499 // Unconditionally deoptimize for constant bounds checks because they | 2506 // Unconditionally deoptimize for constant bounds checks because they |
| 2500 // only occur only when index is out-of-bounds. | 2507 // only occur only when index is out-of-bounds. |
| 2501 __ b(deopt); | 2508 __ b(deopt); |
| 2502 return; | 2509 return; |
| 2503 } | 2510 } |
| 2504 | 2511 |
| 2505 if (index_loc.IsConstant()) { | 2512 if (index_loc.IsConstant()) { |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2896 compiler->GenerateCall(token_pos(), | 2903 compiler->GenerateCall(token_pos(), |
| 2897 &label, | 2904 &label, |
| 2898 PcDescriptors::kOther, | 2905 PcDescriptors::kOther, |
| 2899 locs()); | 2906 locs()); |
| 2900 __ Drop(2); // Discard type arguments and receiver. | 2907 __ Drop(2); // Discard type arguments and receiver. |
| 2901 } | 2908 } |
| 2902 | 2909 |
| 2903 } // namespace dart | 2910 } // namespace dart |
| 2904 | 2911 |
| 2905 #endif // defined TARGET_ARCH_MIPS | 2912 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |