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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/ssa/value_range_analyzer.dart

Issue 12211112: Start work on a non-complete type inferrer. Currently only analyzes return types. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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) 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 part of ssa; 5 part of ssa;
6 6
7 7
8 class ValueRangeInfo { 8 class ValueRangeInfo {
9 final ConstantSystem constantSystem; 9 final ConstantSystem constantSystem;
10 10
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 // allows to easily remove the second bound check in the following 640 // allows to easily remove the second bound check in the following
641 // expression: a[1] + a[0]. 641 // expression: a[1] + a[0].
642 return info.newRange(info.intZero, value); 642 return info.newRange(info.intZero, value);
643 } 643 }
644 644
645 Range visitBoundsCheck(HBoundsCheck check) { 645 Range visitBoundsCheck(HBoundsCheck check) {
646 // Save the next instruction, in case the check gets removed. 646 // Save the next instruction, in case the check gets removed.
647 HInstruction next = check.next; 647 HInstruction next = check.next;
648 Range indexRange = ranges[check.index]; 648 Range indexRange = ranges[check.index];
649 Range lengthRange = ranges[check.length]; 649 Range lengthRange = ranges[check.length];
650 assert(check.index.isInteger(types));
651 assert(check.length.isInteger(types));
650 652
651 // Check if the index is strictly below the upper bound of the length 653 // Check if the index is strictly below the upper bound of the length
652 // range. 654 // range.
653 Value maxIndex = lengthRange.upper - info.intOne; 655 Value maxIndex = lengthRange.upper - info.intOne;
654 bool belowLength = maxIndex != const MaxIntValue() 656 bool belowLength = maxIndex != const MaxIntValue()
655 && indexRange.upper.min(maxIndex) == indexRange.upper; 657 && indexRange.upper.min(maxIndex) == indexRange.upper;
656 658
657 // Check if the index is strictly below the lower bound of the length 659 // Check if the index is strictly below the lower bound of the length
658 // range. 660 // range.
659 belowLength = belowLength 661 belowLength = belowLength
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 if (instruction is HPhi && !instruction.block.isLoopHeader()) { 989 if (instruction is HPhi && !instruction.block.isLoopHeader()) {
988 HInstruction result = unwrap(instruction.inputs[0]); 990 HInstruction result = unwrap(instruction.inputs[0]);
989 for (int i = 1; i < instruction.inputs.length; i++) { 991 for (int i = 1; i < instruction.inputs.length; i++) {
990 if (result != unwrap(instruction.inputs[i])) return instruction; 992 if (result != unwrap(instruction.inputs[i])) return instruction;
991 } 993 }
992 return result; 994 return result;
993 } 995 }
994 return instruction; 996 return instruction;
995 } 997 }
996 } 998 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698