[JSC] Add PrivateSymbolMode::{Include,Exclude} for PropertyNameArray
https://bugs.webkit.org/show_bug.cgi?id=176867
Reviewed by Sam Weinig.
JSTests:
- microbenchmarks/object-get-own-property-symbols.js: Added.
(test):
Source/JavaScriptCore:
We rarely require private symbols when enumerating property names.
This patch adds PrivateSymbolMode::{Include,Exclude}. If PrivateSymbolMode::Exclude
is specified, PropertyNameArray does not include private symbols.
This removes many ad-hoc Identifier::isPrivateName()
in enumeration operations.
One additional good thing is that we do not need to filter private symbols out from PropertyNameArray.
It allows us to use Object.keys()'s fast path for Object.getOwnPropertySymbols.
object-get-own-property-symbols 48.6275+-1.0021 38.1846+-1.7934 definitely 1.2735x faster
(JSObjectCopyPropertyNames):
- bindings/ScriptValue.cpp:
(Inspector::jsToInspectorValue):
- bytecode/ObjectAllocationProfile.h:
(JSC::ObjectAllocationProfile::possibleDefaultPropertyCount):
- runtime/EnumerationMode.h:
- runtime/IntlObject.cpp:
(JSC::supportedLocales):
(JSC::Stringifier::Stringifier):
(JSC::Stringifier::Holder::appendNextProperty):
(JSC::Walker::walk):
- runtime/JSPropertyNameEnumerator.cpp:
(JSC::JSPropertyNameEnumerator::create):
- runtime/JSPropertyNameEnumerator.h:
(JSC::propertyNameEnumerator):
- runtime/ObjectConstructor.cpp:
(JSC::objectConstructorGetOwnPropertyDescriptors):
(JSC::objectConstructorAssign):
(JSC::objectConstructorValues):
(JSC::defineProperties):
(JSC::setIntegrityLevel):
(JSC::testIntegrityLevel):
(JSC::ownPropertyKeys):
- runtime/PropertyNameArray.h:
(JSC::PropertyNameArray::PropertyNameArray):
(JSC::PropertyNameArray::propertyNameMode const):
(JSC::PropertyNameArray::privateSymbolMode const):
(JSC::PropertyNameArray::addUncheckedInternal):
(JSC::PropertyNameArray::addUnchecked):
(JSC::PropertyNameArray::add):
(JSC::PropertyNameArray::isUidMatchedToTypeMode):
(JSC::PropertyNameArray::includeSymbolProperties const):
(JSC::PropertyNameArray::includeStringProperties const):
(JSC::PropertyNameArray::mode const): Deleted.
(JSC::ProxyObject::performGetOwnPropertyNames):
Source/WebCore:
- bindings/js/JSDOMConvertRecord.h:
- bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::serialize):
(_NPN_Enumerate):
Source/WebKit:
- WebProcess/Plugins/Netscape/NPJSObject.cpp:
(WebKit::NPJSObject::enumerate):
Source/WebKitLegacy/mac:
- Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::enumerate):