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

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

Issue 1850643002: Adding %_NewObject intrinsic (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: formatting Created 4 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 | « src/full-codegen/full-codegen.cc ('k') | src/js/regexp.js » ('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 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return { 54 return {
55 __proto__: null, 55 __proto__: null,
56 resolve: resolve, 56 resolve: resolve,
57 reject: reject 57 reject: reject
58 }; 58 };
59 } 59 }
60 60
61 61
62 var GlobalPromise = function Promise(resolver) { 62 var GlobalPromise = function Promise(resolver) {
63 if (resolver === promiseRawSymbol) { 63 if (resolver === promiseRawSymbol) {
64 return %NewObject(GlobalPromise, new.target); 64 return %_NewObject(GlobalPromise, new.target);
65 } 65 }
66 if (IS_UNDEFINED(new.target)) throw MakeTypeError(kNotAPromise, this); 66 if (IS_UNDEFINED(new.target)) throw MakeTypeError(kNotAPromise, this);
67 if (!IS_CALLABLE(resolver)) 67 if (!IS_CALLABLE(resolver))
68 throw MakeTypeError(kResolverNotAFunction, resolver); 68 throw MakeTypeError(kResolverNotAFunction, resolver);
69 69
70 var promise = PromiseInit(%NewObject(GlobalPromise, new.target)); 70 var promise = PromiseInit(%_NewObject(GlobalPromise, new.target));
71 var callbacks = CreateResolvingFunctions(promise); 71 var callbacks = CreateResolvingFunctions(promise);
72 72
73 try { 73 try {
74 %DebugPushPromise(promise, Promise); 74 %DebugPushPromise(promise, Promise);
75 resolver(callbacks.resolve, callbacks.reject); 75 resolver(callbacks.resolve, callbacks.reject);
76 } catch (e) { 76 } catch (e) {
77 %_Call(callbacks.reject, UNDEFINED, e); 77 %_Call(callbacks.reject, UNDEFINED, e);
78 } finally { 78 } finally {
79 %DebugPopPromise(); 79 %DebugPopPromise();
80 } 80 }
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 [PromiseChain, PromiseDeferred, PromiseResolved].forEach( 472 [PromiseChain, PromiseDeferred, PromiseResolved].forEach(
473 fn => %FunctionRemovePrototype(fn)); 473 fn => %FunctionRemovePrototype(fn));
474 474
475 utils.Export(function(to) { 475 utils.Export(function(to) {
476 to.PromiseChain = PromiseChain; 476 to.PromiseChain = PromiseChain;
477 to.PromiseDeferred = PromiseDeferred; 477 to.PromiseDeferred = PromiseDeferred;
478 to.PromiseResolved = PromiseResolved; 478 to.PromiseResolved = PromiseResolved;
479 }); 479 });
480 480
481 }) 481 })
OLDNEW
« no previous file with comments | « src/full-codegen/full-codegen.cc ('k') | src/js/regexp.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698