[JSC] Add PrivateSymbolMode::{Include,Exclude} for PropertyNameArray
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2017 11:17:45 +0000 (11:17 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Sep 2017 11:17:45 +0000 (11:17 +0000)
commit47498e29bec278a9cabfb0fb29e939fabebfb01f
tree32b6b9774eb17c841349190cade471bc9089de8b
parent26e0ae54c9b8c528189a7631f9a9d78ce245f2f1
[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

* API/JSObjectRef.cpp:
(JSObjectCopyPropertyNames):
* bindings/ScriptValue.cpp:
(Inspector::jsToInspectorValue):
* bytecode/ObjectAllocationProfile.h:
(JSC::ObjectAllocationProfile::possibleDefaultPropertyCount):
* runtime/EnumerationMode.h:
* runtime/IntlObject.cpp:
(JSC::supportedLocales):
* runtime/JSONObject.cpp:
(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.
* runtime/ProxyObject.cpp:
(JSC::ProxyObject::performGetOwnPropertyNames):

Source/WebCore:

* bindings/js/JSDOMConvertRecord.h:
* bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneSerializer::serialize):
* bridge/NP_jsobject.cpp:
(_NPN_Enumerate):

Source/WebKit:

* WebProcess/Plugins/Netscape/NPJSObject.cpp:
(WebKit::NPJSObject::enumerate):

Source/WebKitLegacy/mac:

* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::enumerate):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222017 268f45cc-cd09-0410-ab3c-d52691b4dbfc
22 files changed:
JSTests/ChangeLog
JSTests/microbenchmarks/object-get-own-property-symbols.js [new file with mode: 0644]
Source/JavaScriptCore/API/JSObjectRef.cpp
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bindings/ScriptValue.cpp
Source/JavaScriptCore/bytecode/ObjectAllocationProfile.h
Source/JavaScriptCore/runtime/EnumerationMode.h
Source/JavaScriptCore/runtime/IntlObject.cpp
Source/JavaScriptCore/runtime/JSONObject.cpp
Source/JavaScriptCore/runtime/JSPropertyNameEnumerator.cpp
Source/JavaScriptCore/runtime/JSPropertyNameEnumerator.h
Source/JavaScriptCore/runtime/ObjectConstructor.cpp
Source/JavaScriptCore/runtime/PropertyNameArray.h
Source/JavaScriptCore/runtime/ProxyObject.cpp
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSDOMConvertRecord.h
Source/WebCore/bindings/js/SerializedScriptValue.cpp
Source/WebCore/bridge/NP_jsobject.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/Plugins/Netscape/NPJSObject.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm