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

Side by Side Diff: tests/compiler/dart2js/cps_ir/input/optimize_indexers.dart

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 // Method to test: function(test)
2 import 'package:expect/expect.dart';
3
4 // This example illustrates a case we wish to do better in terms of inlining and
5 // code generation.
6 //
7 // Naively this function would be compiled without inlining Wrapper.[],
8 // JSArray.[] and Wrapper.[]= because:
9 // JSArray.[] is too big (14 nodes)
10 // Wrapper.[] is too big if we force inlining of JSArray (15 nodes)
11 // Wrapper.[]= is even bigger (46 nodes)
12 //
13 // We now do specialization of [] and []= by adding guards and injecting builtin
14 // operators. This made it possible to inline []. We still don't see []= inlined
15 // yet, that might require that we improve the inlining counting heuristics a
16 // bit.
17 @NoInline()
18 test(data, x) {
19 data[x + 1] = data[x];
20 }
21
22 main() {
23 var wrapper = new Wrapper();
24 wrapper[33] = wrapper[1]; // make Wrapper.[]= and [] used more than once.
25 print(test(new Wrapper(), int.parse('2')));
26 }
27
28 class Wrapper {
29 final List arr = <bool>[true, false, false, true];
30 operator[](int i) => this.arr[i];
31 operator[]=(int i, v) {
32 if (i > arr.length - 1) arr.length = i + 1;
33 return arr[i] = v;
34 }
35 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/cps_ir/input/operators_8.dart ('k') | tests/compiler/dart2js/cps_ir/input/redundant_condition.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698