Skip to content

Commit 84cfeb1

Browse files
committed
Optimize the construction of a JSC::Identifier from an ASCIILiteral
https://bugs.webkit.org/show_bug.cgi?id=238552 Reviewed by Geoffrey Garen. Source/JavaScriptCore: There are two ways to construct a JSC::Identifier from a string literal and both were sub-optimal: - template<unsigned charactersCount> static Identifier fromString(VM&, const char (&characters)[charactersCount]): Even though it knows the charactersCount at compile time, it doesn't leverage this information at all. Also, it ends up calling AtomStringImpl::add() instead of AtomStringImpl::addLiteral() which means we lose the knowledge that it was a string literal and the optimization that come with it (e.g. not copying the characters over). In this patch, I am deprecating this function in favor of fromString(ASCIILiteral) which is now more efficient. I'll remove it in a follow up. - static Identifier fromString(VM&, ASCIILiteral): It ended up calling the Identifier(VM&, String) constructor which meant that we were potentially constructing a String/StringImpl unnecessarily before atomizing it since the string may already be in the AtomString table. We also failed to use the smallStrings cache for literals whose length is 1, which would happen when calling `fromString(VM&, const char (&characters)[charactersCount])`. In this patch, I optimized `fromString(VM&, ASCIILiteral)` to leverage the smallStrings cache when necessary and call AtomStringImpl::addLiteral() instead of AtomStringImpl::add(). I also made sure to mark `fromString(VM&, ASCIILiteral)` and `Identifier(VM&, ASCIILiteral)` as ALWAYS_INLINE to make sure the compiler can optimize out the strlen() calls. According to A/B bots, this is a 1-1.5% progression on Speedometer and and a 1.3% progression on JetStream on iMac 20,1 (Intel). Sadly, this is perf-neutral on those two benchmarks on Apple Silicon. * API/JSAPIGlobalObject.mm: (JSC::JSAPIGlobalObject::moduleLoaderCreateImportMetaProperties): * API/JSBase.cpp: (JSGetMemoryUsageStatistics): * API/JSObjectRef.cpp: (JSObjectMakeFunction): * builtins/BuiltinNames.cpp: (JSC::BuiltinNames::BuiltinNames): * builtins/BuiltinUtils.h: * dynbench.cpp: * inspector/JSInjectedScriptHost.cpp: (Inspector::JSInjectedScriptHost::functionDetails): (Inspector::constructInternalProperty): (Inspector::JSInjectedScriptHost::weakMapEntries): (Inspector::JSInjectedScriptHost::weakSetEntries): (Inspector::JSInjectedScriptHost::iteratorEntries): * inspector/JSJavaScriptCallFrame.cpp: (Inspector::valueForScopeLocation): (Inspector::JSJavaScriptCallFrame::scopeDescriptions): * inspector/ScriptCallStackFactory.cpp: (Inspector::extractSourceInformationFromException): * inspector/agents/InspectorAuditAgent.cpp: (Inspector::InspectorAuditAgent::populateAuditObject): * jsc.cpp: (GlobalObject::moduleLoaderCreateImportMetaProperties): (JSC_DEFINE_HOST_FUNCTION): (dumpException): * runtime/AbstractModuleRecord.cpp: (JSC::AbstractModuleRecord::hostResolveImportedModule): * runtime/AtomicsObject.cpp: (JSC::AtomicsObject::finishCreation): * runtime/CommonIdentifiers.cpp: (JSC::CommonIdentifiers::CommonIdentifiers): * runtime/FinalizationRegistryPrototype.cpp: (JSC::FinalizationRegistryPrototype::finishCreation): * runtime/Identifier.cpp: (JSC::Identifier::addLiteral): * runtime/Identifier.h: (JSC::Identifier::Identifier): * runtime/IdentifierInlines.h: (JSC::Identifier::fromString): * runtime/IntlLocale.cpp: (JSC::IntlLocale::textInfo): (JSC::IntlLocale::weekInfo): * runtime/IntlNumberFormat.cpp: (JSC::IntlNumberFormat::initializeNumberFormat): (JSC::IntlNumberFormat::resolvedOptions const): (JSC::IntlNumberFormat::formatToPartsInternal): * runtime/IntlPluralRules.cpp: (JSC::IntlPluralRules::resolvedOptions const): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): (JSC::JSGlobalObject::exposeDollarVM): * runtime/JSModuleLoader.cpp: (JSC::JSModuleLoader::finishCreation): * runtime/MathObject.cpp: (JSC::MathObject::finishCreation): * runtime/NumberConstructor.cpp: (JSC::NumberConstructor::finishCreation): * runtime/StringPrototype.cpp: (JSC::StringPrototype::finishCreation): * runtime/SymbolConstructor.cpp: * tools/JSDollarVM.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): (JSC::JSDollarVM::finishCreation): * wasm/js/JSWebAssemblyGlobal.cpp: (JSC::JSWebAssemblyGlobal::type): * wasm/js/JSWebAssemblyMemory.cpp: (JSC::JSWebAssemblyMemory::type): * wasm/js/JSWebAssemblyTable.cpp: (JSC::JSWebAssemblyTable::type): * wasm/js/WebAssemblyGlobalConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyMemoryConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyModuleConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyTableConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyTagPrototype.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): Source/WebCore: Adopt the JSC::Identifier constructor from an ASCIILiteral more widely. * Modules/applepay-ams-ui/ApplePayAMSUIPaymentHandler.cpp: (WebCore::ApplePayAMSUIPaymentHandler::finishSession): * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: (WebCore::CDMSessionClearKey::update): * Modules/webaudio/AudioWorkletGlobalScope.cpp: (WebCore::AudioWorkletGlobalScope::registerProcessor): * Modules/webaudio/AudioWorkletProcessor.cpp: (WebCore::AudioWorkletProcessor::process): * bindings/js/JSCustomElementRegistryCustom.cpp: (WebCore::JSCustomElementRegistry::define): * bindings/js/JSDOMWindowCustom.cpp: (WebCore::DialogHandler::dialogCreated): (WebCore::DialogHandler::returnValue const): (WebCore::JSDOMWindow::setOpener): (WebCore::JSDOMWindow::setOpenDatabase): * bindings/js/JSEventListener.cpp: (WebCore::JSEventListener::handleEvent): * bindings/js/JSImageDataCustom.cpp: (WebCore::toJSNewlyCreated): * bindings/js/ScriptModuleLoader.cpp: (WebCore::ScriptModuleLoader::createImportMetaProperties): * bindings/scripts/CodeGeneratorJS.pm: (GenerateDictionaryImplementationContent): (addUnscopableProperties): (GenerateImplementation): (GenerateAttributeSetterBodyDefinition): (GenerateDefaultToJSONOperationDefinition): (GenerateCallbackImplementationContent): (GenerateConstructorHelperMethods): * bindings/scripts/test/JS/JSExposedStar.cpp: (WebCore::JSExposedStarPrototype::finishCreation): * bindings/scripts/test/JS/JSExposedToWorkerAndWindow.cpp: (WebCore::convertDictionary<ExposedToWorkerAndWindow::Dict>): (WebCore::convertDictionaryToJS): * bindings/scripts/test/JS/JSTestCEReactions.cpp: (WebCore::setJSTestCEReactions_stringifierAttributeSetter): (WebCore::setJSTestCEReactions_stringifierAttributeNotNeededSetter): * bindings/scripts/test/JS/JSTestCallbackInterface.cpp: (WebCore::convertDictionary<TestCallbackInterface::Dictionary>): (WebCore::JSTestCallbackInterface::callbackWithNoParam): (WebCore::JSTestCallbackInterface::callbackWithArrayParam): (WebCore::JSTestCallbackInterface::callbackWithSerializedScriptValueParam): (WebCore::JSTestCallbackInterface::callbackWithStringList): (WebCore::JSTestCallbackInterface::callbackWithBoolean): (WebCore::JSTestCallbackInterface::callbackRequiresThisToPass): (WebCore::JSTestCallbackInterface::callbackWithAReturnValue): (WebCore::JSTestCallbackInterface::callbackThatRethrowsExceptions): (WebCore::JSTestCallbackInterface::callbackWithThisObject): * bindings/scripts/test/JS/JSTestConditionalIncludes.cpp: (WebCore::JSTestConditionalIncludesDOMConstructor::initializeProperties): (WebCore::JSTestConditionalIncludesPrototype::finishCreation): * bindings/scripts/test/JS/JSTestConditionallyReadWrite.cpp: (WebCore::JSTestConditionallyReadWritePrototype::finishCreation): * bindings/scripts/test/JS/JSTestDefaultToJSON.cpp: (WebCore::JSTestDefaultToJSONPrototype::finishCreation): (WebCore::jsTestDefaultToJSONPrototypeFunction_toJSONBody): * bindings/scripts/test/JS/JSTestDefaultToJSONFilteredByExposed.cpp: (WebCore::JSTestDefaultToJSONFilteredByExposedPrototype::finishCreation): (WebCore::jsTestDefaultToJSONFilteredByExposedPrototypeFunction_toJSONBody): * bindings/scripts/test/JS/JSTestDefaultToJSONInherit.cpp: (WebCore::jsTestDefaultToJSONInheritPrototypeFunction_toJSONBody): * bindings/scripts/test/JS/JSTestDefaultToJSONInheritFinal.cpp: (WebCore::jsTestDefaultToJSONInheritFinalPrototypeFunction_toJSONBody): * bindings/scripts/test/JS/JSTestDerivedDictionary.cpp: (WebCore::convertDictionary<TestDerivedDictionary>): (WebCore::convertDictionaryToJS): * bindings/scripts/test/JS/JSTestDerivedDictionary2.cpp: (WebCore::convertDictionary<TestDerivedDictionary2>): (WebCore::convertDictionaryToJS): (WebCore::convertDictionary<TestDerivedDictionary2::Dictionary>): * bindings/scripts/test/JS/JSTestDictionary.cpp: (WebCore::convertDictionary<TestDictionary>): * bindings/scripts/test/JS/JSTestDictionaryWithOnlyConditionalMembers.cpp: (WebCore::convertDictionary<TestDictionaryWithOnlyConditionalMembers>): (WebCore::convertDictionaryToJS): * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: (WebCore::JSTestEnabledBySettingDOMConstructor::initializeProperties): (WebCore::JSTestEnabledBySettingPrototype::finishCreation): * bindings/scripts/test/JS/JSTestEventConstructor.cpp: (WebCore::convertDictionary<TestEventConstructor::Init>): * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: (WebCore::JSTestGenerateIsReachablePrototype::finishCreation): * bindings/scripts/test/JS/JSTestInheritedDictionary.cpp: (WebCore::convertDictionary<TestInheritedDictionary>): (WebCore::convertDictionaryToJS): * bindings/scripts/test/JS/JSTestInheritedDictionary2.cpp: (WebCore::convertDictionary<TestInheritedDictionary2>): (WebCore::convertDictionaryToJS): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::JSTestInterfacePrototype::finishCreation): * bindings/scripts/test/JS/JSTestNamespaceObject.cpp: (WebCore::JSTestNamespaceObjectDOMConstructor::initializeProperties): * bindings/scripts/test/JS/JSTestNode.cpp: (WebCore::JSTestNodePrototype::finishCreation): (WebCore::jsTestNodePrototypeFunction_toJSONBody): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::convertDictionary<TestObj::Dictionary>): (WebCore::convertDictionaryToJS): (WebCore::convertDictionary<TestObj::DictionaryThatShouldNotTolerateNull>): (WebCore::convertDictionary<TestObj::DictionaryThatShouldTolerateNull>): (WebCore::convertDictionary<AlternateDictionaryName>): (WebCore::convertDictionary<TestObj::ParentDictionary>): (WebCore::convertDictionary<TestObj::ChildDictionary>): (WebCore::convertDictionary<TestObj::ConditionalDictionaryA>): (WebCore::convertDictionary<TestObj::ConditionalDictionaryB>): (WebCore::convertDictionary<TestObj::ConditionalDictionaryC>): (WebCore::JSTestObjDOMConstructor::initializeProperties): (WebCore::JSTestObjPrototype::finishCreation): (WebCore::setJSTestObj_putForwardsAttributeSetter): (WebCore::setJSTestObj_putForwardsNullableAttributeSetter): * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: (WebCore::convertDictionary<TestPromiseRejectionEvent::Init>): * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: (WebCore::convertDictionary<DictionaryImplName>): (WebCore::convertDictionaryToJS): * html/HTMLMediaElement.cpp: (WebCore::controllerJSValue): (WebCore::HTMLMediaElement::updateCaptionContainer): (WebCore::HTMLMediaElement::ensureMediaControlsInjectedScript): (WebCore::HTMLMediaElement::didAddUserAgentShadowRoot): (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange): (WebCore::HTMLMediaElement::getCurrentMediaControlsStatus): Canonical link: https://commits.webkit.org/249031@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@292118 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 958199d commit 84cfeb1

74 files changed

Lines changed: 885 additions & 629 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Source/JavaScriptCore/API/JSAPIGlobalObject.mm‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@
235235
JSObject* metaProperties = constructEmptyObject(vm, globalObject->nullPrototypeObjectStructure());
236236
RETURN_IF_EXCEPTION(scope, nullptr);
237237

238-
metaProperties->putDirect(vm, Identifier::fromString(vm, "filename"), key);
238+
metaProperties->putDirect(vm, Identifier::fromString(vm, "filename"_s), key);
239239
RETURN_IF_EXCEPTION(scope, nullptr);
240240

241241
return metaProperties;

‎Source/JavaScriptCore/API/JSBase.cpp‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,14 +210,14 @@ JSObjectRef JSGetMemoryUsageStatistics(JSContextRef ctx)
210210
objectTypeCounts->putDirect(vm, Identifier::fromString(vm, it.key), jsNumber(it.value));
211211

212212
JSObject* object = constructEmptyObject(globalObject);
213-
object->putDirect(vm, Identifier::fromString(vm, "heapSize"), jsNumber(vm.heap.size()));
214-
object->putDirect(vm, Identifier::fromString(vm, "heapCapacity"), jsNumber(vm.heap.capacity()));
215-
object->putDirect(vm, Identifier::fromString(vm, "extraMemorySize"), jsNumber(vm.heap.extraMemorySize()));
216-
object->putDirect(vm, Identifier::fromString(vm, "objectCount"), jsNumber(vm.heap.objectCount()));
217-
object->putDirect(vm, Identifier::fromString(vm, "protectedObjectCount"), jsNumber(vm.heap.protectedObjectCount()));
218-
object->putDirect(vm, Identifier::fromString(vm, "globalObjectCount"), jsNumber(vm.heap.globalObjectCount()));
219-
object->putDirect(vm, Identifier::fromString(vm, "protectedGlobalObjectCount"), jsNumber(vm.heap.protectedGlobalObjectCount()));
220-
object->putDirect(vm, Identifier::fromString(vm, "objectTypeCounts"), objectTypeCounts);
213+
object->putDirect(vm, Identifier::fromString(vm, "heapSize"_s), jsNumber(vm.heap.size()));
214+
object->putDirect(vm, Identifier::fromString(vm, "heapCapacity"_s), jsNumber(vm.heap.capacity()));
215+
object->putDirect(vm, Identifier::fromString(vm, "extraMemorySize"_s), jsNumber(vm.heap.extraMemorySize()));
216+
object->putDirect(vm, Identifier::fromString(vm, "objectCount"_s), jsNumber(vm.heap.objectCount()));
217+
object->putDirect(vm, Identifier::fromString(vm, "protectedObjectCount"_s), jsNumber(vm.heap.protectedObjectCount()));
218+
object->putDirect(vm, Identifier::fromString(vm, "globalObjectCount"_s), jsNumber(vm.heap.globalObjectCount()));
219+
object->putDirect(vm, Identifier::fromString(vm, "protectedGlobalObjectCount"_s), jsNumber(vm.heap.protectedGlobalObjectCount()));
220+
object->putDirect(vm, Identifier::fromString(vm, "objectTypeCounts"_s), objectTypeCounts);
221221

222222
return toRef(object);
223223
}

‎Source/JavaScriptCore/API/JSObjectRef.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ JSObjectRef JSObjectMakeFunction(JSContextRef ctx, JSStringRef name, unsigned pa
138138
auto scope = DECLARE_CATCH_SCOPE(vm);
139139

140140
startingLineNumber = std::max(1, startingLineNumber);
141-
Identifier nameID = name ? name->identifier(&vm) : Identifier::fromString(vm, "anonymous");
141+
Identifier nameID = name ? name->identifier(&vm) : Identifier::fromString(vm, "anonymous"_s);
142142

143143
MarkedArgumentBuffer args;
144144
for (unsigned i = 0; i < parameterCount; i++)

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,115 @@
1+
2022-03-30 Chris Dumez <cdumez@apple.com>
2+
3+
Optimize the construction of a JSC::Identifier from an ASCIILiteral
4+
https://bugs.webkit.org/show_bug.cgi?id=238552
5+
6+
Reviewed by Geoffrey Garen.
7+
8+
There are two ways to construct a JSC::Identifier from a string literal and both
9+
were sub-optimal:
10+
- template<unsigned charactersCount> static Identifier fromString(VM&, const char (&characters)[charactersCount]):
11+
Even though it knows the charactersCount at compile time, it doesn't leverage this information
12+
at all. Also, it ends up calling AtomStringImpl::add() instead of AtomStringImpl::addLiteral()
13+
which means we lose the knowledge that it was a string literal and the optimization that come
14+
with it (e.g. not copying the characters over). In this patch, I am deprecating this function
15+
in favor of fromString(ASCIILiteral) which is now more efficient. I'll remove it in a follow up.
16+
- static Identifier fromString(VM&, ASCIILiteral):
17+
It ended up calling the Identifier(VM&, String) constructor which meant that we were potentially constructing
18+
a String/StringImpl unnecessarily before atomizing it since the string may already be in the
19+
AtomString table. We also failed to use the smallStrings cache for literals whose length is 1,
20+
which would happen when calling `fromString(VM&, const char (&characters)[charactersCount])`.
21+
22+
In this patch, I optimized `fromString(VM&, ASCIILiteral)` to leverage the smallStrings cache
23+
when necessary and call AtomStringImpl::addLiteral() instead of AtomStringImpl::add(). I also
24+
made sure to mark `fromString(VM&, ASCIILiteral)` and `Identifier(VM&, ASCIILiteral)` as
25+
ALWAYS_INLINE to make sure the compiler can optimize out the strlen() calls.
26+
27+
According to A/B bots, this is a 1-1.5% progression on Speedometer and and a 1.3% progression on
28+
JetStream on iMac 20,1 (Intel). Sadly, this is perf-neutral on those two benchmarks on Apple
29+
Silicon.
30+
31+
* API/JSAPIGlobalObject.mm:
32+
(JSC::JSAPIGlobalObject::moduleLoaderCreateImportMetaProperties):
33+
* API/JSBase.cpp:
34+
(JSGetMemoryUsageStatistics):
35+
* API/JSObjectRef.cpp:
36+
(JSObjectMakeFunction):
37+
* builtins/BuiltinNames.cpp:
38+
(JSC::BuiltinNames::BuiltinNames):
39+
* builtins/BuiltinUtils.h:
40+
* dynbench.cpp:
41+
* inspector/JSInjectedScriptHost.cpp:
42+
(Inspector::JSInjectedScriptHost::functionDetails):
43+
(Inspector::constructInternalProperty):
44+
(Inspector::JSInjectedScriptHost::weakMapEntries):
45+
(Inspector::JSInjectedScriptHost::weakSetEntries):
46+
(Inspector::JSInjectedScriptHost::iteratorEntries):
47+
* inspector/JSJavaScriptCallFrame.cpp:
48+
(Inspector::valueForScopeLocation):
49+
(Inspector::JSJavaScriptCallFrame::scopeDescriptions):
50+
* inspector/ScriptCallStackFactory.cpp:
51+
(Inspector::extractSourceInformationFromException):
52+
* inspector/agents/InspectorAuditAgent.cpp:
53+
(Inspector::InspectorAuditAgent::populateAuditObject):
54+
* jsc.cpp:
55+
(GlobalObject::moduleLoaderCreateImportMetaProperties):
56+
(JSC_DEFINE_HOST_FUNCTION):
57+
(dumpException):
58+
* runtime/AbstractModuleRecord.cpp:
59+
(JSC::AbstractModuleRecord::hostResolveImportedModule):
60+
* runtime/AtomicsObject.cpp:
61+
(JSC::AtomicsObject::finishCreation):
62+
* runtime/CommonIdentifiers.cpp:
63+
(JSC::CommonIdentifiers::CommonIdentifiers):
64+
* runtime/FinalizationRegistryPrototype.cpp:
65+
(JSC::FinalizationRegistryPrototype::finishCreation):
66+
* runtime/Identifier.cpp:
67+
(JSC::Identifier::addLiteral):
68+
* runtime/Identifier.h:
69+
(JSC::Identifier::Identifier):
70+
* runtime/IdentifierInlines.h:
71+
(JSC::Identifier::fromString):
72+
* runtime/IntlLocale.cpp:
73+
(JSC::IntlLocale::textInfo):
74+
(JSC::IntlLocale::weekInfo):
75+
* runtime/IntlNumberFormat.cpp:
76+
(JSC::IntlNumberFormat::initializeNumberFormat):
77+
(JSC::IntlNumberFormat::resolvedOptions const):
78+
(JSC::IntlNumberFormat::formatToPartsInternal):
79+
* runtime/IntlPluralRules.cpp:
80+
(JSC::IntlPluralRules::resolvedOptions const):
81+
* runtime/JSGlobalObject.cpp:
82+
(JSC::JSGlobalObject::init):
83+
(JSC::JSGlobalObject::exposeDollarVM):
84+
* runtime/JSModuleLoader.cpp:
85+
(JSC::JSModuleLoader::finishCreation):
86+
* runtime/MathObject.cpp:
87+
(JSC::MathObject::finishCreation):
88+
* runtime/NumberConstructor.cpp:
89+
(JSC::NumberConstructor::finishCreation):
90+
* runtime/StringPrototype.cpp:
91+
(JSC::StringPrototype::finishCreation):
92+
* runtime/SymbolConstructor.cpp:
93+
* tools/JSDollarVM.cpp:
94+
(JSC::JSC_DEFINE_HOST_FUNCTION):
95+
(JSC::JSDollarVM::finishCreation):
96+
* wasm/js/JSWebAssemblyGlobal.cpp:
97+
(JSC::JSWebAssemblyGlobal::type):
98+
* wasm/js/JSWebAssemblyMemory.cpp:
99+
(JSC::JSWebAssemblyMemory::type):
100+
* wasm/js/JSWebAssemblyTable.cpp:
101+
(JSC::JSWebAssemblyTable::type):
102+
* wasm/js/WebAssemblyGlobalConstructor.cpp:
103+
(JSC::JSC_DEFINE_HOST_FUNCTION):
104+
* wasm/js/WebAssemblyMemoryConstructor.cpp:
105+
(JSC::JSC_DEFINE_HOST_FUNCTION):
106+
* wasm/js/WebAssemblyModuleConstructor.cpp:
107+
(JSC::JSC_DEFINE_HOST_FUNCTION):
108+
* wasm/js/WebAssemblyTableConstructor.cpp:
109+
(JSC::JSC_DEFINE_HOST_FUNCTION):
110+
* wasm/js/WebAssemblyTagPrototype.cpp:
111+
(JSC::JSC_DEFINE_HOST_FUNCTION):
112+
1113
2022-03-30 Mark Lam <mark.lam@apple.com>
2114

3115
Remove obsolete --useProbeOSRExit option.

‎Source/JavaScriptCore/builtins/BuiltinNames.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ SymbolImpl::StaticSymbolImpl polyProtoPrivateName { "PolyProto", SymbolImpl::s_f
5353

5454
} // namespace Symbols
5555

56-
#define INITIALIZE_BUILTIN_NAMES_IN_JSC(name) , m_##name(JSC::Identifier::fromString(vm, #name))
56+
#define INITIALIZE_BUILTIN_NAMES_IN_JSC(name) , m_##name(JSC::Identifier::fromString(vm, #name ""_s))
5757
#define INITIALIZE_BUILTIN_SYMBOLS_IN_JSC(name) \
5858
, m_##name##Symbol(JSC::Identifier::fromUid(vm, &static_cast<SymbolImpl&>(JSC::Symbols::name##Symbol))) \
59-
, m_##name##SymbolPrivateIdentifier(JSC::Identifier::fromString(vm, #name))
59+
, m_##name##SymbolPrivateIdentifier(JSC::Identifier::fromString(vm, #name ""_s))
6060

6161
#define INITIALIZE_PUBLIC_TO_PRIVATE_ENTRY(name) \
6262
do { \
@@ -79,7 +79,7 @@ BuiltinNames::BuiltinNames(VM& vm, CommonIdentifiers* commonIdentifiers)
7979
JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_PROPERTY_NAME(INITIALIZE_BUILTIN_NAMES_IN_JSC)
8080
JSC_COMMON_PRIVATE_IDENTIFIERS_EACH_WELL_KNOWN_SYMBOL(INITIALIZE_BUILTIN_SYMBOLS_IN_JSC)
8181
, m_intlLegacyConstructedSymbol(JSC::Identifier::fromUid(vm, &static_cast<SymbolImpl&>(Symbols::intlLegacyConstructedSymbol)))
82-
, m_dollarVMName(Identifier::fromString(vm, "$vm"))
82+
, m_dollarVMName(Identifier::fromString(vm, "$vm"_s))
8383
, m_dollarVMPrivateName(Identifier::fromUid(vm, &static_cast<SymbolImpl&>(Symbols::dollarVMPrivateName)))
8484
, m_polyProtoPrivateName(Identifier::fromUid(vm, &static_cast<SymbolImpl&>(Symbols::polyProtoPrivateName)))
8585
{

‎Source/JavaScriptCore/builtins/BuiltinUtils.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
namespace JSC {
3333

34-
#define INITIALIZE_BUILTIN_NAMES(name) , m_##name(JSC::Identifier::fromString(vm, #name)), m_##name##PrivateName(JSC::Identifier::fromUid(JSC::PrivateName(JSC::PrivateName::PrivateSymbol, #name ""_s)))
34+
#define INITIALIZE_BUILTIN_NAMES(name) , m_##name(JSC::Identifier::fromString(vm, #name ""_s)), m_##name##PrivateName(JSC::Identifier::fromUid(JSC::PrivateName(JSC::PrivateName::PrivateSymbol, #name ""_s)))
3535
#define DECLARE_BUILTIN_NAMES(name) const JSC::Identifier m_##name; const JSC::Identifier m_##name##PrivateName;
3636
#define DECLARE_BUILTIN_IDENTIFIER_ACCESSOR(name) \
3737
const JSC::Identifier& name##PublicName() const { return m_##name; } \

‎Source/JavaScriptCore/dynbench.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ int main(int argc, char** argv) WTF_IGNORES_THREAD_SAFETY_ANALYSIS
9898
JSGlobalObject* globalObject =
9999
JSGlobalObject::create(vm, JSGlobalObject::createStructure(vm, jsNull()));
100100

101-
Identifier identF = Identifier::fromString(vm, "f");
102-
Identifier identG = Identifier::fromString(vm, "g");
101+
Identifier identF = Identifier::fromString(vm, "f"_s);
102+
Identifier identG = Identifier::fromString(vm, "g"_s);
103103

104104
Structure* objectStructure =
105105
JSFinalObject::createStructure(vm, globalObject, globalObject->objectPrototype(), 2);

‎Source/JavaScriptCore/inspector/JSInjectedScriptHost.cpp‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -266,20 +266,20 @@ JSValue JSInjectedScriptHost::functionDetails(JSGlobalObject* globalObject, Call
266266

267267
String scriptID = String::number(sourceCode->provider()->asID());
268268
JSObject* location = constructEmptyObject(globalObject);
269-
location->putDirect(vm, Identifier::fromString(vm, "scriptId"), jsString(vm, scriptID));
270-
location->putDirect(vm, Identifier::fromString(vm, "lineNumber"), jsNumber(lineNumber));
271-
location->putDirect(vm, Identifier::fromString(vm, "columnNumber"), jsNumber(columnNumber));
269+
location->putDirect(vm, Identifier::fromString(vm, "scriptId"_s), jsString(vm, scriptID));
270+
location->putDirect(vm, Identifier::fromString(vm, "lineNumber"_s), jsNumber(lineNumber));
271+
location->putDirect(vm, Identifier::fromString(vm, "columnNumber"_s), jsNumber(columnNumber));
272272

273273
JSObject* result = constructEmptyObject(globalObject);
274-
result->putDirect(vm, Identifier::fromString(vm, "location"), location);
274+
result->putDirect(vm, Identifier::fromString(vm, "location"_s), location);
275275

276276
String name = function->name(vm);
277277
if (!name.isEmpty())
278-
result->putDirect(vm, Identifier::fromString(vm, "name"), jsString(vm, name));
278+
result->putDirect(vm, Identifier::fromString(vm, "name"_s), jsString(vm, name));
279279

280280
String displayName = function->displayName(vm);
281281
if (!displayName.isEmpty())
282-
result->putDirect(vm, Identifier::fromString(vm, "displayName"), jsString(vm, displayName));
282+
result->putDirect(vm, Identifier::fromString(vm, "displayName"_s), jsString(vm, displayName));
283283

284284
return result;
285285
}
@@ -288,8 +288,8 @@ static JSObject* constructInternalProperty(JSGlobalObject* globalObject, const S
288288
{
289289
VM& vm = globalObject->vm();
290290
JSObject* result = constructEmptyObject(globalObject);
291-
result->putDirect(vm, Identifier::fromString(vm, "name"), jsString(vm, name));
292-
result->putDirect(vm, Identifier::fromString(vm, "value"), value);
291+
result->putDirect(vm, Identifier::fromString(vm, "name"_s), jsString(vm, name));
292+
result->putDirect(vm, Identifier::fromString(vm, "value"_s), value);
293293
return result;
294294
}
295295

@@ -488,8 +488,8 @@ JSValue JSInjectedScriptHost::weakMapEntries(JSGlobalObject* globalObject, CallF
488488

489489
for (unsigned index = 0; index < buffer.size(); index += 2) {
490490
JSObject* entry = constructEmptyObject(globalObject);
491-
entry->putDirect(vm, Identifier::fromString(vm, "key"), buffer.at(index));
492-
entry->putDirect(vm, Identifier::fromString(vm, "value"), buffer.at(index + 1));
491+
entry->putDirect(vm, Identifier::fromString(vm, "key"_s), buffer.at(index));
492+
entry->putDirect(vm, Identifier::fromString(vm, "value"_s), buffer.at(index + 1));
493493
array->putDirectIndex(globalObject, index / 2, entry);
494494
RETURN_IF_EXCEPTION(scope, JSValue());
495495
}
@@ -532,7 +532,7 @@ JSValue JSInjectedScriptHost::weakSetEntries(JSGlobalObject* globalObject, CallF
532532

533533
for (unsigned index = 0; index < buffer.size(); ++index) {
534534
JSObject* entry = constructEmptyObject(globalObject);
535-
entry->putDirect(vm, Identifier::fromString(vm, "value"), buffer.at(index));
535+
entry->putDirect(vm, Identifier::fromString(vm, "value"_s), buffer.at(index));
536536
array->putDirectIndex(globalObject, index, entry);
537537
RETURN_IF_EXCEPTION(scope, JSValue());
538538
}
@@ -618,7 +618,7 @@ JSValue JSInjectedScriptHost::iteratorEntries(JSGlobalObject* globalObject, Call
618618
RETURN_IF_EXCEPTION(scope, { });
619619

620620
JSObject* entry = constructEmptyObject(globalObject);
621-
entry->putDirect(vm, Identifier::fromString(vm, "value"), nextValue);
621+
entry->putDirect(vm, Identifier::fromString(vm, "value"_s), nextValue);
622622
array->putDirectIndex(globalObject, i, entry);
623623
if (UNLIKELY(scope.exception())) {
624624
scope.release();

‎Source/JavaScriptCore/inspector/JSJavaScriptCallFrame.cpp‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ static JSValue valueForScopeLocation(JSGlobalObject* globalObject, const Debugge
119119
// Debugger.Location protocol object.
120120
VM& vm = globalObject->vm();
121121
JSObject* result = constructEmptyObject(globalObject);
122-
result->putDirect(vm, Identifier::fromString(vm, "scriptId"), jsString(vm, String::number(location.sourceID)));
123-
result->putDirect(vm, Identifier::fromString(vm, "lineNumber"), jsNumber(location.line));
124-
result->putDirect(vm, Identifier::fromString(vm, "columnNumber"), jsNumber(location.column));
122+
result->putDirect(vm, Identifier::fromString(vm, "scriptId"_s), jsString(vm, String::number(location.sourceID)));
123+
result->putDirect(vm, Identifier::fromString(vm, "lineNumber"_s), jsNumber(location.line));
124+
result->putDirect(vm, Identifier::fromString(vm, "columnNumber"_s), jsNumber(location.column));
125125
return result;
126126
}
127127

@@ -141,9 +141,9 @@ JSValue JSJavaScriptCallFrame::scopeDescriptions(JSGlobalObject* globalObject)
141141
for (DebuggerScope::iterator iter = scopeChain->begin(); iter != end; ++iter) {
142142
DebuggerScope* scope = iter.get();
143143
JSObject* description = constructEmptyObject(globalObject);
144-
description->putDirect(vm, Identifier::fromString(vm, "type"), valueForScopeType(scope));
145-
description->putDirect(vm, Identifier::fromString(vm, "name"), jsString(vm, scope->name()));
146-
description->putDirect(vm, Identifier::fromString(vm, "location"), valueForScopeLocation(globalObject, scope->location()));
144+
description->putDirect(vm, Identifier::fromString(vm, "type"_s), valueForScopeType(scope));
145+
description->putDirect(vm, Identifier::fromString(vm, "name"_s), jsString(vm, scope->name()));
146+
description->putDirect(vm, Identifier::fromString(vm, "location"_s), valueForScopeLocation(globalObject, scope->location()));
147147
array->putDirectIndex(globalObject, index++, description);
148148
RETURN_IF_EXCEPTION(throwScope, JSValue());
149149
}

‎Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ static bool extractSourceInformationFromException(JSC::JSGlobalObject* globalObj
124124
auto scope = DECLARE_CATCH_SCOPE(vm);
125125

126126
// FIXME: <http://webkit.org/b/115087> Web Inspector: Should not need to evaluate JavaScript handling exceptions
127-
JSValue lineValue = exceptionObject->getDirect(vm, Identifier::fromString(vm, "line"));
128-
JSValue columnValue = exceptionObject->getDirect(vm, Identifier::fromString(vm, "column"));
129-
JSValue sourceURLValue = exceptionObject->getDirect(vm, Identifier::fromString(vm, "sourceURL"));
127+
JSValue lineValue = exceptionObject->getDirect(vm, Identifier::fromString(vm, "line"_s));
128+
JSValue columnValue = exceptionObject->getDirect(vm, Identifier::fromString(vm, "column"_s));
129+
JSValue sourceURLValue = exceptionObject->getDirect(vm, Identifier::fromString(vm, "sourceURL"_s));
130130

131131
bool result = false;
132132
if (lineValue && lineValue.isNumber()

0 commit comments

Comments
 (0)