Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: runtime/vm/intermediate_language_arm.cc

Issue 14566020: - Correctly handle negative constant indices when (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "lib/error.h" 10 #include "lib/error.h"
(...skipping 2498 matching lines...) Expand 10 before | Expand all | Expand 10 after
2509 } 2509 }
2510 2510
2511 2511
2512 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2512 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2513 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckArrayBound); 2513 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckArrayBound);
2514 2514
2515 Location length_loc = locs()->in(kLengthPos); 2515 Location length_loc = locs()->in(kLengthPos);
2516 Location index_loc = locs()->in(kIndexPos); 2516 Location index_loc = locs()->in(kIndexPos);
2517 2517
2518 if (length_loc.IsConstant() && index_loc.IsConstant()) { 2518 if (length_loc.IsConstant() && index_loc.IsConstant()) {
2519 // TODO(srdjan): remove this code once failures are fixed.
2520 if ((Smi::Cast(length_loc.constant()).Value() >
2521 Smi::Cast(index_loc.constant()).Value()) &&
2522 (Smi::Cast(index_loc.constant()).Value() >= 0)) {
2523 // This CheckArrayBoundInstr should have been eliminated.
2524 return;
2525 }
2519 ASSERT((Smi::Cast(length_loc.constant()).Value() <= 2526 ASSERT((Smi::Cast(length_loc.constant()).Value() <=
2520 Smi::Cast(index_loc.constant()).Value()) || 2527 Smi::Cast(index_loc.constant()).Value()) ||
2521 (Smi::Cast(index_loc.constant()).Value() < 0)); 2528 (Smi::Cast(index_loc.constant()).Value() < 0));
2522 // Unconditionally deoptimize for constant bounds checks because they 2529 // Unconditionally deoptimize for constant bounds checks because they
2523 // only occur only when index is out-of-bounds. 2530 // only occur only when index is out-of-bounds.
2524 __ b(deopt); 2531 __ b(deopt);
2525 return; 2532 return;
2526 } 2533 }
2527 2534
2528 if (index_loc.IsConstant()) { 2535 if (index_loc.IsConstant()) {
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
2865 compiler->GenerateCall(token_pos(), 2872 compiler->GenerateCall(token_pos(),
2866 &label, 2873 &label,
2867 PcDescriptors::kOther, 2874 PcDescriptors::kOther,
2868 locs()); 2875 locs());
2869 __ Drop(2); // Discard type arguments and receiver. 2876 __ Drop(2); // Discard type arguments and receiver.
2870 } 2877 }
2871 2878
2872 } // namespace dart 2879 } // namespace dart
2873 2880
2874 #endif // defined TARGET_ARCH_ARM 2881 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698