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

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

Issue 108363003: We run phases in-between GVN and code motion, so we have to handle cases in the SsaCodeMotion phase… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years 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/optimize.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 that used to crash during the
6 // [SsaCodeMotion] phase on this code.
7
8 class A {
9 final finalField;
10 var field = 2;
11 foo() {
12 new A().field = 42;
13 }
14 A._() : finalField = 42;
15 A() : finalField = [new A._(), new B(), new Object()][1];
16 }
17
18 class B {
19 foo() {}
20 bar() {}
21 }
22
23 main() {
24 var a = new A();
25 // Create a new block for SsaCodeMotion: the phase will want to move
26 // field access on [a] to this block.
27 if (true) {
28 var b = a.finalField;
29 var d = a.field;
30 b.bar();
31
32 // [c] gets GVN'ed with [b]. As a consequence, the type propagator
33 // that runs after GVN sees that [c] can only be a [B] because of
34 // the call to [bar].
35 var c = a.finalField;
36 c.foo();
37
38 // [e] does not get GVN'ed because the GVN phase sees [c.foo()] as
39 // having side effects.
40 var e = a.field;
41 if (d + e != 4) throw 'Test failed';
42 }
43 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/optimize.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698