| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |