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

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

Issue 1474943005: Revert of [debugger] flood function for stepping before calling it. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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/js/macros.py ('k') | src/mips/builtins-mips.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 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 if (resolver === promiseRawSymbol) { 64 if (resolver === promiseRawSymbol) {
65 return %NewObject(GlobalPromise, new.target); 65 return %NewObject(GlobalPromise, new.target);
66 } 66 }
67 if (IS_UNDEFINED(new.target)) throw MakeTypeError(kNotAPromise, this); 67 if (IS_UNDEFINED(new.target)) throw MakeTypeError(kNotAPromise, this);
68 if (!IS_CALLABLE(resolver)) 68 if (!IS_CALLABLE(resolver))
69 throw MakeTypeError(kResolverNotAFunction, resolver); 69 throw MakeTypeError(kResolverNotAFunction, resolver);
70 70
71 var promise = PromiseInit(%NewObject(GlobalPromise, new.target)); 71 var promise = PromiseInit(%NewObject(GlobalPromise, new.target));
72 72
73 try { 73 try {
74 %DebugPushPromise(promise, Promise); 74 %DebugPushPromise(promise, Promise, resolver);
75 var callbacks = CreateResolvingFunctions(promise); 75 var callbacks = CreateResolvingFunctions(promise);
76 resolver(callbacks.resolve, callbacks.reject); 76 resolver(callbacks.resolve, callbacks.reject);
77 } catch (e) { 77 } catch (e) {
78 PromiseReject(promise, e); 78 PromiseReject(promise, e);
79 } finally { 79 } finally {
80 %DebugPopPromise(); 80 %DebugPopPromise();
81 } 81 }
82 82
83 return promise; 83 return promise;
84 } 84 }
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 deferred.reject(r); 132 deferred.reject(r);
133 } 133 }
134 return deferred.promise; 134 return deferred.promise;
135 } 135 }
136 } 136 }
137 return x; 137 return x;
138 } 138 }
139 139
140 function PromiseHandle(value, handler, deferred) { 140 function PromiseHandle(value, handler, deferred) {
141 try { 141 try {
142 %DebugPushPromise(deferred.promise, PromiseHandle); 142 %DebugPushPromise(deferred.promise, PromiseHandle, handler);
143 var result = handler(value); 143 var result = handler(value);
144 if (result === deferred.promise) 144 if (result === deferred.promise)
145 throw MakeTypeError(kPromiseCyclic, result); 145 throw MakeTypeError(kPromiseCyclic, result);
146 else if (IsPromise(result)) 146 else if (IsPromise(result))
147 %_Call(PromiseChain, result, deferred.resolve, deferred.reject); 147 %_Call(PromiseChain, result, deferred.resolve, deferred.reject);
148 else 148 else
149 deferred.resolve(result); 149 deferred.resolve(result);
150 } catch (exception) { 150 } catch (exception) {
151 try { deferred.reject(exception); } catch (e) { } 151 try { deferred.reject(exception); } catch (e) { }
152 } finally { 152 } finally {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 onReject = IS_CALLABLE(onReject) ? onReject : PromiseIdRejectHandler; 333 onReject = IS_CALLABLE(onReject) ? onReject : PromiseIdRejectHandler;
334 var that = this; 334 var that = this;
335 var constructor = this.constructor; 335 var constructor = this.constructor;
336 return %_Call( 336 return %_Call(
337 PromiseChainInternal, 337 PromiseChainInternal,
338 this, 338 this,
339 constructor, 339 constructor,
340 function(x) { 340 function(x) {
341 x = PromiseCoerce(constructor, x); 341 x = PromiseCoerce(constructor, x);
342 if (x === that) { 342 if (x === that) {
343 DEBUG_PREPARE_STEP_IN_IF_STEPPING(onReject);
343 return onReject(MakeTypeError(kPromiseCyclic, x)); 344 return onReject(MakeTypeError(kPromiseCyclic, x));
344 } else if (IsPromise(x)) { 345 } else if (IsPromise(x)) {
345 return x.then(onResolve, onReject); 346 return x.then(onResolve, onReject);
346 } else { 347 } else {
348 DEBUG_PREPARE_STEP_IN_IF_STEPPING(onResolve);
347 return onResolve(x); 349 return onResolve(x);
348 } 350 }
349 }, 351 },
350 onReject 352 onReject
351 ); 353 );
352 } 354 }
353 355
354 // Combinators. 356 // Combinators.
355 357
356 function PromiseCast(x) { 358 function PromiseCast(x) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 [PromiseChain, PromiseDeferred, PromiseResolved].forEach( 479 [PromiseChain, PromiseDeferred, PromiseResolved].forEach(
478 fn => %FunctionRemovePrototype(fn)); 480 fn => %FunctionRemovePrototype(fn));
479 481
480 utils.Export(function(to) { 482 utils.Export(function(to) {
481 to.PromiseChain = PromiseChain; 483 to.PromiseChain = PromiseChain;
482 to.PromiseDeferred = PromiseDeferred; 484 to.PromiseDeferred = PromiseDeferred;
483 to.PromiseResolved = PromiseResolved; 485 to.PromiseResolved = PromiseResolved;
484 }); 486 });
485 487
486 }) 488 })
OLDNEW
« no previous file with comments | « src/js/macros.py ('k') | src/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698