Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8e4626937bb98d1aad28964b669a9c32b5ffdc55
      
https://github.com/WebKit/WebKit/commit/8e4626937bb98d1aad28964b669a9c32b5ffdc55
  Author: Sosuke Suzuki <[email protected]>
  Date:   2026-01-10 (Sat, 10 Jan 2026)

  Changed paths:
    A JSTests/stress/async-builtin-function-keyword-start-metadata.js
    M Source/JavaScriptCore/builtins/BuiltinExecutables.cpp
    M Source/JavaScriptCore/parser/Nodes.cpp
    M Source/JavaScriptCore/tools/JSDollarVM.cpp

  Log Message:
  -----------
  [JSC] Fix `functionStart` mismatch for async builtin functions
https://bugs.webkit.org/show_bug.cgi?id=304918

Reviewed by Yusuke Suzuki.

The hand-rolled parser in BuiltinExecutables.cpp incorrectly calculated
functionKeywordStart for async functions. It was using:

    int functionKeywordStart = strlen("(") + asyncOffset;

For async functions, asyncOffset is 6 (strlen("async ")), so this
returned 7, pointing to the "function" keyword. However, the JSC parser
sets functionStart to 1, pointing to the "async" keyword.

This patch fixes the calculation to always use strlen("(") = 1, which
matches the JSC parser behavior.

Additionally, this patch:
- Adds m_functionStart comparison to FunctionMetadataNode::operator==
  so that mismatches are properly detected during validation.
- Extends $vm.createBuiltin to accept an optional visibility argument
  ("public", "private", "privateRecursive") for testing purposes.

* JSTests/stress/async-builtin-function-keyword-start-metadata.js: Added.
* Source/JavaScriptCore/builtins/BuiltinExecutables.cpp:
(JSC::BuiltinExecutables::createExecutable):
* Source/JavaScriptCore/parser/Nodes.cpp:
(JSC::FunctionMetadataNode::operator== const):
* Source/JavaScriptCore/tools/JSDollarVM.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):

Canonical link: https://commits.webkit.org/305410@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to