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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 %MoveArrayContents(resolutions, valuesArray); | 88 %MoveArrayContents(resolutions, valuesArray); |
89 %_Call(deferred.resolve, UNDEFINED, valuesArray); | 89 %_Call(deferred.resolve, UNDEFINED, valuesArray); |
90 } | 90 } |
91 | 91 |
92 } catch (e) { | 92 } catch (e) { |
93 %_Call(deferred.reject, UNDEFINED, e); | 93 %_Call(deferred.reject, UNDEFINED, e); |
94 } | 94 } |
95 return deferred.promise; | 95 return deferred.promise; |
96 } | 96 } |
97 | 97 |
| 98 %DebugMarkPromiseAllOrRace(PromiseAll); |
| 99 |
98 // ES#sec-promise.race | 100 // ES#sec-promise.race |
99 // Promise.race ( iterable ) | 101 // Promise.race ( iterable ) |
100 function PromiseRace(iterable) { | 102 function PromiseRace(iterable) { |
101 if (!IS_RECEIVER(this)) { | 103 if (!IS_RECEIVER(this)) { |
102 throw %make_type_error(kCalledOnNonObject, PromiseRace); | 104 throw %make_type_error(kCalledOnNonObject, PromiseRace); |
103 } | 105 } |
104 | 106 |
105 // false debugEvent so that forwarding the rejection through race does not | 107 // false debugEvent so that forwarding the rejection through race does not |
106 // trigger redundant ExceptionEvents | 108 // trigger redundant ExceptionEvents |
107 var deferred = %new_promise_capability(this, false); | 109 var deferred = %new_promise_capability(this, false); |
(...skipping 14 matching lines...) Expand all Loading... |
122 if (instrumenting && %is_promise(throwawayPromise)) { | 124 if (instrumenting && %is_promise(throwawayPromise)) { |
123 SET_PRIVATE(throwawayPromise, promiseHandledBySymbol, deferred.promise); | 125 SET_PRIVATE(throwawayPromise, promiseHandledBySymbol, deferred.promise); |
124 } | 126 } |
125 } | 127 } |
126 } catch (e) { | 128 } catch (e) { |
127 %_Call(deferred.reject, UNDEFINED, e); | 129 %_Call(deferred.reject, UNDEFINED, e); |
128 } | 130 } |
129 return deferred.promise; | 131 return deferred.promise; |
130 } | 132 } |
131 | 133 |
| 134 %DebugMarkPromiseAllOrRace(PromiseRace); |
| 135 |
132 // ------------------------------------------------------------------- | 136 // ------------------------------------------------------------------- |
133 // Install exported functions. | 137 // Install exported functions. |
134 | 138 |
135 utils.InstallFunctions(GlobalPromise, DONT_ENUM, [ | 139 utils.InstallFunctions(GlobalPromise, DONT_ENUM, [ |
136 "all", PromiseAll, | 140 "all", PromiseAll, |
137 "race", PromiseRace, | 141 "race", PromiseRace, |
138 ]); | 142 ]); |
139 | 143 |
140 %InstallToContext([ | 144 %InstallToContext([ |
141 "promise_id_resolve_handler", PromiseIdResolveHandler, | 145 "promise_id_resolve_handler", PromiseIdResolveHandler, |
142 "promise_id_reject_handler", PromiseIdRejectHandler | 146 "promise_id_reject_handler", PromiseIdRejectHandler |
143 ]); | 147 ]); |
144 | 148 |
145 }) | 149 }) |
OLD | NEW |