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

Side by Side Diff: tests/compiler/dart2js/cps_ir/expected/optimize_indexers.js

Issue 2246623002: Delete CPS IR (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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
(Empty)
1 // Expectation for test:
2 // // Method to test: function(test)
3 // import 'package:expect/expect.dart';
4 //
5 // // This example illustrates a case we wish to do better in terms of inlining and
6 // // code generation.
7 // //
8 // // Naively this function would be compiled without inlining Wrapper.[],
9 // // JSArray.[] and Wrapper.[]= because:
10 // // JSArray.[] is too big (14 nodes)
11 // // Wrapper.[] is too big if we force inlining of JSArray (15 nodes)
12 // // Wrapper.[]= is even bigger (46 nodes)
13 // //
14 // // We now do specialization of [] and []= by adding guards and injecting buil tin
15 // // operators. This made it possible to inline []. We still don't see []= inli ned
16 // // yet, that might require that we improve the inlining counting heuristics a
17 // // bit.
18 // @NoInline()
19 // test(data, x) {
20 // data[x + 1] = data[x];
21 // }
22 //
23 // main() {
24 // var wrapper = new Wrapper();
25 // wrapper[33] = wrapper[1]; // make Wrapper.[]= and [] used more than once.
26 // print(test(new Wrapper(), int.parse('2')));
27 // }
28 //
29 // class Wrapper {
30 // final List arr = <bool>[true, false, false, true];
31 // operator[](int i) => this.arr[i];
32 // operator[]=(int i, v) {
33 // if (i > arr.length - 1) arr.length = i + 1;
34 // return arr[i] = v;
35 // }
36 // }
37
38 function(data, x) {
39 var v0 = J.$add$ns(x, 1), v1 = data.arr;
40 if (x >>> 0 !== x || x >= v1.length)
41 return H.ioore(v1, x);
42 data.$indexSet(0, v0, v1[x]);
43 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/cps_ir/expected/operators_8.js ('k') | tests/compiler/dart2js/cps_ir/expected/redundant_condition.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698