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

Side by Side Diff: test/js-perf-test/AsyncAwait/baseline-babel-es2017.js

Issue 2577393002: [js-perf-test] Add a basic async-await microbenchmark (Closed)
Patch Set: Add a function with multiple awaits Created 4 years 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
(Empty)
1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5
6 new BenchmarkSuite('BaselineES2017', [1000], [
7 new Benchmark('Basic', false, false, 0, Basic, Setup),
8 ]);
9
10
11 var a,b,c,d,e,f,g,h,i,j,x;
12
13 function _asyncToGenerator(fn) {
14 return function () {
15 var gen = fn.apply(this, arguments);
16 return new Promise(function (resolve, reject) {
17 function step(key, arg) {
18 try {
19 var info = gen[key](arg);
20 var value = info.value;
21 } catch (error) {
22 reject(error);
23 return;
24 }
25 if (info.done) {
26 resolve(value);
27 } else {
28 return Promise.resolve(value)
29 .then(function (value) {
30 step("next", value);
31 }, function (err) {
32 step("throw", err);
33 });
34 }
35 }
36 return step("next");
37 });
38 };
39 }
40
41 function Setup() {
42 x = Promise.resolve();
43
44 j = (() => {
45 var _ref = _asyncToGenerator(function* () {
46 return x;
47 });
48
49 function j() {
50 return _ref.apply(this, arguments);
51 }
52
53 return j;
54 })();
55 i = (() => {
56 var _ref2 = _asyncToGenerator(function* () {
57 for (let i = 0; i < 9; i++) yield j();
58 return yield j();
59 });
60
61 function i() {
62 return _ref2.apply(this, arguments);
63 }
64
65 return i;
66 })();
67 h = (() => {
68 var _ref3 = _asyncToGenerator(function* () {
69 return yield i();
70 });
71
72 function h() {
73 return _ref3.apply(this, arguments);
74 }
75
76 return h;
77 })();
78 g = (() => {
79 var _ref4 = _asyncToGenerator(function* () {
80 return yield h();
81 });
82
83 function g() {
84 return _ref4.apply(this, arguments);
85 }
86
87 return g;
88 })();
89 f = (() => {
90 var _ref5 = _asyncToGenerator(function* () {
91 return yield g();
92 });
93
94 function f() {
95 return _ref5.apply(this, arguments);
96 }
97
98 return f;
99 })();
100 e = (() => {
101 var _ref6 = _asyncToGenerator(function* () {
102 return yield f();
103 });
104
105 function e() {
106 return _ref6.apply(this, arguments);
107 }
108
109 return e;
110 })();
111 d = (() => {
112 var _ref7 = _asyncToGenerator(function* () {
113 return yield e();
114 });
115
116 function d() {
117 return _ref7.apply(this, arguments);
118 }
119
120 return d;
121 })();
122 c = (() => {
123 var _ref8 = _asyncToGenerator(function* () {
124 return yield d();
125 });
126
127 function c() {
128 return _ref8.apply(this, arguments);
129 }
130
131 return c;
132 })();
133 b = (() => {
134 var _ref9 = _asyncToGenerator(function* () {
135 return yield c();
136 });
137
138 function b() {
139 return _ref9.apply(this, arguments);
140 }
141
142 return b;
143 })();
144 a = (() => {
145 var _ref10 = _asyncToGenerator(function* () {
146 return yield b();
147 });
148
149 function a() {
150 return _ref10.apply(this, arguments);
151 }
152
153 return a;
154 })();
155
156 %RunMicrotasks();
157 }
158
159 function Basic() {
160 a();
161 %RunMicrotasks();
162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698