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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/bounds_checker.dart

Issue 1560433003: dart2js cps: Fix some analyzer hints in the CPS backend. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase Created 4 years, 11 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 | pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart » ('j') | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library dart2js.cps_ir.bounds_checker; 5 library dart2js.cps_ir.bounds_checker;
6 6
7 import 'cps_ir_nodes.dart'; 7 import 'cps_ir_nodes.dart';
8 import 'optimizers.dart' show Pass; 8 import 'optimizers.dart' show Pass;
9 import 'octagon.dart'; 9 import 'octagon.dart';
10 import '../constants/values.dart'; 10 import '../constants/values.dart';
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 486
487 @override 487 @override
488 void visitGetLength(GetLength node) { 488 void visitGetLength(GetLength node) {
489 valueOf[node] = getLength(node.object.definition, currentEffectNumber); 489 valueOf[node] = getLength(node.object.definition, currentEffectNumber);
490 } 490 }
491 491
492 @override 492 @override
493 void visitBoundsCheck(BoundsCheck node) { 493 void visitBoundsCheck(BoundsCheck node) {
494 if (node.checks == BoundsCheck.NONE) return; 494 if (node.checks == BoundsCheck.NONE) return;
495 assert(node.index != null); // Because there is at least one check. 495 assert(node.index != null); // Because there is at least one check.
496 Primitive object = node.object.definition;
497 SignedVariable length = node.length == null 496 SignedVariable length = node.length == null
498 ? null 497 ? null
499 : getValue(node.length.definition); 498 : getValue(node.length.definition);
500 SignedVariable index = getValue(node.index.definition); 499 SignedVariable index = getValue(node.index.definition);
501 if (node.hasUpperBoundCheck) { 500 if (node.hasUpperBoundCheck) {
502 if (isDefinitelyLessThan(index, length)) { 501 if (isDefinitelyLessThan(index, length)) {
503 node.checks &= ~BoundsCheck.UPPER_BOUND; 502 node.checks &= ~BoundsCheck.UPPER_BOUND;
504 } else { 503 } else {
505 makeLessThan(index, length); 504 makeLessThan(index, length);
506 } 505 }
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 } 731 }
733 return node.body; 732 return node.body;
734 } 733 }
735 } 734 }
736 735
737 /// Lattice representing the known (weak) monotonicity of a loop variable. 736 /// Lattice representing the known (weak) monotonicity of a loop variable.
738 /// 737 ///
739 /// The lattice bottom is represented by `null` and represents the case where 738 /// The lattice bottom is represented by `null` and represents the case where
740 /// the loop variable never changes value during the loop. 739 /// the loop variable never changes value during the loop.
741 enum Monotonicity { NotMonotone, Increasing, Decreasing, } 740 enum Monotonicity { NotMonotone, Increasing, Decreasing, }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698