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

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 _b = array[0];
karlklose 2013/07/16 09:26:17 b_ -> b2?
ngeoffray 2013/07/16 10:27:06 Done.
10 var otherArray = [5];
11
12 main() {
13 var b = _b;
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 with [a]. By being GVN'ed, [e] will
karlklose 2013/07/16 09:26:17 'will be GVN'ed to the same value as [a]'?
ngeoffray 2013/07/16 10:27:06 Done.
28 // have its type changed from integer to number: because of the int
29 // type check on [b], we know [: b + 1 :] returns an integer.
30 // However we update this instruction with the previous [: b + 1 :]
31 // that did not have that information and therefore only knows that
32 // the instruction returns a number.
33 var e = b + 1;
34
35 // Introduce a loop phi that has [e] as header input, and [e++] as
36 // update input. By having [e] as input, dart2js will compute an
37 // integer type for the phi. However, after GVN, [e] becomes a
38 // number.
39
40 while (otherArray[0] == 0) {
41 // Use [e] as an index for an array so that the value range
42 // analysis tries to compute a range for [e].
43 otherArray[e] = d + f;
44 e++;
45 }
46 }
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