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

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

Issue 14979007: - Canonicalize array bounds checks to avoid deopting when comparing (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.h ('k') | runtime/vm/intermediate_language_arm.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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/flow_graph_allocator.h" 9 #include "vm/flow_graph_allocator.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 2321 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 // Try symbolic comparison. 2332 // Try symbolic comparison.
2333 do { 2333 do {
2334 if (DependOnSameSymbol(max, length)) return max.offset() < length.offset(); 2334 if (DependOnSameSymbol(max, length)) return max.offset() < length.offset();
2335 } while (CanonicalizeMaxBoundary(&max) || CanonicalizeMinBoundary(&length)); 2335 } while (CanonicalizeMaxBoundary(&max) || CanonicalizeMinBoundary(&length));
2336 2336
2337 // Failed to prove that maximum is bounded with array length. 2337 // Failed to prove that maximum is bounded with array length.
2338 return false; 2338 return false;
2339 } 2339 }
2340 2340
2341 2341
2342 Instruction* CheckArrayBoundInstr::Canonicalize(FlowGraph* flow_graph) {
2343 return IsRedundant(RangeBoundary::FromDefinition(length()->definition())) ?
2344 NULL : this;
2345 }
2346
2347
2342 intptr_t CheckArrayBoundInstr::LengthOffsetFor(intptr_t class_id) { 2348 intptr_t CheckArrayBoundInstr::LengthOffsetFor(intptr_t class_id) {
2343 if (RawObject::IsExternalTypedDataClassId(class_id)) { 2349 if (RawObject::IsExternalTypedDataClassId(class_id)) {
2344 return ExternalTypedData::length_offset(); 2350 return ExternalTypedData::length_offset();
2345 } 2351 }
2346 if (RawObject::IsTypedDataClassId(class_id)) { 2352 if (RawObject::IsTypedDataClassId(class_id)) {
2347 return TypedData::length_offset(); 2353 return TypedData::length_offset();
2348 } 2354 }
2349 switch (class_id) { 2355 switch (class_id) {
2350 case kGrowableObjectArrayCid: 2356 case kGrowableObjectArrayCid:
2351 return GrowableObjectArray::length_offset(); 2357 return GrowableObjectArray::length_offset();
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
2445 default: 2451 default:
2446 UNREACHABLE(); 2452 UNREACHABLE();
2447 } 2453 }
2448 return kPowRuntimeEntry; 2454 return kPowRuntimeEntry;
2449 } 2455 }
2450 2456
2451 2457
2452 #undef __ 2458 #undef __
2453 2459
2454 } // namespace dart 2460 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/intermediate_language_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698