Changeset 273605 in webkit
- Timestamp:
- Feb 26, 2021 4:37:31 PM (17 months ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
builtins/PromiseOperations.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r273594 r273605 1 2021-02-26 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Avoid function allocations for non-user-provided Promise then callbacks 4 https://bugs.webkit.org/show_bug.cgi?id=222490 5 6 Reviewed by Keith Miller. 7 8 At @performPromiseThen point, callback function objects themselves are not accessible from users 9 if they are not passed from users. So, we can reuse functions if users do not pass functions. 10 11 * builtins/PromiseOperations.js: 12 (globalPrivate.promiseEmptyOnFulfilled): 13 (globalPrivate.promiseEmptyOnRejected): 14 (globalPrivate.performPromiseThen): 15 (onFulfilled): Deleted. 16 (onRejected): Deleted. 17 1 18 2021-02-26 Michael Saboff <msaboff@apple.com> 2 19 -
trunk/Source/JavaScriptCore/builtins/PromiseOperations.js
r272005 r273605 521 521 522 522 @globalPrivate 523 function promiseEmptyOnFulfilled(argument) 524 { 525 "use strict"; 526 527 return argument; 528 } 529 530 @globalPrivate 531 function promiseEmptyOnRejected(argument) 532 { 533 "use strict"; 534 535 throw argument; 536 } 537 538 @globalPrivate 523 539 function performPromiseThen(promise, onFulfilled, onRejected, promiseOrCapability) 524 540 { … … 526 542 527 543 if (!@isCallable(onFulfilled)) 528 onFulfilled = function (argument) { return argument; };544 onFulfilled = @promiseEmptyOnFulfilled; 529 545 530 546 if (!@isCallable(onRejected)) 531 onRejected = function (argument) { throw argument; };547 onRejected = @promiseEmptyOnRejected; 532 548 533 549 var reaction = @newPromiseReaction(promiseOrCapability, onFulfilled, onRejected);
Note: See TracChangeset
for help on using the changeset viewer.