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

Side by Side Diff: runtime/vm/intermediate_language_mips.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_ia32.cc ('k') | runtime/vm/intermediate_language_x64.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_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 "lib/error.h" 10 #include "lib/error.h"
(...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after
2486 } 2486 }
2487 2487
2488 2488
2489 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 2489 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
2490 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckArrayBound); 2490 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckArrayBound);
2491 2491
2492 Location length_loc = locs()->in(kLengthPos); 2492 Location length_loc = locs()->in(kLengthPos);
2493 Location index_loc = locs()->in(kIndexPos); 2493 Location index_loc = locs()->in(kIndexPos);
2494 2494
2495 if (length_loc.IsConstant() && index_loc.IsConstant()) { 2495 if (length_loc.IsConstant() && index_loc.IsConstant()) {
2496 // TODO(srdjan): remove this code once failures are fixed.
2497 if ((Smi::Cast(length_loc.constant()).Value() >
2498 Smi::Cast(index_loc.constant()).Value()) &&
2499 (Smi::Cast(index_loc.constant()).Value() >= 0)) {
2500 // This CheckArrayBoundInstr should have been eliminated.
2501 return;
2502 }
2496 ASSERT((Smi::Cast(length_loc.constant()).Value() <= 2503 ASSERT((Smi::Cast(length_loc.constant()).Value() <=
2497 Smi::Cast(index_loc.constant()).Value()) || 2504 Smi::Cast(index_loc.constant()).Value()) ||
2498 (Smi::Cast(index_loc.constant()).Value() < 0)); 2505 (Smi::Cast(index_loc.constant()).Value() < 0));
2499 // Unconditionally deoptimize for constant bounds checks because they 2506 // Unconditionally deoptimize for constant bounds checks because they
2500 // only occur only when index is out-of-bounds. 2507 // only occur only when index is out-of-bounds.
2501 __ b(deopt); 2508 __ b(deopt);
2502 return; 2509 return;
2503 } 2510 }
2504 2511
2505 if (index_loc.IsConstant()) { 2512 if (index_loc.IsConstant()) {
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
2896 compiler->GenerateCall(token_pos(), 2903 compiler->GenerateCall(token_pos(),
2897 &label, 2904 &label,
2898 PcDescriptors::kOther, 2905 PcDescriptors::kOther,
2899 locs()); 2906 locs());
2900 __ Drop(2); // Discard type arguments and receiver. 2907 __ Drop(2); // Discard type arguments and receiver.
2901 } 2908 }
2902 2909
2903 } // namespace dart 2910 } // namespace dart
2904 2911
2905 #endif // defined TARGET_ARCH_MIPS 2912 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698