OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 #include "vm/flow_graph_range_analysis.h" | 5 #include "vm/flow_graph_range_analysis.h" |
6 | 6 |
7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
8 #include "vm/il_printer.h" | 8 #include "vm/il_printer.h" |
9 | 9 |
10 namespace dart { | 10 namespace dart { |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 // bottom element to indicate that the range was not computed *yet*. | 466 // bottom element to indicate that the range was not computed *yet*. |
467 return &int64_range_; | 467 return &int64_range_; |
468 } | 468 } |
469 | 469 |
470 return range; | 470 return range; |
471 } | 471 } |
472 | 472 |
473 static bool AreEqualDefinitions(Definition* a, Definition* b) { | 473 static bool AreEqualDefinitions(Definition* a, Definition* b) { |
474 a = UnwrapConstraint(a); | 474 a = UnwrapConstraint(a); |
475 b = UnwrapConstraint(b); | 475 b = UnwrapConstraint(b); |
476 return (a == b) || | 476 return (a == b) || (a->AllowsCSE() && b->AllowsCSE() && a->Equals(b)); |
477 (a->AllowsCSE() && a->Dependencies().IsNone() && b->AllowsCSE() && | |
478 b->Dependencies().IsNone() && a->Equals(b)); | |
479 } | 477 } |
480 | 478 |
481 static bool DependOnSameSymbol(const RangeBoundary& a, const RangeBoundary& b) { | 479 static bool DependOnSameSymbol(const RangeBoundary& a, const RangeBoundary& b) { |
482 return a.IsSymbol() && b.IsSymbol() && | 480 return a.IsSymbol() && b.IsSymbol() && |
483 AreEqualDefinitions(a.symbol(), b.symbol()); | 481 AreEqualDefinitions(a.symbol(), b.symbol()); |
484 } | 482 } |
485 | 483 |
486 // Given the current range of a phi and a newly computed range check | 484 // Given the current range of a phi and a newly computed range check |
487 // if it is growing towards negative infinity, if it does widen it to | 485 // if it is growing towards negative infinity, if it does widen it to |
488 // MinSmi. | 486 // MinSmi. |
(...skipping 2470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2959 return max.offset() < canonical_length.offset(); | 2957 return max.offset() < canonical_length.offset(); |
2960 } | 2958 } |
2961 } while (CanonicalizeMaxBoundary(&max) || | 2959 } while (CanonicalizeMaxBoundary(&max) || |
2962 CanonicalizeMinBoundary(&canonical_length)); | 2960 CanonicalizeMinBoundary(&canonical_length)); |
2963 | 2961 |
2964 // Failed to prove that maximum is bounded with array length. | 2962 // Failed to prove that maximum is bounded with array length. |
2965 return false; | 2963 return false; |
2966 } | 2964 } |
2967 | 2965 |
2968 } // namespace dart | 2966 } // namespace dart |
OLD | NEW |