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

Side by Side Diff: tests/language/issue11793_test.dart

Issue 19347002: Fix crash https://code.google.com/p/dart/issues/detail?id=11793: only compute a range for a loop if… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/value_range_analyzer.dart ('k') | 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
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4
5 // Regression test for dart2js, whose value range analysis phase
6 // assumed loop phis that were integer necessarily had integer inputs.
7
8 var array = const [0, 0.5];
9 var globalB = array[0];
10 var otherArray = [5];
11
12 main() {
13 var b = globalB;
14 var a = b + 1;
15 if (otherArray[0] == 0) {
16 // Use a non-existing selector to prevent adding a bailout check.
17 a.noSuch();
18 a = otherArray[0];
19 }
20
21 // Use [a] to make sure it does not become dead code.
22 var f = array[a];
23
24 // Add an integer check on [b].
25 var d = array[b];
26
27 // This instruction will be GVN to the same value as [a].
28 // By being GVN'ed, [e] will have its type changed from integer
29 // to number: because of the int type check on [b], we know
30 // [: b + 1 :] returns an integer.
31 // However we update this instruction with the previous [: b + 1 :]
32 // that did not have that information and therefore only knows that
33 // the instruction returns a number.
34 var e = b + 1;
35
36 // Introduce a loop phi that has [e] as header input, and [e++] as
37 // update input. By having [e] as input, dart2js will compute an
38 // integer type for the phi. However, after GVN, [e] becomes a
39 // number.
40
41 while (otherArray[0] == 0) {
42 // Use [e] as an index for an array so that the value range
43 // analysis tries to compute a range for [e].
44 otherArray[e] = d + f;
45 e++;
46 }
47 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/value_range_analyzer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698