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

Side by Side Diff: src/js/prologue.js

Issue 2784213002: Add V8 extra utils for promise state (Closed)
Patch Set: Created 3 years, 8 months 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
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 // We pass true to trigger the debugger's on exception handler. 212 // We pass true to trigger the debugger's on exception handler.
213 extrasUtils.rejectPromise = function rejectPromise(promise, reason) { 213 extrasUtils.rejectPromise = function rejectPromise(promise, reason) {
214 %promise_internal_reject(promise, reason, true); 214 %promise_internal_reject(promise, reason, true);
215 } 215 }
216 216
217 extrasUtils.markPromiseAsHandled = function markPromiseAsHandled(promise) { 217 extrasUtils.markPromiseAsHandled = function markPromiseAsHandled(promise) {
218 %PromiseMarkAsHandled(promise); 218 %PromiseMarkAsHandled(promise);
219 }; 219 };
220 220
221 extrasUtils.promiseState = function promiseState(promise) {
222 return %PromiseStatus(promise);
Dan Ehrenberg 2017/03/30 12:05:53 Is it OK for V8 extras to crash when not-a-promise
223 };
224
225 // [[PromiseState]] values (for extrasUtils.promiseState())
226 // These values should be kept in sync with PromiseStatus in globals.h
227 extrasUtils.kPROMISE_PENDING = 0;
228 extrasUtils.kPROMISE_FULFILLED = 1;
229 extrasUtils.kPROMISE_REJECTED = 2;
230
221 %ToFastProperties(extrasUtils); 231 %ToFastProperties(extrasUtils);
222 232
223 }) 233 })
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698