Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 1994bc0cc3e2c0f4389ba0a29df813e1b34374d7
https://github.com/WebKit/WebKit/commit/1994bc0cc3e2c0f4389ba0a29df813e1b34374d7
Author: Sosuke Suzuki <[email protected]>
Date: 2026-07-14 (Tue, 14 Jul 2026)
Changed paths:
M Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
Log Message:
-----------
[JSC] Do not emit unreachable implicit return for arrow function expression
bodies
https://bugs.webkit.org/show_bug.cgi?id=319367
Reviewed by Tadeu Zagallo.
FunctionNode::emitBytecode only recognized an explicit trailing return when
the function body was a single BlockNode ending with a ReturnNode. An arrow
function expression body is parsed as a bare ReturnNode without a wrapping
block, so it was not recognized and we emitted an unreachable `ret undefined`
(plus a constant table entry for `undefined`) after the real return.
This change also accepts a bare ReturnNode as the function's single statement,
so the implicit return is skipped when the body already ends with one.
For example, `() => 1` shrinks from 3 instructions / 5 bytes (enter, ret,
unreachable ret) to 2 instructions / 3 bytes (enter, ret), and drops the
now-unused `undefined` constant. This applies to every expression-body arrow
function, which minifiers emit pervasively.
* Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp:
(JSC::FunctionNode::emitBytecode):
Canonical link: https://commits.webkit.org/317146@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications