OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/allocation_sinking_inlining_test', null, /* Impor
ts */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__allocation_sinking_inlining_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const dart = dart_sdk.dart; |
| 8 const dartx = dart_sdk.dartx; |
| 9 const expect$ = expect.expect; |
| 10 const allocation_sinking_inlining_test = Object.create(null); |
| 11 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun
ctionType(dart.dynamic, [dart.dynamic])))(); |
| 12 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 13 allocation_sinking_inlining_test.A = class A extends core.Object { |
| 14 foo(x) { |
| 15 return dart.dput(x, 'f', dart.dsend(dart.dload(x, 'f'), '+', 1)); |
| 16 } |
| 17 }; |
| 18 dart.setSignature(allocation_sinking_inlining_test.A, { |
| 19 methods: () => ({foo: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]
)}) |
| 20 }); |
| 21 allocation_sinking_inlining_test.B = class B extends core.Object { |
| 22 foo(x) { |
| 23 return dart.dput(x, 'f', dart.dsend(dart.dload(x, 'f'), '-', 1)); |
| 24 } |
| 25 }; |
| 26 dart.setSignature(allocation_sinking_inlining_test.B, { |
| 27 methods: () => ({foo: dart.definiteFunctionType(dart.dynamic, [dart.dynamic]
)}) |
| 28 }); |
| 29 allocation_sinking_inlining_test.C = class C extends core.Object { |
| 30 new() { |
| 31 this.f = 0; |
| 32 } |
| 33 }; |
| 34 allocation_sinking_inlining_test.test = function(obj) { |
| 35 let c = new allocation_sinking_inlining_test.C(); |
| 36 return dart.dsend(obj, 'foo', c); |
| 37 }; |
| 38 dart.fn(allocation_sinking_inlining_test.test, dynamicTodynamic()); |
| 39 allocation_sinking_inlining_test.main = function() { |
| 40 let a = new allocation_sinking_inlining_test.A(); |
| 41 let b = new allocation_sinking_inlining_test.B(); |
| 42 expect$.Expect.equals(1, allocation_sinking_inlining_test.test(a)); |
| 43 expect$.Expect.equals(-1, allocation_sinking_inlining_test.test(b)); |
| 44 for (let i = 0; i < 20; i++) |
| 45 allocation_sinking_inlining_test.test(a); |
| 46 expect$.Expect.equals(1, allocation_sinking_inlining_test.test(a)); |
| 47 expect$.Expect.equals(-1, allocation_sinking_inlining_test.test(b)); |
| 48 }; |
| 49 dart.fn(allocation_sinking_inlining_test.main, VoidTodynamic()); |
| 50 // Exports: |
| 51 exports.allocation_sinking_inlining_test = allocation_sinking_inlining_test; |
| 52 }); |
OLD | NEW |