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 "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 4184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4195 | 4195 |
4196 | 4196 |
4197 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4197 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
4198 Label* deopt = compiler->AddDeoptStub(deopt_id(), | 4198 Label* deopt = compiler->AddDeoptStub(deopt_id(), |
4199 ICData::kDeoptCheckArrayBound); | 4199 ICData::kDeoptCheckArrayBound); |
4200 | 4200 |
4201 Location length_loc = locs()->in(kLengthPos); | 4201 Location length_loc = locs()->in(kLengthPos); |
4202 Location index_loc = locs()->in(kIndexPos); | 4202 Location index_loc = locs()->in(kIndexPos); |
4203 | 4203 |
4204 if (length_loc.IsConstant() && index_loc.IsConstant()) { | 4204 if (length_loc.IsConstant() && index_loc.IsConstant()) { |
4205 // TODO(srdjan): remove this code once failures are fixed. | |
4206 if ((Smi::Cast(length_loc.constant()).Value() > | |
4207 Smi::Cast(index_loc.constant()).Value()) && | |
4208 (Smi::Cast(index_loc.constant()).Value() >= 0)) { | |
4209 // This CheckArrayBoundInstr should have been eliminated. | |
4210 return; | |
4211 } | |
4212 ASSERT((Smi::Cast(length_loc.constant()).Value() <= | 4205 ASSERT((Smi::Cast(length_loc.constant()).Value() <= |
4213 Smi::Cast(index_loc.constant()).Value()) || | 4206 Smi::Cast(index_loc.constant()).Value()) || |
4214 (Smi::Cast(index_loc.constant()).Value() < 0)); | 4207 (Smi::Cast(index_loc.constant()).Value() < 0)); |
4215 // Unconditionally deoptimize for constant bounds checks because they | 4208 // Unconditionally deoptimize for constant bounds checks because they |
4216 // only occur only when index is out-of-bounds. | 4209 // only occur only when index is out-of-bounds. |
4217 __ b(deopt); | 4210 __ b(deopt); |
4218 return; | 4211 return; |
4219 } | 4212 } |
4220 | 4213 |
4221 if (index_loc.IsConstant()) { | 4214 if (index_loc.IsConstant()) { |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4502 compiler->GenerateCall(token_pos(), | 4495 compiler->GenerateCall(token_pos(), |
4503 &label, | 4496 &label, |
4504 PcDescriptors::kOther, | 4497 PcDescriptors::kOther, |
4505 locs()); | 4498 locs()); |
4506 __ Drop(ArgumentCount()); // Discard arguments. | 4499 __ Drop(ArgumentCount()); // Discard arguments. |
4507 } | 4500 } |
4508 | 4501 |
4509 } // namespace dart | 4502 } // namespace dart |
4510 | 4503 |
4511 #endif // defined TARGET_ARCH_MIPS | 4504 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |