| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 3889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3900 | 3900 |
| 3901 | 3901 |
| 3902 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3902 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3903 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckArrayBound); | 3903 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckArrayBound); |
| 3904 | 3904 |
| 3905 Location length_loc = locs()->in(kLengthPos); | 3905 Location length_loc = locs()->in(kLengthPos); |
| 3906 Location index_loc = locs()->in(kIndexPos); | 3906 Location index_loc = locs()->in(kIndexPos); |
| 3907 | 3907 |
| 3908 if (length_loc.IsConstant() && index_loc.IsConstant()) { | 3908 if (length_loc.IsConstant() && index_loc.IsConstant()) { |
| 3909 // TODO(srdjan): remove this code once failures are fixed. | 3909 // TODO(srdjan): remove this code once failures are fixed. |
| 3910 if (Smi::Cast(length_loc.constant()).Value() > | 3910 if ((Smi::Cast(length_loc.constant()).Value() > |
| 3911 Smi::Cast(index_loc.constant()).Value()) { | 3911 Smi::Cast(index_loc.constant()).Value()) && |
| 3912 (Smi::Cast(index_loc.constant()).Value() >= 0)) { |
| 3912 // This CheckArrayBoundInstr should have been eliminated. | 3913 // This CheckArrayBoundInstr should have been eliminated. |
| 3913 return; | 3914 return; |
| 3914 } | 3915 } |
| 3915 ASSERT((Smi::Cast(length_loc.constant()).Value() <= | 3916 ASSERT((Smi::Cast(length_loc.constant()).Value() <= |
| 3916 Smi::Cast(index_loc.constant()).Value()) || | 3917 Smi::Cast(index_loc.constant()).Value()) || |
| 3917 (Smi::Cast(index_loc.constant()).Value() < 0)); | 3918 (Smi::Cast(index_loc.constant()).Value() < 0)); |
| 3918 // Unconditionally deoptimize for constant bounds checks because they | 3919 // Unconditionally deoptimize for constant bounds checks because they |
| 3919 // only occur only when index is out-of-bounds. | 3920 // only occur only when index is out-of-bounds. |
| 3920 __ jmp(deopt); | 3921 __ jmp(deopt); |
| 3921 return; | 3922 return; |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4682 PcDescriptors::kOther, | 4683 PcDescriptors::kOther, |
| 4683 locs()); | 4684 locs()); |
| 4684 __ Drop(2); // Discard type arguments and receiver. | 4685 __ Drop(2); // Discard type arguments and receiver. |
| 4685 } | 4686 } |
| 4686 | 4687 |
| 4687 } // namespace dart | 4688 } // namespace dart |
| 4688 | 4689 |
| 4689 #undef __ | 4690 #undef __ |
| 4690 | 4691 |
| 4691 #endif // defined TARGET_ARCH_IA32 | 4692 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |