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

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

Issue 11412105: - Move length getter and setter interceptors to the new interceptor scheme. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 return update.accept(new LoopUpdateRecognizer(phi, ranges, types, info)); 621 return update.accept(new LoopUpdateRecognizer(phi, ranges, types, info));
622 } 622 }
623 623
624 Range visitConstant(HConstant constant) { 624 Range visitConstant(HConstant constant) {
625 if (!constant.isInteger(types)) return info.newUnboundRange(); 625 if (!constant.isInteger(types)) return info.newUnboundRange();
626 IntConstant constantInt = constant.constant; 626 IntConstant constantInt = constant.constant;
627 Value value = info.newIntValue(constantInt.value); 627 Value value = info.newIntValue(constantInt.value);
628 return info.newRange(value, value); 628 return info.newRange(value, value);
629 } 629 }
630 630
631 Range visitInvokeInterceptor(HInvokeInterceptor interceptor) { 631 Range visitFieldGet(HFieldGet fieldGet) {
632 if (!interceptor.isInteger(types)) return info.newUnboundRange(); 632 if (!fieldGet.isInteger(types)) return info.newUnboundRange();
633 if (!interceptor.isLengthGetterOnStringOrArray(types)) { 633 if (!fieldGet.receiver.isIndexablePrimitive(types)) {
634 return visitInstruction(interceptor); 634 return visitInstruction(fieldGet);
635 } 635 }
636 LengthValue value = info.newLengthValue(interceptor); 636 LengthValue value = info.newLengthValue(fieldGet);
637 // We know this range is above zero. To simplify the analysis, we 637 // We know this range is above zero. To simplify the analysis, we
638 // put the zero value as the lower bound of this range. This 638 // put the zero value as the lower bound of this range. This
639 // allows to easily remove the second bound check in the following 639 // allows to easily remove the second bound check in the following
640 // expression: a[1] + a[0]. 640 // expression: a[1] + a[0].
641 return info.newRange(info.intZero, value); 641 return info.newRange(info.intZero, value);
642 } 642 }
643 643
644 Range visitBoundsCheck(HBoundsCheck check) { 644 Range visitBoundsCheck(HBoundsCheck check) {
645 // Save the next instruction, in case the check gets removed. 645 // Save the next instruction, in case the check gets removed.
646 HInstruction next = check.next; 646 HInstruction next = check.next;
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
987 if (instruction is HPhi && !instruction.block.isLoopHeader()) { 987 if (instruction is HPhi && !instruction.block.isLoopHeader()) {
988 HInstruction result = unwrap(instruction.inputs[0]); 988 HInstruction result = unwrap(instruction.inputs[0]);
989 for (int i = 1; i < instruction.inputs.length; i++) { 989 for (int i = 1; i < instruction.inputs.length; i++) {
990 if (result != unwrap(instruction.inputs[i])) return instruction; 990 if (result != unwrap(instruction.inputs[i])) return instruction;
991 } 991 }
992 return result; 992 return result;
993 } 993 }
994 return instruction; 994 return instruction;
995 } 995 }
996 } 996 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698