WebKit Bugzilla
Attachment 372138 Details for
Bug 198864
: Optimize `resolve` method lookup in Promise static methods
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-198864-20190614232335.patch (text/plain), 7.69 KB, created by
Alexey Shvayka
on 2019-06-14 13:23:37 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Alexey Shvayka
Created:
2019-06-14 13:23:37 PDT
Size:
7.69 KB
patch
obsolete
>Index: JSTests/ChangeLog >=================================================================== >--- JSTests/ChangeLog (revision 246441) >+++ JSTests/ChangeLog (working copy) >@@ -1,3 +1,12 @@ >+2019-06-14 Alexey Shvayka <shvaikalesh@gmail.com> >+ >+ Optimize `resolve` method lookup in Promise static methods >+ https://bugs.webkit.org/show_bug.cgi?id=198864 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * test262/expectations.yaml: Mark 18 test cases as passing. >+ > 2019-06-13 Yusuke Suzuki <ysuzuki@apple.com> > > Yarr bytecode compilation failure should be gracefully handled >Index: JSTests/test262/expectations.yaml >=================================================================== >--- JSTests/test262/expectations.yaml (revision 246436) >+++ JSTests/test262/expectations.yaml (working copy) >@@ -1080,27 +1080,9 @@ test/built-ins/Object/proto-from-ctor.js > test/built-ins/Object/prototype/toString/proxy-function.js: > default: 'Test262Error: function proxy Expected SameValue(ë[object Object]û, ë[object Function]û) to be true' > strict mode: 'Test262Error: function proxy Expected SameValue(ë[object Object]û, ë[object Function]û) to be true' >-test/built-ins/Promise/all/invoke-resolve-get-error-close.js: >- default: 'Test262Error: Expected SameValue(ë1û, ë0û) to be true' >- strict mode: 'Test262Error: Expected SameValue(ë1û, ë0û) to be true' >-test/built-ins/Promise/all/invoke-resolve-get-once-multiple-calls.js: >- default: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(ë4û, ë1û) to be true' >- strict mode: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(ë4û, ë1û) to be true' >-test/built-ins/Promise/all/invoke-resolve-get-once-no-calls.js: >- default: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(ë0û, ë1û) to be true' >- strict mode: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(ë0û, ë1û) to be true' > test/built-ins/Promise/all/resolve-element-function-nonconstructor.js: > default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' > strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' >-test/built-ins/Promise/allSettled/invoke-resolve-get-error-close.js: >- default: 'Test262Error: Expected SameValue(ë1û, ë0û) to be true' >- strict mode: 'Test262Error: Expected SameValue(ë1û, ë0û) to be true' >-test/built-ins/Promise/allSettled/invoke-resolve-get-once-multiple-calls.js: >- default: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(ë4û, ë1û) to be true' >- strict mode: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(ë4û, ë1û) to be true' >-test/built-ins/Promise/allSettled/invoke-resolve-get-once-no-calls.js: >- default: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(ë0û, ë1û) to be true' >- strict mode: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(ë0û, ë1û) to be true' > test/built-ins/Promise/allSettled/reject-element-function-nonconstructor.js: > default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' > strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' >@@ -1110,15 +1092,6 @@ test/built-ins/Promise/allSettled/resolv > test/built-ins/Promise/proto-from-ctor-realm.js: > default: 'Test262Error: Expected SameValue(ë[object Promise]û, ë[object Promise]û) to be true' > strict mode: 'Test262Error: Expected SameValue(ë[object Promise]û, ë[object Promise]û) to be true' >-test/built-ins/Promise/race/invoke-resolve-get-error-close.js: >- default: 'Test262Error: Expected SameValue(ë1û, ë0û) to be true' >- strict mode: 'Test262Error: Expected SameValue(ë1û, ë0û) to be true' >-test/built-ins/Promise/race/invoke-resolve-get-once-multiple-calls.js: >- default: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(ë4û, ë1û) to be true' >- strict mode: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(ë4û, ë1û) to be true' >-test/built-ins/Promise/race/invoke-resolve-get-once-no-calls.js: >- default: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(ë0û, ë1û) to be true' >- strict mode: 'Test262Error: Got `resolve` only once for each iterated value Expected SameValue(ë0û, ë1û) to be true' > test/built-ins/Promise/reject-function-nonconstructor.js: > default: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' > strict mode: 'Test262Error: Expected a TypeError to be thrown but no exception was thrown at all' >Index: Source/JavaScriptCore/ChangeLog >=================================================================== >--- Source/JavaScriptCore/ChangeLog (revision 246436) >+++ Source/JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,17 @@ >+2019-06-14 Alexey Shvayka <shvaikalesh@gmail.com> >+ >+ Optimize `resolve` method lookup in Promise static methods >+ https://bugs.webkit.org/show_bug.cgi?id=198864 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Lookup `resolve` method only once in Promise.{all,allSettled,race}. >+ (https://github.com/tc39/ecma262/pull/1506) >+ >+ Already implemented in V8. >+ >+ * builtins/PromiseConstructor.js: >+ > 2019-06-13 Yusuke Suzuki <ysuzuki@apple.com> > > Yarr bytecode compilation failure should be gracefully handled >Index: Source/JavaScriptCore/builtins/PromiseConstructor.js >=================================================================== >--- Source/JavaScriptCore/builtins/PromiseConstructor.js (revision 246436) >+++ Source/JavaScriptCore/builtins/PromiseConstructor.js (working copy) >@@ -56,9 +56,13 @@ function all(iterable) > } > > try { >+ var promiseResolve = this.resolve; >+ if (typeof promiseResolve !== "function") >+ @throwTypeError("Promise resolve is not a function"); >+ > for (var value of iterable) { > @putByValDirect(values, index, @undefined); >- var nextPromise = this.resolve(value); >+ var nextPromise = promiseResolve.@call(this, value); > var resolveElement = newResolveElement(index); > ++remainingElementsCount; > nextPromise.then(resolveElement, promiseCapability.@reject); >@@ -136,9 +140,13 @@ function allSettled(iterable) > } > > try { >+ var promiseResolve = this.resolve; >+ if (typeof promiseResolve !== "function") >+ @throwTypeError("Promise resolve is not a function"); >+ > for (var value of iterable) { > @putByValDirect(values, index, @undefined); >- var nextPromise = this.resolve(value); >+ var nextPromise = promiseResolve.@call(this, value); > var [resolveElement, rejectElement] = newResolveRejectElements(index); > ++remainingElementsCount; > nextPromise.then(resolveElement, rejectElement); >@@ -165,8 +173,12 @@ function race(iterable) > var promiseCapability = @newPromiseCapability(this); > > try { >+ var promiseResolve = this.resolve; >+ if (typeof promiseResolve !== "function") >+ @throwTypeError("Promise resolve is not a function"); >+ > for (var value of iterable) { >- var nextPromise = this.resolve(value); >+ var nextPromise = promiseResolve.@call(this, value); > nextPromise.then(promiseCapability.@resolve, promiseCapability.@reject); > } > } catch (error) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 198864
:
372138
|
372496