OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/optimize_redundant_array_load_test', null, /* Imp
orts */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__optimize_redundant_array_load_test(exports, dart_sdk, expect)
{ |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const _interceptors = dart_sdk._interceptors; |
| 8 const dart = dart_sdk.dart; |
| 9 const dartx = dart_sdk.dartx; |
| 10 const expect$ = expect.expect; |
| 11 const optimize_redundant_array_load_test = Object.create(null); |
| 12 let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(c
ore.int)))(); |
| 13 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun
ctionType(dart.dynamic, [dart.dynamic])))(); |
| 14 let dynamicToint = () => (dynamicToint = dart.constFn(dart.definiteFunctionTyp
e(core.int, [dart.dynamic])))(); |
| 15 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 16 dart.defineLazy(optimize_redundant_array_load_test, { |
| 17 get A() { |
| 18 return JSArrayOfint().of([0, 2, 3]); |
| 19 }, |
| 20 set A(_) {} |
| 21 }); |
| 22 optimize_redundant_array_load_test.test1 = function(a) { |
| 23 let x = core.int._check(dart.dindex(a, 0)); |
| 24 let y = core.int._check(dart.dindex(a, 1)); |
| 25 let i = 0; |
| 26 dart.dsetindex(a, i, dart.dsend(dart.dindex(a, i), '+', 1)); |
| 27 return dart.dsend(dart.dsend(dart.dindex(a, 0), '+', y), '+', dart.dindex(a,
2)); |
| 28 }; |
| 29 dart.fn(optimize_redundant_array_load_test.test1, dynamicTodynamic()); |
| 30 optimize_redundant_array_load_test.test2 = function(a) { |
| 31 return core.int._check(dart.dsend(dart.dindex(a, 2), '+', dart.dindex(a, 2))
); |
| 32 }; |
| 33 dart.fn(optimize_redundant_array_load_test.test2, dynamicToint()); |
| 34 optimize_redundant_array_load_test.main = function() { |
| 35 for (let i = 0; i < 20; i++) { |
| 36 optimize_redundant_array_load_test.test1(optimize_redundant_array_load_tes
t.A); |
| 37 optimize_redundant_array_load_test.test2(optimize_redundant_array_load_tes
t.A); |
| 38 } |
| 39 expect$.Expect.equals(26, optimize_redundant_array_load_test.test1(optimize_
redundant_array_load_test.A)); |
| 40 expect$.Expect.equals(6, optimize_redundant_array_load_test.test2(optimize_r
edundant_array_load_test.A)); |
| 41 }; |
| 42 dart.fn(optimize_redundant_array_load_test.main, VoidTodynamic()); |
| 43 // Exports: |
| 44 exports.optimize_redundant_array_load_test = optimize_redundant_array_load_tes
t; |
| 45 }); |
OLD | NEW |