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

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

Issue 54623002: Fix bug in our SSA optimizations: by giving an empty type to a box, we were assuming that anything … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 IntConstant constantInt = constant.constant; 673 IntConstant constantInt = constant.constant;
674 Value value = info.newIntValue(constantInt.value); 674 Value value = info.newIntValue(constantInt.value);
675 return info.newNormalizedRange(value, value); 675 return info.newNormalizedRange(value, value);
676 } 676 }
677 677
678 Range visitFieldGet(HFieldGet fieldGet) { 678 Range visitFieldGet(HFieldGet fieldGet) {
679 if (!fieldGet.isInteger(compiler)) return info.newUnboundRange(); 679 if (!fieldGet.isInteger(compiler)) return info.newUnboundRange();
680 if (!fieldGet.receiver.isIndexable(compiler)) { 680 if (!fieldGet.receiver.isIndexable(compiler)) {
681 return visitInstruction(fieldGet); 681 return visitInstruction(fieldGet);
682 } 682 }
683 JavaScriptBackend backend = compiler.backend;
684 assert(fieldGet.element == backend.jsIndexableLength);
683 LengthValue value = info.newLengthValue(fieldGet); 685 LengthValue value = info.newLengthValue(fieldGet);
684 // We know this range is above zero. To simplify the analysis, we 686 // We know this range is above zero. To simplify the analysis, we
685 // put the zero value as the lower bound of this range. This 687 // put the zero value as the lower bound of this range. This
686 // allows to easily remove the second bound check in the following 688 // allows to easily remove the second bound check in the following
687 // expression: a[1] + a[0]. 689 // expression: a[1] + a[0].
688 return info.newNormalizedRange(info.intZero, value); 690 return info.newNormalizedRange(info.intZero, value);
689 } 691 }
690 692
691 Range visitBoundsCheck(HBoundsCheck check) { 693 Range visitBoundsCheck(HBoundsCheck check) {
692 // Save the next instruction, in case the check gets removed. 694 // Save the next instruction, in case the check gets removed.
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 } 1008 }
1007 1009
1008 Range handleBinaryOperation(HBinaryArithmetic instruction) { 1010 Range handleBinaryOperation(HBinaryArithmetic instruction) {
1009 Range leftRange = visit(instruction.left); 1011 Range leftRange = visit(instruction.left);
1010 Range rightRange = visit(instruction.right); 1012 Range rightRange = visit(instruction.right);
1011 if (leftRange == null || rightRange == null) return null; 1013 if (leftRange == null || rightRange == null) return null;
1012 BinaryOperation operation = instruction.operation(info.constantSystem); 1014 BinaryOperation operation = instruction.operation(info.constantSystem);
1013 return operation.apply(leftRange, rightRange); 1015 return operation.apply(leftRange, rightRange);
1014 } 1016 }
1015 } 1017 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | tests/language/range_analysis2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698