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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
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 5242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5253 | 5253 |
5254 | 5254 |
5255 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5255 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
5256 Label* deopt = compiler->AddDeoptStub(deopt_id(), | 5256 Label* deopt = compiler->AddDeoptStub(deopt_id(), |
5257 ICData::kDeoptCheckArrayBound); | 5257 ICData::kDeoptCheckArrayBound); |
5258 | 5258 |
5259 Location length_loc = locs()->in(kLengthPos); | 5259 Location length_loc = locs()->in(kLengthPos); |
5260 Location index_loc = locs()->in(kIndexPos); | 5260 Location index_loc = locs()->in(kIndexPos); |
5261 | 5261 |
5262 if (length_loc.IsConstant() && index_loc.IsConstant()) { | 5262 if (length_loc.IsConstant() && index_loc.IsConstant()) { |
5263 // TODO(srdjan): remove this code once failures are fixed. | |
5264 if ((Smi::Cast(length_loc.constant()).Value() > | |
5265 Smi::Cast(index_loc.constant()).Value()) && | |
5266 (Smi::Cast(index_loc.constant()).Value() >= 0)) { | |
5267 // This CheckArrayBoundInstr should have been eliminated. | |
5268 return; | |
5269 } | |
5270 ASSERT((Smi::Cast(length_loc.constant()).Value() <= | 5263 ASSERT((Smi::Cast(length_loc.constant()).Value() <= |
5271 Smi::Cast(index_loc.constant()).Value()) || | 5264 Smi::Cast(index_loc.constant()).Value()) || |
5272 (Smi::Cast(index_loc.constant()).Value() < 0)); | 5265 (Smi::Cast(index_loc.constant()).Value() < 0)); |
5273 // Unconditionally deoptimize for constant bounds checks because they | 5266 // Unconditionally deoptimize for constant bounds checks because they |
5274 // only occur only when index is out-of-bounds. | 5267 // only occur only when index is out-of-bounds. |
5275 __ jmp(deopt); | 5268 __ jmp(deopt); |
5276 return; | 5269 return; |
5277 } | 5270 } |
5278 | 5271 |
5279 if (index_loc.IsConstant()) { | 5272 if (index_loc.IsConstant()) { |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5612 PcDescriptors::kOther, | 5605 PcDescriptors::kOther, |
5613 locs()); | 5606 locs()); |
5614 __ Drop(ArgumentCount()); // Discard arguments. | 5607 __ Drop(ArgumentCount()); // Discard arguments. |
5615 } | 5608 } |
5616 | 5609 |
5617 } // namespace dart | 5610 } // namespace dart |
5618 | 5611 |
5619 #undef __ | 5612 #undef __ |
5620 | 5613 |
5621 #endif // defined TARGET_ARCH_X64 | 5614 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |