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

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

Issue 1699033003: dart2js cps: Combine integer type check with bounds check. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase Created 4 years, 10 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 // Expectation for test: 1 // Expectation for test:
2 // // Method to test: function(test) 2 // // Method to test: function(test)
3 // import 'package:expect/expect.dart'; 3 // import 'package:expect/expect.dart';
4 // 4 //
5 // // This example illustrates a case we wish to do better in terms of inlining and 5 // // This example illustrates a case we wish to do better in terms of inlining and
6 // // code generation. 6 // // code generation.
7 // // 7 // //
8 // // Naively this function would be compiled without inlining Wrapper.[], 8 // // Naively this function would be compiled without inlining Wrapper.[],
9 // // JSArray.[] and Wrapper.[]= because: 9 // // JSArray.[] and Wrapper.[]= because:
10 // // JSArray.[] is too big (14 nodes) 10 // // JSArray.[] is too big (14 nodes)
(...skipping 18 matching lines...) Expand all
29 // class Wrapper { 29 // class Wrapper {
30 // final List arr = <bool>[true, false, false, true]; 30 // final List arr = <bool>[true, false, false, true];
31 // operator[](int i) => this.arr[i]; 31 // operator[](int i) => this.arr[i];
32 // operator[]=(int i, v) { 32 // operator[]=(int i, v) {
33 // if (i > arr.length - 1) arr.length = i + 1; 33 // if (i > arr.length - 1) arr.length = i + 1;
34 // return arr[i] = v; 34 // return arr[i] = v;
35 // } 35 // }
36 // } 36 // }
37 37
38 function(data, x) { 38 function(data, x) {
39 var v0 = J.$add$ns(x, 1), v1 = data.arr, v2 = v1.length; 39 var v0 = J.$add$ns(x, 1), v1 = data.arr;
40 if (typeof x !== "number" || Math.floor(x) !== x) 40 if (x >>> 0 !== x || x >= v1.length)
41 return H.iae(x);
42 if (x < 0 || x >= v2)
43 return H.ioore(v1, x); 41 return H.ioore(v1, x);
44 data.$indexSet(0, v0, v1[x]); 42 data.$indexSet(0, v0, v1[x]);
45 } 43 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/tree_ir/optimization/logical_rewriter.dart ('k') | tests/compiler/dart2js_extra/dart2js_extra.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698