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

Side by Side Diff: runtime/vm/intermediate_language_ia32.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_arm.cc ('k') | runtime/vm/intermediate_language_mips.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_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 "lib/error.h" 10 #include "lib/error.h"
(...skipping 3889 matching lines...) Expand 10 before | Expand all | Expand 10 after
3900 3900
3901 3901
3902 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3902 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3903 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckArrayBound); 3903 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckArrayBound);
3904 3904
3905 Location length_loc = locs()->in(kLengthPos); 3905 Location length_loc = locs()->in(kLengthPos);
3906 Location index_loc = locs()->in(kIndexPos); 3906 Location index_loc = locs()->in(kIndexPos);
3907 3907
3908 if (length_loc.IsConstant() && index_loc.IsConstant()) { 3908 if (length_loc.IsConstant() && index_loc.IsConstant()) {
3909 // TODO(srdjan): remove this code once failures are fixed. 3909 // TODO(srdjan): remove this code once failures are fixed.
3910 if (Smi::Cast(length_loc.constant()).Value() > 3910 if ((Smi::Cast(length_loc.constant()).Value() >
3911 Smi::Cast(index_loc.constant()).Value()) { 3911 Smi::Cast(index_loc.constant()).Value()) &&
3912 (Smi::Cast(index_loc.constant()).Value() >= 0)) {
3912 // This CheckArrayBoundInstr should have been eliminated. 3913 // This CheckArrayBoundInstr should have been eliminated.
3913 return; 3914 return;
3914 } 3915 }
3915 ASSERT((Smi::Cast(length_loc.constant()).Value() <= 3916 ASSERT((Smi::Cast(length_loc.constant()).Value() <=
3916 Smi::Cast(index_loc.constant()).Value()) || 3917 Smi::Cast(index_loc.constant()).Value()) ||
3917 (Smi::Cast(index_loc.constant()).Value() < 0)); 3918 (Smi::Cast(index_loc.constant()).Value() < 0));
3918 // Unconditionally deoptimize for constant bounds checks because they 3919 // Unconditionally deoptimize for constant bounds checks because they
3919 // only occur only when index is out-of-bounds. 3920 // only occur only when index is out-of-bounds.
3920 __ jmp(deopt); 3921 __ jmp(deopt);
3921 return; 3922 return;
(...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after
4682 PcDescriptors::kOther, 4683 PcDescriptors::kOther,
4683 locs()); 4684 locs());
4684 __ Drop(2); // Discard type arguments and receiver. 4685 __ Drop(2); // Discard type arguments and receiver.
4685 } 4686 }
4686 4687
4687 } // namespace dart 4688 } // namespace dart
4688 4689
4689 #undef __ 4690 #undef __
4690 4691
4691 #endif // defined TARGET_ARCH_IA32 4692 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698