Title: [147887] trunk/Source/_javascript_Core
- Revision
- 147887
- Author
- [email protected]
- Date
- 2013-04-07 17:43:46 -0700 (Sun, 07 Apr 2013)
Log Message
Use Vector::reserveInitialCapacity() when possible in _javascript_Core runtime
https://bugs.webkit.org/show_bug.cgi?id=114111
Reviewed by Andreas Kling.
Almost all the code was already using Vector::reserveInitialCapacity()
and Vector::uncheckedAppend(). Fix the remaining parts.
* runtime/ArgList.h:
(MarkedArgumentBuffer): The type VectorType is unused.
* runtime/ArrayPrototype.cpp:
(JSC::arrayProtoFuncSort):
Move the variable closer to where it is needed.
* runtime/JSArray.cpp:
(JSC::JSArray::setLengthWithArrayStorage):
* runtime/JSObject.cpp:
(JSC::JSObject::getOwnPropertyNames):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (147886 => 147887)
--- trunk/Source/_javascript_Core/ChangeLog 2013-04-07 23:56:39 UTC (rev 147886)
+++ trunk/Source/_javascript_Core/ChangeLog 2013-04-08 00:43:46 UTC (rev 147887)
@@ -1,3 +1,25 @@
+2013-04-07 Benjamin Poulain <[email protected]>
+
+ Use Vector::reserveInitialCapacity() when possible in _javascript_Core runtime
+ https://bugs.webkit.org/show_bug.cgi?id=114111
+
+ Reviewed by Andreas Kling.
+
+ Almost all the code was already using Vector::reserveInitialCapacity()
+ and Vector::uncheckedAppend(). Fix the remaining parts.
+
+ * runtime/ArgList.h:
+ (MarkedArgumentBuffer): The type VectorType is unused.
+
+ * runtime/ArrayPrototype.cpp:
+ (JSC::arrayProtoFuncSort):
+ Move the variable closer to where it is needed.
+
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::setLengthWithArrayStorage):
+ * runtime/JSObject.cpp:
+ (JSC::JSObject::getOwnPropertyNames):
+
2013-04-07 Patrick Gansterer <[email protected]>
Remove references to Skia and V8 from CMake files
Modified: trunk/Source/_javascript_Core/runtime/ArgList.h (147886 => 147887)
--- trunk/Source/_javascript_Core/runtime/ArgList.h 2013-04-07 23:56:39 UTC (rev 147886)
+++ trunk/Source/_javascript_Core/runtime/ArgList.h 2013-04-08 00:43:46 UTC (rev 147887)
@@ -38,7 +38,6 @@
private:
static const size_t inlineCapacity = 8;
- typedef Vector<Register, inlineCapacity> VectorType;
typedef HashSet<MarkedArgumentBuffer*> ListSet;
public:
Modified: trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp (147886 => 147887)
--- trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp 2013-04-07 23:56:39 UTC (rev 147886)
+++ trunk/Source/_javascript_Core/runtime/ArrayPrototype.cpp 2013-04-08 00:43:46 UTC (rev 147887)
@@ -738,8 +738,6 @@
if (length < 1000)
return performSlowSort(exec, thisObj, length, function, callData, callType) ? JSValue::encode(thisObj) : JSValue::encode(jsUndefined());
- Vector<uint32_t> keys;
-
JSGlobalObject* globalObject = JSGlobalObject::create(
exec->globalData(), JSGlobalObject::createStructure(exec->globalData(), jsNull()));
JSArray* flatArray = constructEmptyArray(globalObject->globalExec(), 0);
@@ -750,7 +748,8 @@
thisObj->methodTable()->getPropertyNames(thisObj, exec, nameArray, IncludeDontEnumProperties);
if (exec->hadException())
return JSValue::encode(jsUndefined());
-
+
+ Vector<uint32_t> keys;
for (size_t i = 0; i < nameArray.size(); ++i) {
PropertyName name = nameArray[i];
uint32_t index = name.asIndex();
Modified: trunk/Source/_javascript_Core/runtime/JSArray.cpp (147886 => 147887)
--- trunk/Source/_javascript_Core/runtime/JSArray.cpp 2013-04-07 23:56:39 UTC (rev 147886)
+++ trunk/Source/_javascript_Core/runtime/JSArray.cpp 2013-04-08 00:43:46 UTC (rev 147887)
@@ -350,7 +350,7 @@
if (newLength < length) {
// Copy any keys we might be interested in into a vector.
Vector<unsigned> keys;
- keys.reserveCapacity(min(map->size(), static_cast<size_t>(length - newLength)));
+ keys.reserveInitialCapacity(min(map->size(), static_cast<size_t>(length - newLength)));
SparseArrayValueMap::const_iterator end = map->end();
for (SparseArrayValueMap::const_iterator it = map->begin(); it != end; ++it) {
unsigned index = static_cast<unsigned>(it->key);
Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (147886 => 147887)
--- trunk/Source/_javascript_Core/runtime/JSObject.cpp 2013-04-07 23:56:39 UTC (rev 147886)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp 2013-04-08 00:43:46 UTC (rev 147887)
@@ -1507,12 +1507,12 @@
if (SparseArrayValueMap* map = storage->m_sparseMap.get()) {
Vector<unsigned> keys;
- keys.reserveCapacity(map->size());
+ keys.reserveInitialCapacity(map->size());
SparseArrayValueMap::const_iterator end = map->end();
for (SparseArrayValueMap::const_iterator it = map->begin(); it != end; ++it) {
if (mode == IncludeDontEnumProperties || !(it->value.attributes & DontEnum))
- keys.append(static_cast<unsigned>(it->key));
+ keys.uncheckedAppend(static_cast<unsigned>(it->key));
}
std::sort(keys.begin(), keys.end());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes