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

Side by Side Diff: runtime/vm/intermediate_language_x64.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
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_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 "lib/error.h" 10 #include "lib/error.h"
(...skipping 3924 matching lines...) Expand 10 before | Expand all | Expand 10 after
3935 } 3935 }
3936 3936
3937 3937
3938 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3938 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3939 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckArrayBound); 3939 Label* deopt = compiler->AddDeoptStub(deopt_id(), kDeoptCheckArrayBound);
3940 3940
3941 Location length_loc = locs()->in(kLengthPos); 3941 Location length_loc = locs()->in(kLengthPos);
3942 Location index_loc = locs()->in(kIndexPos); 3942 Location index_loc = locs()->in(kIndexPos);
3943 3943
3944 if (length_loc.IsConstant() && index_loc.IsConstant()) { 3944 if (length_loc.IsConstant() && index_loc.IsConstant()) {
3945 // TODO(srdjan): remove this code once failures are fixed.
3946 if ((Smi::Cast(length_loc.constant()).Value() >
3947 Smi::Cast(index_loc.constant()).Value()) &&
3948 (Smi::Cast(index_loc.constant()).Value() >= 0)) {
3949 // This CheckArrayBoundInstr should have been eliminated.
3950 return;
3951 }
3945 ASSERT((Smi::Cast(length_loc.constant()).Value() <= 3952 ASSERT((Smi::Cast(length_loc.constant()).Value() <=
3946 Smi::Cast(index_loc.constant()).Value()) || 3953 Smi::Cast(index_loc.constant()).Value()) ||
3947 (Smi::Cast(index_loc.constant()).Value() < 0)); 3954 (Smi::Cast(index_loc.constant()).Value() < 0));
3948 // Unconditionally deoptimize for constant bounds checks because they 3955 // Unconditionally deoptimize for constant bounds checks because they
3949 // only occur only when index is out-of-bounds. 3956 // only occur only when index is out-of-bounds.
3950 __ jmp(deopt); 3957 __ jmp(deopt);
3951 return; 3958 return;
3952 } 3959 }
3953 3960
3954 if (index_loc.IsConstant()) { 3961 if (index_loc.IsConstant()) {
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
4319 PcDescriptors::kOther, 4326 PcDescriptors::kOther,
4320 locs()); 4327 locs());
4321 __ Drop(2); // Discard type arguments and receiver. 4328 __ Drop(2); // Discard type arguments and receiver.
4322 } 4329 }
4323 4330
4324 } // namespace dart 4331 } // namespace dart
4325 4332
4326 #undef __ 4333 #undef __
4327 4334
4328 #endif // defined TARGET_ARCH_X64 4335 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_mips.cc ('k') | tests/language/optimized_constant_array_string_access_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698