Files
sdk/tests/language/range_analysis_test.dart
T
vegorov@google.com 6560f5c84b Fix convergence issues in range analysis.
Split it into three phases: initialization, widening and narrowing.

During widening and narrowing phi-ranges change according to classical widening and narrowing operators defined as:

Widening:
  [_|_, _|_] v [a, b] = [a, b]
  [a, b] v [c, d] = [c < a ? -inf : a, d > b ? +inf : b]

Narrowing:
  [a, b] ^ [c, d] = [(a == -inf) ? c : min(a, c), (b == +inf) ? d : max(b, d)]

R=fschneider@google.com

Review URL: https://codereview.chromium.org//10972003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12772 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-24 12:00:19 +00:00

23 lines
633 B
Dart

// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// Dart test program for constructors and initializers.
// Checks that range analysis does not enter infinite loop trying to propagate
// ranges through dependant phis.
test() {
var sum = 0;
for (var i = 0; i < 10; i++) {
for (var j = i - 1; j >= 0; j--) {
for (var k = j; k < i; k++) {
sum += (i + j + k);
}
}
}
return sum;
}
main() {
for (var i = 0; i < 1000; i++) test();
}