<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[184120] trunk/Source/JavaScriptCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/184120">184120</a></dd>
<dt>Author</dt> <dd>akling@apple.com</dd>
<dt>Date</dt> <dd>2015-05-11 14:13:53 -0700 (Mon, 11 May 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>PropertyNameArray should use a Vector when there are few entries.
<https://webkit.org/b/144874>
Reviewed by Geoffrey Garen.
Bring back an optimization that was lost in the for-in refactoring.
PropertyNameArray now holds a Vector<AtomicStringImpl*> until there are
enough (20) entries to justify converting to a HashSet for contains().
Also inlined the code while we're here, since it has so few clients and
the call overhead adds up.
~5% progression on Kraken/json-stringify-tinderbox.
* runtime/PropertyNameArray.cpp: Removed.
* runtime/PropertyNameArray.h:
(JSC::PropertyNameArray::canAddKnownUniqueForStructure):
(JSC::PropertyNameArray::add):
(JSC::PropertyNameArray::addKnownUnique):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreCMakeListstxt">trunk/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxproj">trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxprojfilters">trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimePropertyNameArrayh">trunk/Source/JavaScriptCore/runtime/PropertyNameArray.h</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreruntimePropertyNameArraycpp">trunk/Source/JavaScriptCore/runtime/PropertyNameArray.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/CMakeLists.txt (184119 => 184120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/CMakeLists.txt        2015-05-11 20:42:39 UTC (rev 184119)
+++ trunk/Source/JavaScriptCore/CMakeLists.txt        2015-05-11 21:13:53 UTC (rev 184120)
</span><span class="lines">@@ -539,7 +539,6 @@
</span><span class="cx"> runtime/Operations.cpp
</span><span class="cx"> runtime/Options.cpp
</span><span class="cx"> runtime/PropertyDescriptor.cpp
</span><del>- runtime/PropertyNameArray.cpp
</del><span class="cx"> runtime/PropertySlot.cpp
</span><span class="cx"> runtime/PropertyTable.cpp
</span><span class="cx"> runtime/PrototypeMap.cpp
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (184119 => 184120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-05-11 20:42:39 UTC (rev 184119)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-05-11 21:13:53 UTC (rev 184120)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2015-05-11 Andreas Kling <akling@apple.com>
+
+ PropertyNameArray should use a Vector when there are few entries.
+ <https://webkit.org/b/144874>
+
+ Reviewed by Geoffrey Garen.
+
+ Bring back an optimization that was lost in the for-in refactoring.
+ PropertyNameArray now holds a Vector<AtomicStringImpl*> until there are
+ enough (20) entries to justify converting to a HashSet for contains().
+
+ Also inlined the code while we're here, since it has so few clients and
+ the call overhead adds up.
+
+ ~5% progression on Kraken/json-stringify-tinderbox.
+
+ * runtime/PropertyNameArray.cpp: Removed.
+ * runtime/PropertyNameArray.h:
+ (JSC::PropertyNameArray::canAddKnownUniqueForStructure):
+ (JSC::PropertyNameArray::add):
+ (JSC::PropertyNameArray::addKnownUnique):
+
</ins><span class="cx"> 2015-05-11 Matt Baker <mattbaker@apple.com>
</span><span class="cx">
</span><span class="cx"> Web Inspector: REGRESSION (r175203): No profile information is shown in Inspector
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj (184119 => 184120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj        2015-05-11 20:42:39 UTC (rev 184119)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj        2015-05-11 21:13:53 UTC (rev 184120)
</span><span class="lines">@@ -799,7 +799,6 @@
</span><span class="cx"> <ClCompile Include="..\runtime\Operations.cpp" />
</span><span class="cx"> <ClCompile Include="..\runtime\Options.cpp" />
</span><span class="cx"> <ClCompile Include="..\runtime\PropertyDescriptor.cpp" />
</span><del>- <ClCompile Include="..\runtime\PropertyNameArray.cpp" />
</del><span class="cx"> <ClCompile Include="..\runtime\PropertySlot.cpp" />
</span><span class="cx"> <ClCompile Include="..\runtime\PropertyTable.cpp" />
</span><span class="cx"> <ClCompile Include="..\runtime\PrototypeMap.cpp" />
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorevcxprojJavaScriptCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters (184119 => 184120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters        2015-05-11 20:42:39 UTC (rev 184119)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters        2015-05-11 21:13:53 UTC (rev 184120)
</span><span class="lines">@@ -780,9 +780,6 @@
</span><span class="cx"> <ClCompile Include="..\runtime\PropertyDescriptor.cpp">
</span><span class="cx"> <Filter>runtime</Filter>
</span><span class="cx"> </ClCompile>
</span><del>- <ClCompile Include="..\runtime\PropertyNameArray.cpp">
- <Filter>runtime</Filter>
- </ClCompile>
</del><span class="cx"> <ClCompile Include="..\runtime\PropertySlot.cpp">
</span><span class="cx"> <Filter>runtime</Filter>
</span><span class="cx"> </ClCompile>
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (184119 => 184120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2015-05-11 20:42:39 UTC (rev 184119)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2015-05-11 21:13:53 UTC (rev 184120)
</span><span class="lines">@@ -819,7 +819,6 @@
</span><span class="cx">                 14469DE4107EC7E700650446 /* NumberPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2680C40E16D4E900A06E92 /* NumberPrototype.cpp */; };
</span><span class="cx">                 14469DE5107EC7E700650446 /* ObjectConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2680C60E16D4E900A06E92 /* ObjectConstructor.cpp */; };
</span><span class="cx">                 14469DE6107EC7E700650446 /* ObjectPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC2680C80E16D4E900A06E92 /* ObjectPrototype.cpp */; };
</span><del>-                14469DE7107EC7E700650446 /* PropertyNameArray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65400C0F0A69BAF200509887 /* PropertyNameArray.cpp */; };
</del><span class="cx">                 14469DE8107EC7E700650446 /* PropertySlot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65621E6B089E859700760F35 /* PropertySlot.cpp */; };
</span><span class="cx">                 14469DEB107EC7E700650446 /* StringConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC18C3C00E16EE3300B34460 /* StringConstructor.cpp */; };
</span><span class="cx">                 14469DEC107EC7E700650446 /* StringObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC18C3C20E16EE3300B34460 /* StringObject.cpp */; };
</span><span class="lines">@@ -2678,7 +2677,6 @@
</span><span class="cx">                 652A3A221651C69700A80AFE /* A64DOpcode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = A64DOpcode.cpp; path = disassembler/ARM64/A64DOpcode.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 652A3A231651C69700A80AFE /* A64DOpcode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = A64DOpcode.h; path = disassembler/ARM64/A64DOpcode.h; sourceTree = "<group>"; };
</span><span class="cx">                 65303D631447B9E100D3F904 /* ParserTokens.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParserTokens.h; sourceTree = "<group>"; };
</span><del>-                65400C0F0A69BAF200509887 /* PropertyNameArray.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PropertyNameArray.cpp; sourceTree = "<group>"; };
</del><span class="cx">                 65400C100A69BAF200509887 /* PropertyNameArray.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = PropertyNameArray.h; sourceTree = "<group>"; };
</span><span class="cx">                 6546F51F1A32A59C006F07D5 /* NullGetterFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; path = NullGetterFunction.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
</span><span class="cx">                 6546F5201A32A59C006F07D5 /* NullGetterFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NullGetterFunction.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -4637,7 +4635,6 @@
</span><span class="cx">                                 A7FB604B103F5EAB0017A286 /* PropertyDescriptor.h */,
</span><span class="cx">                                 BC95437C0EBA70FD0072B6D3 /* PropertyMapHashTable.h */,
</span><span class="cx">                                 86158AB2155C8B3F00B45C9C /* PropertyName.h */,
</span><del>-                                65400C0F0A69BAF200509887 /* PropertyNameArray.cpp */,
</del><span class="cx">                                 65400C100A69BAF200509887 /* PropertyNameArray.h */,
</span><span class="cx">                                 0FF7168A15A3B231008F5DAA /* PropertyOffset.h */,
</span><span class="cx">                                 65621E6B089E859700760F35 /* PropertySlot.cpp */,
</span><span class="lines">@@ -7486,7 +7483,6 @@
</span><span class="cx">                                 0FB1058D1675483700F8AB6E /* ProfilerOSRExitSite.cpp in Sources */,
</span><span class="cx">                                 0F13912B16771C3A009CCB07 /* ProfilerProfiledBytecodes.cpp in Sources */,
</span><span class="cx">                                 A7FB60A4103F7DC20017A286 /* PropertyDescriptor.cpp in Sources */,
</span><del>-                                14469DE7107EC7E700650446 /* PropertyNameArray.cpp in Sources */,
</del><span class="cx">                                 14469DE8107EC7E700650446 /* PropertySlot.cpp in Sources */,
</span><span class="cx">                                 ADE39FFF16DD144B0003CD4A /* PropertyTable.cpp in Sources */,
</span><span class="cx">                                 65FB5117184EEE7000C12B70 /* ProtoCallFrame.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimePropertyNameArraycpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/JavaScriptCore/runtime/PropertyNameArray.cpp (184119 => 184120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/PropertyNameArray.cpp        2015-05-11 20:42:39 UTC (rev 184119)
+++ trunk/Source/JavaScriptCore/runtime/PropertyNameArray.cpp        2015-05-11 21:13:53 UTC (rev 184120)
</span><span class="lines">@@ -1,42 +0,0 @@
</span><del>-/*
- * Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#include "config.h"
-#include "PropertyNameArray.h"
-
-#include "JSCInlines.h"
-#include "JSObject.h"
-#include "JSPropertyNameEnumerator.h"
-#include "Structure.h"
-#include "StructureChain.h"
-
-namespace JSC {
-
-void PropertyNameArray::add(AtomicStringImpl* identifier)
-{
- ASSERT(identifier);
-
- if (!m_set.add(identifier).isNewEntry)
- return;
-
- addKnownUnique(identifier);
-}
-
-} // namespace JSC
</del></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimePropertyNameArrayh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/PropertyNameArray.h (184119 => 184120)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/PropertyNameArray.h        2015-05-11 20:42:39 UTC (rev 184119)
+++ trunk/Source/JavaScriptCore/runtime/PropertyNameArray.h        2015-05-11 21:13:53 UTC (rev 184120)
</span><span class="lines">@@ -70,13 +70,9 @@
</span><span class="cx"> add(Identifier::from(m_vm, index));
</span><span class="cx"> }
</span><span class="cx">
</span><del>- void add(const Identifier& identifier) { add(identifier.impl()); }
- JS_EXPORT_PRIVATE void add(AtomicStringImpl*);
- void addKnownUnique(AtomicStringImpl* identifier)
- {
- m_set.add(identifier);
- m_data->propertyNameVector().append(Identifier::fromUid(m_vm, identifier));
- }
</del><ins>+ void add(const Identifier&);
+ void add(AtomicStringImpl*);
+ void addKnownUnique(AtomicStringImpl*);
</ins><span class="cx">
</span><span class="cx"> Identifier& operator[](unsigned i) { return m_data->propertyNameVector()[i]; }
</span><span class="cx"> const Identifier& operator[](unsigned i) const { return m_data->propertyNameVector()[i]; }
</span><span class="lines">@@ -86,7 +82,7 @@
</span><span class="cx"> PassRefPtr<PropertyNameArrayData> releaseData() { return m_data.release(); }
</span><span class="cx">
</span><span class="cx"> // FIXME: Remove these functions.
</span><del>- bool canAddKnownUniqueForStructure() const { return m_set.isEmpty(); }
</del><ins>+ bool canAddKnownUniqueForStructure() const { return m_data->propertyNameVector().isEmpty(); }
</ins><span class="cx"> typedef PropertyNameArrayData::PropertyNameVector::const_iterator const_iterator;
</span><span class="cx"> size_t size() const { return m_data->propertyNameVector().size(); }
</span><span class="cx"> const_iterator begin() const { return m_data->propertyNameVector().begin(); }
</span><span class="lines">@@ -98,6 +94,37 @@
</span><span class="cx"> VM* m_vm;
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+ALWAYS_INLINE void PropertyNameArray::add(const Identifier& identifier)
+{
+ add(identifier.impl());
+}
+
+ALWAYS_INLINE void PropertyNameArray::addKnownUnique(AtomicStringImpl* identifier)
+{
+ m_data->propertyNameVector().append(Identifier::fromUid(m_vm, identifier));
+}
+
+ALWAYS_INLINE void PropertyNameArray::add(AtomicStringImpl* identifier)
+{
+ static const unsigned setThreshold = 20;
+
+ ASSERT(identifier);
+
+ if (size() < setThreshold) {
+ if (m_data->propertyNameVector().contains(identifier))
+ return;
+ } else {
+ if (m_set.isEmpty()) {
+ for (Identifier& name : m_data->propertyNameVector())
+ m_set.add(name.impl());
+ }
+ if (!m_set.add(identifier).isNewEntry)
+ return;
+ }
+
+ addKnownUnique(identifier);
+}
+
</ins><span class="cx"> } // namespace JSC
</span><span class="cx">
</span><span class="cx"> #endif // PropertyNameArray_h
</span></span></pre>
</div>
</div>
</body>
</html>