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

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

Issue 11280248: Add more spcific ranges for String length and charCode methods. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years 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') | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after
2453 2453
2454 2454
2455 void LoadFieldInstr::InferRange() { 2455 void LoadFieldInstr::InferRange() {
2456 if ((range_ == NULL) && 2456 if ((range_ == NULL) &&
2457 ((recognized_kind() == MethodRecognizer::kObjectArrayLength) || 2457 ((recognized_kind() == MethodRecognizer::kObjectArrayLength) ||
2458 (recognized_kind() == MethodRecognizer::kImmutableArrayLength))) { 2458 (recognized_kind() == MethodRecognizer::kImmutableArrayLength))) {
2459 range_ = new Range(RangeBoundary::FromConstant(0), 2459 range_ = new Range(RangeBoundary::FromConstant(0),
2460 RangeBoundary::FromConstant(Array::kMaxElements)); 2460 RangeBoundary::FromConstant(Array::kMaxElements));
2461 return; 2461 return;
2462 } 2462 }
2463 if ((range_ == NULL) &&
2464 (recognized_kind() == MethodRecognizer::kStringBaseLength)) {
2465 range_ = new Range(RangeBoundary::FromConstant(0),
2466 RangeBoundary::FromConstant(String::kMaxElements));
2467 return;
2468 }
2463 Definition::InferRange(); 2469 Definition::InferRange();
2464 } 2470 }
2465 2471
2466 2472
2473
2474 void StringCharCodeAtInstr::InferRange() {
2475 switch (class_id_) {
2476 case kOneByteStringCid:
2477 range_ = new Range(RangeBoundary::FromConstant(0),
2478 RangeBoundary::FromConstant(0xFF));
2479 break;
2480 case kTwoByteStringCid:
2481 range_ = new Range(RangeBoundary::FromConstant(0),
2482 RangeBoundary::FromConstant(0xFFFF));
2483 break;
2484 default:
2485 UNIMPLEMENTED();
2486 }
2487 }
2488
2489
2467 void LoadIndexedInstr::InferRange() { 2490 void LoadIndexedInstr::InferRange() {
2468 switch (class_id()) { 2491 switch (class_id()) {
2469 case kExternalUint8ArrayCid: 2492 case kExternalUint8ArrayCid:
2470 case kUint8ArrayCid: 2493 case kUint8ArrayCid:
2471 range_ = new Range(RangeBoundary::FromConstant(0), 2494 range_ = new Range(RangeBoundary::FromConstant(0),
2472 RangeBoundary::FromConstant(255)); 2495 RangeBoundary::FromConstant(255));
2473 break; 2496 break;
2474 default: 2497 default:
2475 Definition::InferRange(); 2498 Definition::InferRange();
2476 break; 2499 break;
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
2710 default: 2733 default:
2711 UNREACHABLE(); 2734 UNREACHABLE();
2712 return -1; 2735 return -1;
2713 } 2736 }
2714 } 2737 }
2715 2738
2716 2739
2717 #undef __ 2740 #undef __
2718 2741
2719 } // namespace dart 2742 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698