OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 "use strict"; | 5 "use strict"; |
6 | 6 |
7 // This file relies on the fact that the following declaration has been made | 7 // This file relies on the fact that the following declaration has been made |
8 // in runtime.js: | 8 // in runtime.js: |
9 // var $Object = global.Object | 9 // var $Object = global.Object |
10 // var $WeakMap = global.WeakMap | 10 // var $WeakMap = global.WeakMap |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 } | 132 } |
133 for (var i = 0; i < tasks.length; i += 2) { | 133 for (var i = 0; i < tasks.length; i += 2) { |
134 PromiseHandle(value, tasks[i], tasks[i + 1]) | 134 PromiseHandle(value, tasks[i], tasks[i + 1]) |
135 } | 135 } |
136 if (instrumenting) { | 136 if (instrumenting) { |
137 %DebugAsyncTaskEvent({ type: "didHandle", id: id, name: name }); | 137 %DebugAsyncTaskEvent({ type: "didHandle", id: id, name: name }); |
138 } | 138 } |
139 }); | 139 }); |
140 if (instrumenting) { | 140 if (instrumenting) { |
141 id = ++lastMicrotaskId; | 141 id = ++lastMicrotaskId; |
142 name = status > 0 ? "Promise.Resolved" : "Promise.Rejected"; | 142 name = status > 0 ? "Promise.resolve" : "Promise.reject"; |
143 %DebugAsyncTaskEvent({ type: "enqueue", id: id, name: name }); | 143 %DebugAsyncTaskEvent({ type: "enqueue", id: id, name: name }); |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 function PromiseIdResolveHandler(x) { return x } | 147 function PromiseIdResolveHandler(x) { return x } |
148 function PromiseIdRejectHandler(r) { throw r } | 148 function PromiseIdRejectHandler(r) { throw r } |
149 | 149 |
150 function PromiseNopResolver() {} | 150 function PromiseNopResolver() {} |
151 | 151 |
152 // ------------------------------------------------------------------- | 152 // ------------------------------------------------------------------- |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 "race", PromiseOne, | 334 "race", PromiseOne, |
335 "resolve", PromiseCast | 335 "resolve", PromiseCast |
336 ]); | 336 ]); |
337 InstallFunctions($Promise.prototype, DONT_ENUM, [ | 337 InstallFunctions($Promise.prototype, DONT_ENUM, [ |
338 "chain", PromiseChain, | 338 "chain", PromiseChain, |
339 "then", PromiseThen, | 339 "then", PromiseThen, |
340 "catch", PromiseCatch | 340 "catch", PromiseCatch |
341 ]); | 341 ]); |
342 | 342 |
343 })(); | 343 })(); |
OLD | NEW |