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 "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 5310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5321 | 5321 |
5322 | 5322 |
5323 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5323 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
5324 Label* deopt = compiler->AddDeoptStub(deopt_id(), | 5324 Label* deopt = compiler->AddDeoptStub(deopt_id(), |
5325 ICData::kDeoptCheckArrayBound); | 5325 ICData::kDeoptCheckArrayBound); |
5326 | 5326 |
5327 Location length_loc = locs()->in(kLengthPos); | 5327 Location length_loc = locs()->in(kLengthPos); |
5328 Location index_loc = locs()->in(kIndexPos); | 5328 Location index_loc = locs()->in(kIndexPos); |
5329 | 5329 |
5330 if (length_loc.IsConstant() && index_loc.IsConstant()) { | 5330 if (length_loc.IsConstant() && index_loc.IsConstant()) { |
5331 // TODO(srdjan): remove this code once failures are fixed. | |
5332 if ((Smi::Cast(length_loc.constant()).Value() > | |
5333 Smi::Cast(index_loc.constant()).Value()) && | |
5334 (Smi::Cast(index_loc.constant()).Value() >= 0)) { | |
5335 // This CheckArrayBoundInstr should have been eliminated. | |
5336 return; | |
5337 } | |
5338 ASSERT((Smi::Cast(length_loc.constant()).Value() <= | 5331 ASSERT((Smi::Cast(length_loc.constant()).Value() <= |
5339 Smi::Cast(index_loc.constant()).Value()) || | 5332 Smi::Cast(index_loc.constant()).Value()) || |
5340 (Smi::Cast(index_loc.constant()).Value() < 0)); | 5333 (Smi::Cast(index_loc.constant()).Value() < 0)); |
5341 // Unconditionally deoptimize for constant bounds checks because they | 5334 // Unconditionally deoptimize for constant bounds checks because they |
5342 // only occur only when index is out-of-bounds. | 5335 // only occur only when index is out-of-bounds. |
5343 __ jmp(deopt); | 5336 __ jmp(deopt); |
5344 return; | 5337 return; |
5345 } | 5338 } |
5346 | 5339 |
5347 if (index_loc.IsConstant()) { | 5340 if (index_loc.IsConstant()) { |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6031 PcDescriptors::kOther, | 6024 PcDescriptors::kOther, |
6032 locs()); | 6025 locs()); |
6033 __ Drop(ArgumentCount()); // Discard arguments. | 6026 __ Drop(ArgumentCount()); // Discard arguments. |
6034 } | 6027 } |
6035 | 6028 |
6036 } // namespace dart | 6029 } // namespace dart |
6037 | 6030 |
6038 #undef __ | 6031 #undef __ |
6039 | 6032 |
6040 #endif // defined TARGET_ARCH_IA32 | 6033 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |