Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a633a8abfee7ea63976bbf236a78fb00b866dbf8
      
https://github.com/WebKit/WebKit/commit/a633a8abfee7ea63976bbf236a78fb00b866dbf8
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-06-05 (Fri, 05 Jun 2026)

  Changed paths:
    A JSTests/stress/promise-resolving-functions-name-and-length.js
    M Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp
    M Source/JavaScriptCore/jit/JITThunks.cpp
    M Source/JavaScriptCore/jit/JITThunks.h
    M Source/JavaScriptCore/runtime/BooleanConstructor.cpp
    M Source/JavaScriptCore/runtime/JSBoundFunction.cpp
    M Source/JavaScriptCore/runtime/JSCustomGetterFunction.cpp
    M Source/JavaScriptCore/runtime/JSCustomSetterFunction.cpp
    M Source/JavaScriptCore/runtime/JSFunction.cpp
    M Source/JavaScriptCore/runtime/JSFunction.h
    M Source/JavaScriptCore/runtime/JSFunctionInlines.h
    M
Source/JavaScriptCore/runtime/JSFunctionWithFields.cpp
    M Source/JavaScriptCore/runtime/JSFunctionWithFields.h
    M Source/JavaScriptCore/runtime/JSNativeStdFunction.cpp
    M Source/JavaScriptCore/runtime/JSNativeStdFunction.h
    M Source/JavaScriptCore/runtime/JSPromise.cpp
    M Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp
    M Source/JavaScriptCore/runtime/JSPromisePrototype.cpp
    M Source/JavaScriptCore/runtime/NativeExecutable.cpp
    M Source/JavaScriptCore/runtime/NativeExecutable.h
    M Source/JavaScriptCore/runtime/NumberConstructor.cpp
    M Source/JavaScriptCore/runtime/PinballCompletion.cpp
    M Source/JavaScriptCore/runtime/StringConstructor.cpp
    M Source/JavaScriptCore/runtime/VM.cpp
    M Source/JavaScriptCore/runtime/VM.h
    M Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp
    M Source/JavaScriptCore/wasm/js/WebAssemblyFunctionBase.cpp
    M Source/JavaScriptCore/wasm/js/WebAssemblyFunctionBase.h
    M
Source/JavaScriptCore/wasm/js/WebAssemblyPromising.cpp
    M Source/JavaScriptCore/wasm/js/WebAssemblySuspending.cpp
    M Source/JavaScriptCore/wasm/js/WebAssemblyWrapperFunction.cpp

  Log Message:
  -----------
  [JSC] NativeExecutable should have name and length in the same way to 
FunctionExecutable
https://bugs.webkit.org/show_bug.cgi?id=316443
rdar://178844469

Reviewed by Justin Michaud and Yijia Huang.

This is slight optimization for case doing `bind` with native functions,
but largely a preparation for introducing optimization for patterns converting
JS builtins to C++ native functions. Previously NativeExecutable was not
holding length / name appropriately while FunctionExecutable was doing
so. As a result, JSBoundFunction related optimization was skipping
NativeExecutable cases. This becomes a problem when we convert JS
builtin functions to Native version as bind starts going to the slow path.
This patch alignes NativeExecutable's name and length
handling much more
to FunctionExecutable.

* JSTests/stress/promise-resolving-functions-name-and-length.js: Added.
(shouldBe):
(new.Promise):
(checkAnonymousBuiltin):
(i.new.Promise):
* Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants):
* Source/JavaScriptCore/jit/JITThunks.cpp:
(JSC::JITThunks::WeakNativeExecutableHash::hash):
(JSC::JITThunks::WeakNativeExecutableHash::equal):
(JSC::JITThunks::finalize):
(JSC::JITThunks::hostFunctionStub):
* Source/JavaScriptCore/jit/JITThunks.h:
* Source/JavaScriptCore/runtime/BooleanConstructor.cpp:
(JSC::BooleanConstructor::finishCreation):
(JSC::BooleanConstructor::create):
* Source/JavaScriptCore/runtime/JSBoundFunction.cpp:
(JSC::JSBoundFunction::canSkipNameAndLengthMaterialization):
* Source/JavaScriptCore/runtime/JSCustomGetterFunction.cpp:
(JSC::JSCustomGetterFunction::create):
*
Source/JavaScriptCore/runtime/JSCustomSetterFunction.cpp:
(JSC::JSCustomSetterFunction::create):
* Source/JavaScriptCore/runtime/JSFunction.cpp:
(JSC::JSFunction::create):
(JSC::JSFunction::reifyLazyPropertyIfNeeded):
(JSC::JSFunction::reifyLazyPropertyForHostOrBuiltinIfNeeded):
(JSC::JSFunction::reifyLazyBoundNameIfNeeded):
(JSC::JSFunction::finishCreation): Deleted.
* Source/JavaScriptCore/runtime/JSFunction.h:
* Source/JavaScriptCore/runtime/JSFunctionInlines.h:
(JSC::JSFunction::originalLength):
(JSC::JSFunction::originalName):
(JSC::JSFunction::canAssumeNameAndLengthAreOriginal):
* Source/JavaScriptCore/runtime/JSFunctionWithFields.cpp:
(JSC::JSFunctionWithFields::create):
* Source/JavaScriptCore/runtime/JSFunctionWithFields.h:
* Source/JavaScriptCore/runtime/JSNativeStdFunction.cpp:
(JSC::JSNativeStdFunction::getHostFunction):
(JSC::JSNativeStdFunction::create):
(JSC::JSNativeStdFunction::finishCreation): Deleted.
*
Source/JavaScriptCore/runtime/JSNativeStdFunction.h:
* Source/JavaScriptCore/runtime/JSPromise.cpp:
(JSC::JSPromise::createFirstResolveFunction):
(JSC::JSPromise::createFirstRejectFunction):
* Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp:
(JSC::promiseAllSlow):
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::promiseAllSettledSlow):
(JSC::promiseAnySlow):
* Source/JavaScriptCore/runtime/JSPromisePrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::promiseProtoFuncFinallySlow):
* Source/JavaScriptCore/runtime/NativeExecutable.cpp:
(JSC::NativeExecutable::create):
(JSC::NativeExecutable::finishCreation):
(JSC::NativeExecutable::nameJSString const):
* Source/JavaScriptCore/runtime/NativeExecutable.h:
* Source/JavaScriptCore/runtime/NumberConstructor.cpp:
(JSC::NumberConstructor::create):
(JSC::NumberConstructor::finishCreation):
* Source/JavaScriptCore/runtime/PinballCompletion.cpp:
(JSC::createHandler):
*
Source/JavaScriptCore/runtime/StringConstructor.cpp:
(JSC::StringConstructor::finishCreation):
(JSC::StringConstructor::create):
*
Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::getHostFunction):
(JSC::VM::getBoundFunction):
(JSC::VM::getRemoteFunction):
(JSC::VM::promiseResolvingFunctionResolveExecutableSlow):
(JSC::VM::promiseResolvingFunctionRejectExecutableSlow):
(JSC::VM::promiseFirstResolvingFunctionResolveExecutableSlow):
(JSC::VM::promiseFirstResolvingFunctionRejectExecutableSlow):
(JSC::VM::promiseResolvingFunctionResolveWithInternalMicrotaskExecutableSlow):
(JSC::VM::promiseResolvingFunctionRejectWithInternalMicrotaskExecutableSlow):
(JSC::VM::promiseCapabilityExecutorExecutableSlow):
(JSC::VM::promiseAllFulfillFunctionExecutableSlow):
(JSC::VM::promiseAllSlowFulfillFunctionExecutableSlow):
(JSC::VM::promiseAllSettledFulfillFunctionExecutableSlow):
(JSC::VM::promiseAllSettledRejectFunctionExecutableSlow):
(JSC::VM::promiseAllSettledSlowFulfillFunctionExecutableSlow):
(JSC::VM::promiseAllSettledSlowRejectFunctionExecutableSlow):
(JSC::VM::promiseAnyRejectFunctionExecutableSlow):
(JSC::VM::promiseAnySlowRejectFunctionExecutableSlow):
*
Source/JavaScriptCore/runtime/VM.h:
* Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp:
(JSC::WebAssemblyFunction::create):
* Source/JavaScriptCore/wasm/js/WebAssemblyFunctionBase.cpp:
(JSC::WebAssemblyFunctionBase::finishCreation): Deleted.
* Source/JavaScriptCore/wasm/js/WebAssemblyFunctionBase.h:
* Source/JavaScriptCore/wasm/js/WebAssemblyPromising.cpp:
(JSC::createWebAssemblyPromisingFunction):
* Source/JavaScriptCore/wasm/js/WebAssemblySuspending.cpp:
(JSC::createWebAssemblySuspendingFunction):
* Source/JavaScriptCore/wasm/js/WebAssemblyWrapperFunction.cpp:
(JSC::WebAssemblyWrapperFunction::create):

Canonical link: 
https://flagged.apple.com:443/proxy?t2=DK5A6m7uC5&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzE0NjgyQG1haW4=&emid=e3cd3b05-d6f6-4680-890e-33ed71b55bdd&c=11



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

Reply via email to