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

Side by Side Diff: pkg/compiler/lib/src/ssa/value_range_analyzer.dart

Issue 1639193003: Handle the 'integer' values INFINITY and -INIFINITY in range analysis. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | 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 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 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 Range visitConstant(HConstant hConstant) { 676 Range visitConstant(HConstant hConstant) {
677 if (!hConstant.isInteger(compiler)) return info.newUnboundRange(); 677 if (!hConstant.isInteger(compiler)) return info.newUnboundRange();
678 ConstantValue constant = hConstant.constant; 678 ConstantValue constant = hConstant.constant;
679 NumConstantValue constantNum; 679 NumConstantValue constantNum;
680 if (constant is DeferredConstantValue) { 680 if (constant is DeferredConstantValue) {
681 constantNum = constant.referenced; 681 constantNum = constant.referenced;
682 } else { 682 } else {
683 constantNum = constant; 683 constantNum = constant;
684 } 684 }
685 if (constantNum.isMinusZero) constantNum = new IntConstantValue(0); 685 if (constantNum.isMinusZero) constantNum = new IntConstantValue(0);
686 if (constantNum.isPositiveInfinity || constantNum.isNegativeInfinity) {
687 return info.newUnboundRange();
688 }
686 Value value = info.newIntValue(constantNum.primitiveValue); 689 Value value = info.newIntValue(constantNum.primitiveValue);
687 return info.newNormalizedRange(value, value); 690 return info.newNormalizedRange(value, value);
688 } 691 }
689 692
690 Range visitFieldGet(HFieldGet fieldGet) { 693 Range visitFieldGet(HFieldGet fieldGet) {
691 if (!fieldGet.isInteger(compiler)) return info.newUnboundRange(); 694 if (!fieldGet.isInteger(compiler)) return info.newUnboundRange();
692 if (!fieldGet.receiver.isIndexablePrimitive(compiler)) { 695 if (!fieldGet.receiver.isIndexablePrimitive(compiler)) {
693 return visitInstruction(fieldGet); 696 return visitInstruction(fieldGet);
694 } 697 }
695 JavaScriptBackend backend = compiler.backend; 698 JavaScriptBackend backend = compiler.backend;
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 } 1078 }
1076 1079
1077 Range handleBinaryOperation(HBinaryArithmetic instruction) { 1080 Range handleBinaryOperation(HBinaryArithmetic instruction) {
1078 Range leftRange = visit(instruction.left); 1081 Range leftRange = visit(instruction.left);
1079 Range rightRange = visit(instruction.right); 1082 Range rightRange = visit(instruction.right);
1080 if (leftRange == null || rightRange == null) return null; 1083 if (leftRange == null || rightRange == null) return null;
1081 BinaryOperation operation = instruction.operation(info.constantSystem); 1084 BinaryOperation operation = instruction.operation(info.constantSystem);
1082 return operation.apply(leftRange, rightRange); 1085 return operation.apply(leftRange, rightRange);
1083 } 1086 }
1084 } 1087 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698