[JSC] NativeExecutable should have name and length in the same way to FunctionExecutable#66580
Conversation
|
EWS run on previous version of this PR (hash 389c725) Details |
|
EWS run on previous version of this PR (hash e685177) Details
|
| @@ -53,13 +53,13 @@ JSCustomSetterFunction::JSCustomSetterFunction(VM& vm, NativeExecutable* executa | |||
| JSCustomSetterFunction* JSCustomSetterFunction::create(VM& vm, JSGlobalObject* globalObject, const PropertyName& propertyName, CustomFunctionPointer setter) | |||
| { | |||
| ASSERT(setter); | |||
| NativeExecutable* executable = vm.getHostFunction(customSetterFunctionCall, ImplementationVisibility::Public, callHostFunctionAsConstructor, String(propertyName.publicName())); | |||
| auto name = makeString("set "_s, propertyName.publicName()); | |||
| NativeExecutable* executable = vm.getHostFunction(customSetterFunctionCall, ImplementationVisibility::Public, callHostFunctionAsConstructor, 1, name); | |||
| Structure* structure = globalObject->customSetterFunctionStructure(); | |||
| JSCustomSetterFunction* function = new (NotNull, allocateCell<JSCustomSetterFunction>(vm)) JSCustomSetterFunction(vm, executable, globalObject, structure, propertyName, setter); | |||
|
|
|||
| // Can't do this during initialization because getHostFunction might do a GC allocation. | |||
There was a problem hiding this comment.
Is this comment relevant?
| @@ -1633,119 +1633,119 @@ JSPropertyNameEnumerator* VM::emptyPropertyNameEnumeratorSlow() | |||
| NativeExecutable* VM::promiseResolvingFunctionResolveExecutableSlow() | |||
| { | |||
| ASSERT(!m_promiseResolvingFunctionResolveExecutable); | |||
| auto* executable = getHostFunction(promiseResolvingFunctionResolve, ImplementationVisibility::Public, callHostFunctionAsConstructor, emptyString()); | |||
| auto* executable = getHostFunction(promiseResolvingFunctionResolve, ImplementationVisibility::Public, callHostFunctionAsConstructor, 0, emptyString()); | |||
There was a problem hiding this comment.
Should this length be 1 instead? Since the previous JSPromise::createResolvingFunctions needs length 1. I think all the followings have similar issues?
|
EWS run on previous version of this PR (hash 518cfa6) Details
|
iOS Safer C++ Build #31293 (e685177)
|
|
EWS run on current version of this PR (hash 612a568) Details
|
… 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://commits.webkit.org/314682@main
612a568 to
a633a8a
Compare
|
Committed 314682@main (a633a8a): https://commits.webkit.org/314682@main Reviewed commits have been landed. Closing PR #66580 and removing active labels. |
🛠 mac-AS-debug
a633a8a
612a568
🛠 mac🛠 win🧪 win-tests🧪 ios-wk2🧪 api-mac🧪 api-wpe🧪 ios-wk2-wpt🧪 api-mac-debug🛠 gtk3-libwebrtc🧪 api-ios🧪 mac-wk1🧪 mac-wk2🧪 gtk-wk2🧪 mac-AS-debug-wk2🧪 api-gtk🧪 mac-wk2-stress🧪 vision-wk2🧪 mac-intel-wk2🧪 mac-site-isolation