diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-07-04 15:34:18 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-07-04 15:34:18 +0200 |
commit | 95be58fdcf23bb20dbde16dcb64f080256a4586d (patch) | |
tree | 73380edfce494ccbbf1d5d432e0bffd2e0c82a39 /Source/JavaScriptCore/runtime | |
parent | a077ffff22ac678254ba35ad0a7cddc4a4f06542 (diff) | |
parent | b346c0f76c6a8f94accd1568c2f0d2c36c1cc11f (diff) | |
download | qtwebkit-95be58fdcf23bb20dbde16dcb64f080256a4586d.tar.gz |
Merge remote-tracking branch 'origin/stable' into dev
Change-Id: Ibe6e706a4f315065b8cfa96d796c1f04063c58df
Diffstat (limited to 'Source/JavaScriptCore/runtime')
-rw-r--r-- | Source/JavaScriptCore/runtime/JSObject.cpp | 6 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp | 2 | ||||
-rw-r--r-- | Source/JavaScriptCore/runtime/PropertyNameArray.h | 20 |
3 files changed, 27 insertions, 1 deletions
diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp index 32adefd2f..e6f95bdfa 100644 --- a/Source/JavaScriptCore/runtime/JSObject.cpp +++ b/Source/JavaScriptCore/runtime/JSObject.cpp @@ -1423,6 +1423,7 @@ bool JSObject::getPropertySpecificValue(ExecState* exec, PropertyName propertyNa void JSObject::getPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) { + propertyNames.setBaseObject(object); object->methodTable()->getOwnPropertyNames(object, exec, propertyNames, mode); if (object->prototype().isNull()) @@ -1513,7 +1514,12 @@ void JSObject::getOwnPropertyNames(JSObject* object, ExecState* exec, PropertyNa void JSObject::getOwnNonIndexPropertyNames(JSObject* object, ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) { getClassPropertyNames(exec, object->classInfo(), propertyNames, mode, object->staticFunctionsReified()); + + bool canCachePropertiesFromStructure = !propertyNames.size(); object->structure()->getPropertyNamesFromStructure(exec->globalData(), propertyNames, mode); + + if (canCachePropertiesFromStructure) + propertyNames.setNumCacheableSlotsForObject(object, propertyNames.size()); } double JSObject::toNumber(ExecState* exec) const diff --git a/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp b/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp index 225401fbd..496799501 100644 --- a/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp +++ b/Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp @@ -54,7 +54,7 @@ JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSObject size_t numCacheableSlots = 0; if (!o->structure()->hasNonEnumerableProperties() && !o->structure()->hasGetterSetterProperties() && !o->structure()->isUncacheableDictionary() && !o->structure()->typeInfo().overridesGetPropertyNames()) - numCacheableSlots = o->structure()->totalStorageSize(); + numCacheableSlots = propertyNames.numCacheableSlots(); JSPropertyNameIterator* jsPropertyNameIterator = new (NotNull, allocateCell<JSPropertyNameIterator>(*exec->heap())) JSPropertyNameIterator(exec, propertyNames.data(), numCacheableSlots); jsPropertyNameIterator->finishCreation(exec, propertyNames.data(), o); diff --git a/Source/JavaScriptCore/runtime/PropertyNameArray.h b/Source/JavaScriptCore/runtime/PropertyNameArray.h index 89b1af00b..1cdac0049 100644 --- a/Source/JavaScriptCore/runtime/PropertyNameArray.h +++ b/Source/JavaScriptCore/runtime/PropertyNameArray.h @@ -55,12 +55,16 @@ namespace JSC { PropertyNameArray(JSGlobalData* globalData) : m_data(PropertyNameArrayData::create()) , m_globalData(globalData) + , m_numCacheableSlots(0) + , m_baseObject(0) { } PropertyNameArray(ExecState* exec) : m_data(PropertyNameArrayData::create()) , m_globalData(&exec->globalData()) + , m_numCacheableSlots(0) + , m_baseObject(0) { } @@ -83,12 +87,28 @@ namespace JSC { const_iterator begin() const { return m_data->propertyNameVector().begin(); } const_iterator end() const { return m_data->propertyNameVector().end(); } + size_t numCacheableSlots() const { return m_numCacheableSlots; } + void setNumCacheableSlotsForObject(JSObject* object, size_t numCacheableSlots) + { + if (object != m_baseObject) + return; + m_numCacheableSlots = numCacheableSlots; + } + void setBaseObject(JSObject* object) + { + if (m_baseObject) + return; + m_baseObject = object; + } + private: typedef HashSet<StringImpl*, PtrHash<StringImpl*> > IdentifierSet; RefPtr<PropertyNameArrayData> m_data; IdentifierSet m_set; JSGlobalData* m_globalData; + size_t m_numCacheableSlots; + JSObject* m_baseObject; }; } // namespace JSC |