OLD | NEW |
(Empty) | |
| 1 dart_library.library('language/deoptimized_function_on_stack_test', null, /* Imp
orts */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__deoptimized_function_on_stack_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 deoptimized_function_on_stack_test = Object.create(null); |
| 12 let JSArrayOfA = () => (JSArrayOfA = dart.constFn(_interceptors.JSArray$(deopt
imized_function_on_stack_test.A)))(); |
| 13 let JSArrayOfObject = () => (JSArrayOfObject = dart.constFn(_interceptors.JSAr
ray$(core.Object)))(); |
| 14 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 15 let ListAndintTodynamic = () => (ListAndintTodynamic = dart.constFn(dart.defin
iteFunctionType(dart.dynamic, [core.List, core.int])))(); |
| 16 deoptimized_function_on_stack_test.main = function() { |
| 17 deoptimized_function_on_stack_test.warmup(); |
| 18 deoptimized_function_on_stack_test.runTest(); |
| 19 }; |
| 20 dart.fn(deoptimized_function_on_stack_test.main, VoidTodynamic()); |
| 21 deoptimized_function_on_stack_test.warmup = function() { |
| 22 let a = JSArrayOfA().of([new deoptimized_function_on_stack_test.A(), new deo
ptimized_function_on_stack_test.A(), new deoptimized_function_on_stack_test.A(),
new deoptimized_function_on_stack_test.A()]); |
| 23 let res = 0; |
| 24 for (let i = 0; i < 20; i++) { |
| 25 res = core.int._check(deoptimized_function_on_stack_test.call(a, 0)); |
| 26 } |
| 27 expect$.Expect.equals(10, res); |
| 28 }; |
| 29 dart.fn(deoptimized_function_on_stack_test.warmup, VoidTodynamic()); |
| 30 deoptimized_function_on_stack_test.runTest = function() { |
| 31 let a = JSArrayOfObject().of([new deoptimized_function_on_stack_test.A(), ne
w deoptimized_function_on_stack_test.A(), new deoptimized_function_on_stack_test
.B(), new deoptimized_function_on_stack_test.A(), new deoptimized_function_on_st
ack_test.B(), new deoptimized_function_on_stack_test.B()]); |
| 32 let res = deoptimized_function_on_stack_test.call(a, 0); |
| 33 expect$.Expect.equals(35, res); |
| 34 }; |
| 35 dart.fn(deoptimized_function_on_stack_test.runTest, VoidTodynamic()); |
| 36 deoptimized_function_on_stack_test.call = function(a, n) { |
| 37 if (dart.notNull(n) < dart.notNull(a[dartx.length])) { |
| 38 let sum = deoptimized_function_on_stack_test.call(a, dart.notNull(n) + 1); |
| 39 for (let i = n; dart.notNull(i) < dart.notNull(a[dartx.length]); i = dart.
notNull(i) + 1) { |
| 40 sum = dart.dsend(sum, '+', dart.dsend(a[dartx.get](i), 'foo')); |
| 41 } |
| 42 return sum; |
| 43 } |
| 44 return 0; |
| 45 }; |
| 46 dart.fn(deoptimized_function_on_stack_test.call, ListAndintTodynamic()); |
| 47 deoptimized_function_on_stack_test.A = class A extends core.Object { |
| 48 foo() { |
| 49 return 1; |
| 50 } |
| 51 }; |
| 52 dart.setSignature(deoptimized_function_on_stack_test.A, { |
| 53 methods: () => ({foo: dart.definiteFunctionType(dart.dynamic, [])}) |
| 54 }); |
| 55 deoptimized_function_on_stack_test.B = class B extends core.Object { |
| 56 foo() { |
| 57 return 2; |
| 58 } |
| 59 }; |
| 60 dart.setSignature(deoptimized_function_on_stack_test.B, { |
| 61 methods: () => ({foo: dart.definiteFunctionType(dart.dynamic, [])}) |
| 62 }); |
| 63 // Exports: |
| 64 exports.deoptimized_function_on_stack_test = deoptimized_function_on_stack_tes
t; |
| 65 }); |
OLD | NEW |