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

Side by Side Diff: tests/compiler/dart2js/js_backend_cps_ir_operators_test.dart

Issue 1223813006: dart2js cps: Direct access on JS arrays. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update unit tests and remove unused functions Created 5 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Tests of operators. 5 // Tests of operators.
6 6
7 library operators_tests; 7 library operators_tests;
8 8
9 import 'js_backend_cps_ir.dart'; 9 import 'js_backend_cps_ir.dart';
10 10
11 const List<TestEntry> tests = const [ 11 const List<TestEntry> tests = const [
12 const TestEntry("main() { return true ? 42 : 'foo'; }"), 12 const TestEntry("main() { return true ? 42 : 'foo'; }"),
13 const TestEntry(""" 13 const TestEntry("""
14 foo() => foo(); 14 foo() => foo();
15 main() { 15 main() {
16 print(foo() ? "hello world" : "bad bad"); 16 print(foo() ? "hello world" : "bad bad");
17 }""", 17 }""","""
18 """function() { 18 function() {
19 V.foo(); 19 P.print(V.foo() ? "hello world" : "bad bad");
20 P.print("bad bad");
21 }"""), 20 }"""),
22 const TestEntry(""" 21 const TestEntry("""
23 foo() => null; 22 foo() => null;
24 main() { 23 main() {
25 print(foo() ? "hello world" : "bad bad"); 24 print(foo() ? "hello world" : "bad bad");
26 }""", 25 }""","""
27 """function() { 26 function() {
28 V.foo(); 27 V.foo();
29 P.print("bad bad"); 28 P.print("bad bad");
30 }"""), 29 }"""),
31 const TestEntry(""" 30 const TestEntry("""
32 get foo => foo; 31 get foo => foo;
33 main() { 32 main() {
34 print(foo ? "hello world" : "bad bad"); 33 print(foo ? "hello world" : "bad bad");
35 }""", 34 }""","""
36 """function() { 35 function() {
37 V.foo(); 36 P.print(V.foo() ? "hello world" : "bad bad");
38 P.print("bad bad");
39 }"""), 37 }"""),
40 const TestEntry(""" 38 const TestEntry("""
41 get foo => foo; 39 get foo => foo;
42 main() { print(foo && foo); }""", 40 main() { print(foo && foo); }
43 """function() { 41 """, """
44 V.foo(); 42 function() {
45 P.print(false); 43 P.print(V.foo() ? !!P.identical(V.foo(), true) : false);
46 }"""), 44 }"""),
47 const TestEntry(""" 45 const TestEntry("""
48 get foo => foo; 46 get foo => foo;
49 main() { print(foo || foo); }""", 47 main() { print(foo || foo); }
50 """function() { 48 ""","""
51 V.foo(); 49 function() {
52 V.foo(); 50 P.print(V.foo() ? true : !!P.identical(V.foo(), true));
53 P.print(false);
54 }"""), 51 }"""),
55 52
56 // Needs interceptor calling convention 53 // Needs interceptor calling convention
57 //const TestEntry(""" 54 //const TestEntry("""
58 //class Foo { 55 //class Foo {
59 // operator[]=(index, value) { 56 // operator[]=(index, value) {
60 // print(value); 57 // print(value);
61 // } 58 // }
62 //} 59 //}
63 //main() { 60 //main() {
64 // var foo = new Foo(); 61 // var foo = new Foo();
65 // foo[5] = 6; 62 // foo[5] = 6;
66 //}""", r""" 63 //}""", r"""
67 //function() { 64 //function() {
68 // V.Foo$().$indexSet(5, 6); 65 // V.Foo$().$indexSet(5, 6);
69 //} 66 //}
70 //"""), 67 //"""),
71 68
72 const TestEntry(""" 69 const TestEntry("""
73 main() { 70 main() {
74 var list = [1, 2, 3]; 71 var list = [1, 2, 3];
75 list[1] = 6; 72 list[1] = 6;
76 print(list); 73 print(list);
77 }""", r""" 74 }""", r"""
78 function() { 75 function() {
79 var list = [1, 2, 3]; 76 var list = [1, 2, 3], v0 = 1;
80 J.getInterceptor$a(list).$indexSet(list, 1, 6); 77 if (v0 < 0 || v0 >= list.length)
78 H.ioore(list, v0);
79 list[v0] = 6;
81 P.print(list); 80 P.print(list);
82 }"""), 81 }"""),
83 ]; 82 ];
84 83
85 void main() { 84 void main() {
86 runTests(tests); 85 runTests(tests);
87 } 86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698