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

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

Issue 1463803002: [debugger] flood function for stepping before calling it. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix 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, resolver); 74 %DebugPushPromise(promise, Promise);
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, handler); 142 %DebugPushPromise(deferred.promise, PromiseHandle);
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);
344 return onReject(MakeTypeError(kPromiseCyclic, x)); 343 return onReject(MakeTypeError(kPromiseCyclic, x));
345 } else if (IsPromise(x)) { 344 } else if (IsPromise(x)) {
346 return x.then(onResolve, onReject); 345 return x.then(onResolve, onReject);
347 } else { 346 } else {
348 DEBUG_PREPARE_STEP_IN_IF_STEPPING(onResolve);
349 return onResolve(x); 347 return onResolve(x);
350 } 348 }
351 }, 349 },
352 onReject 350 onReject
353 ); 351 );
354 } 352 }
355 353
356 // Combinators. 354 // Combinators.
357 355
358 function PromiseCast(x) { 356 function PromiseCast(x) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 [PromiseChain, PromiseDeferred, PromiseResolved].forEach( 477 [PromiseChain, PromiseDeferred, PromiseResolved].forEach(
480 fn => %FunctionRemovePrototype(fn)); 478 fn => %FunctionRemovePrototype(fn));
481 479
482 utils.Export(function(to) { 480 utils.Export(function(to) {
483 to.PromiseChain = PromiseChain; 481 to.PromiseChain = PromiseChain;
484 to.PromiseDeferred = PromiseDeferred; 482 to.PromiseDeferred = PromiseDeferred;
485 to.PromiseResolved = PromiseResolved; 483 to.PromiseResolved = PromiseResolved;
486 }); 484 });
487 485
488 }) 486 })
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