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 (function(global, utils, extrasUtils) { | 5 (function(global, utils, extrasUtils) { |
6 | 6 |
7 "use strict"; | 7 "use strict"; |
8 | 8 |
9 %CheckIsBootstrapping(); | 9 %CheckIsBootstrapping(); |
10 | 10 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 } | 142 } |
143 | 143 |
144 function FulfillPromise(promise, status, value, promiseQueue) { | 144 function FulfillPromise(promise, status, value, promiseQueue) { |
145 if (GET_PRIVATE(promise, promiseStateSymbol) === kPending) { | 145 if (GET_PRIVATE(promise, promiseStateSymbol) === kPending) { |
146 var tasks = GET_PRIVATE(promise, promiseQueue); | 146 var tasks = GET_PRIVATE(promise, promiseQueue); |
147 if (!IS_UNDEFINED(tasks)) { | 147 if (!IS_UNDEFINED(tasks)) { |
148 var tasks = GET_PRIVATE(promise, promiseQueue); | 148 var tasks = GET_PRIVATE(promise, promiseQueue); |
149 var deferreds = GET_PRIVATE(promise, promiseDeferredReactionsSymbol); | 149 var deferreds = GET_PRIVATE(promise, promiseDeferredReactionsSymbol); |
150 PromiseEnqueue(value, tasks, deferreds, status); | 150 PromiseEnqueue(value, tasks, deferreds, status); |
151 } | 151 } |
152 PromiseSet(promise, status, value); | 152 SET_PRIVATE(promise, promiseStateSymbol, status); |
| 153 SET_PRIVATE(promise, promiseResultSymbol, value); |
153 } | 154 } |
154 } | 155 } |
155 | 156 |
156 function PromiseHandle(value, handler, deferred) { | 157 function PromiseHandle(value, handler, deferred) { |
157 var debug_is_active = DEBUG_IS_ACTIVE; | 158 var debug_is_active = DEBUG_IS_ACTIVE; |
158 try { | 159 try { |
159 if (debug_is_active) %DebugPushPromise(deferred.promise, PromiseHandle); | 160 if (debug_is_active) %DebugPushPromise(deferred.promise, PromiseHandle); |
160 var result = handler(value); | 161 var result = handler(value); |
161 deferred.resolve(result); | 162 deferred.resolve(result); |
162 } catch (exception) { | 163 } catch (exception) { |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 to.PromiseChain = PromiseChain; | 584 to.PromiseChain = PromiseChain; |
584 to.PromiseDefer = PromiseDefer; | 585 to.PromiseDefer = PromiseDefer; |
585 to.PromiseAccept = PromiseAccept; | 586 to.PromiseAccept = PromiseAccept; |
586 | 587 |
587 to.PromiseCreateRejected = PromiseCreateRejected; | 588 to.PromiseCreateRejected = PromiseCreateRejected; |
588 to.PromiseCreateResolved = PromiseCreateResolved; | 589 to.PromiseCreateResolved = PromiseCreateResolved; |
589 to.PromiseThen = PromiseThen; | 590 to.PromiseThen = PromiseThen; |
590 }); | 591 }); |
591 | 592 |
592 }) | 593 }) |
OLD | NEW |