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

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

Issue 12310133: Fix for issue 8781: it is not ok to move a HTypeGuard, so mark it as "unpure". (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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/nodes.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 // dart2js regression test for issue 8781.
6
7 class N {
8 var outgoing;
9 var incoming;
10 N(this.outgoing, this.incoming);
11 }
12
13 class A {
14 int offset = 0;
15 var list;
16 var node;
17
18 A(node) : node = node, list = node.outgoing;
19
20 next() {
21 // dart2js used to update [offset] twice: once in the optimized
22 // version, which would bailout to the non-optimized version
23 // because [list] is not an Array, and once in the non-optimized
24 // version.
25 var edge = list[offset++];
26 if (list == node.outgoing) {
27 list = node.incoming;
28 offset = 0;
29 } else
30 list = null;
31 return edge;
32 }
33 }
34
35 class L {
36 final list;
37 L(this.list);
38 // Use noSuchMethod to defeat type inferencing.
39 noSuchMethod(mirror) => mirror.invokeOn(list);
40 }
41
42 main () {
43 var o = new A(new N(new L([1]), new L([2])));
44
45 for (var i = 1; i <= 2; i++)
46 Expect.equals(i, o.next());
47
48 Expect.equals(null, o.list);
49 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/nodes.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698