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/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 5469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5480 | 5480 |
5481 | 5481 |
5482 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5482 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
5483 Label* deopt = compiler->AddDeoptStub(deopt_id(), | 5483 Label* deopt = compiler->AddDeoptStub(deopt_id(), |
5484 ICData::kDeoptCheckArrayBound); | 5484 ICData::kDeoptCheckArrayBound); |
5485 | 5485 |
5486 Location length_loc = locs()->in(kLengthPos); | 5486 Location length_loc = locs()->in(kLengthPos); |
5487 Location index_loc = locs()->in(kIndexPos); | 5487 Location index_loc = locs()->in(kIndexPos); |
5488 | 5488 |
5489 if (length_loc.IsConstant() && index_loc.IsConstant()) { | 5489 if (length_loc.IsConstant() && index_loc.IsConstant()) { |
5490 // TODO(srdjan): remove this code once failures are fixed. | |
5491 if ((Smi::Cast(length_loc.constant()).Value() > | |
5492 Smi::Cast(index_loc.constant()).Value()) && | |
5493 (Smi::Cast(index_loc.constant()).Value() >= 0)) { | |
5494 // This CheckArrayBoundInstr should have been eliminated. | |
5495 return; | |
5496 } | |
5497 ASSERT((Smi::Cast(length_loc.constant()).Value() <= | 5490 ASSERT((Smi::Cast(length_loc.constant()).Value() <= |
5498 Smi::Cast(index_loc.constant()).Value()) || | 5491 Smi::Cast(index_loc.constant()).Value()) || |
5499 (Smi::Cast(index_loc.constant()).Value() < 0)); | 5492 (Smi::Cast(index_loc.constant()).Value() < 0)); |
5500 // Unconditionally deoptimize for constant bounds checks because they | 5493 // Unconditionally deoptimize for constant bounds checks because they |
5501 // only occur only when index is out-of-bounds. | 5494 // only occur only when index is out-of-bounds. |
5502 __ b(deopt); | 5495 __ b(deopt); |
5503 return; | 5496 return; |
5504 } | 5497 } |
5505 | 5498 |
5506 if (index_loc.IsConstant()) { | 5499 if (index_loc.IsConstant()) { |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6088 compiler->GenerateCall(token_pos(), | 6081 compiler->GenerateCall(token_pos(), |
6089 &label, | 6082 &label, |
6090 PcDescriptors::kOther, | 6083 PcDescriptors::kOther, |
6091 locs()); | 6084 locs()); |
6092 __ Drop(ArgumentCount()); // Discard arguments. | 6085 __ Drop(ArgumentCount()); // Discard arguments. |
6093 } | 6086 } |
6094 | 6087 |
6095 } // namespace dart | 6088 } // namespace dart |
6096 | 6089 |
6097 #endif // defined TARGET_ARCH_ARM | 6090 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |