Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2af38faaec709b9af4ffb54373d691d5a894e22a
https://github.com/WebKit/WebKit/commit/2af38faaec709b9af4ffb54373d691d5a894e22a
Author: Sosuke Suzuki <[email protected]>
Date: 2026-08-03 (Mon, 03 Aug 2026)
Changed paths:
A JSTests/microbenchmarks/function-bind-method.js
A JSTests/stress/bound-function-strength-reduction-method.js
M Source/JavaScriptCore/runtime/JSBoundFunction.cpp
Log Message:
-----------
[JSC] `Function#bind` strength reduction in DFG should accept method
structures
https://bugs.webkit.org/show_bug.cgi?id=320959
Reviewed by Yusuke Suzuki.
296674@main split JSFunction structures for functions without a "prototype"
property
(class methods, object-literal shorthand methods, accessors) into
strictMethodStructure /
sloppyMethodStructure, but
JSBoundFunction::canSkipNameAndLengthMaterialization() was not
updated. So `this.handleClick.bind(this)` on a class method no longer folds
FunctionBind
into NewBoundFunction and always calls operationFunctionBind. This patch adds
the two
method structures to the whitelist; they are created from the same
createStructure() calls
as their function counterparts, so the lazy .name/.length materialization
invariant holds.
baseline patched
function-bind-method 11.5201+-0.1138 ^ 2.5012+-0.0493 ^
definitely 4.6058x faster
Tests: JSTests/microbenchmarks/function-bind-method.js
JSTests/stress/bound-function-strength-reduction-method.js
* JSTests/microbenchmarks/function-bind-method.js: Added.
(Component):
(Component.prototype.handleClick):
(Component.prototype.onScroll):
(Component.prototype.render):
(shorthand.handle):
* JSTests/stress/bound-function-strength-reduction-method.js: Added.
(shouldBe):
(shouldThrow):
(prototype.handleClick):
(sloppyHolder.handle):
(bindClassMethod):
(bindShorthandMethod):
(Modified.prototype.method):
(Modified):
(bindModifiedMethod):
* Source/JavaScriptCore/runtime/JSBoundFunction.cpp:
(JSC::JSBoundFunction::canSkipNameAndLengthMaterialization):
Canonical link: https://commits.webkit.org/318527@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications