summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'Source/JavaScriptCore/runtime')
-rw-r--r--Source/JavaScriptCore/runtime/JSObject.cpp3
-rw-r--r--Source/JavaScriptCore/runtime/JSPropertyNameIterator.cpp2
-rw-r--r--Source/JavaScriptCore/runtime/PropertyNameArray.h6
3 files changed, 10 insertions, 1 deletions
diff --git a/Source/JavaScriptCore/runtime/JSObject.cpp b/Source/JavaScriptCore/runtime/JSObject.cpp
index 32adefd2f..72cbb022a 100644
--- a/Source/JavaScriptCore/runtime/JSObject.cpp
+++ b/Source/JavaScriptCore/runtime/JSObject.cpp
@@ -1513,7 +1513,10 @@ 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());
+ size_t preStructurePropertyNamesCount = propertyNames.size();
object->structure()->getPropertyNamesFromStructure(exec->globalData(), propertyNames, mode);
+ size_t numCacheableSlots = preStructurePropertyNamesCount ? 0 : propertyNames.size();
+ propertyNames.setNumCacheableSlots(numCacheableSlots);
}
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..30f439bb2 100644
--- a/Source/JavaScriptCore/runtime/PropertyNameArray.h
+++ b/Source/JavaScriptCore/runtime/PropertyNameArray.h
@@ -55,12 +55,14 @@ namespace JSC {
PropertyNameArray(JSGlobalData* globalData)
: m_data(PropertyNameArrayData::create())
, m_globalData(globalData)
+ , m_numCacheableSlots(0)
{
}
PropertyNameArray(ExecState* exec)
: m_data(PropertyNameArrayData::create())
, m_globalData(&exec->globalData())
+ , m_numCacheableSlots(0)
{
}
@@ -83,12 +85,16 @@ 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 setNumCacheableSlots(size_t numCacheableSlots) { m_numCacheableSlots = numCacheableSlots; }
+
private:
typedef HashSet<StringImpl*, PtrHash<StringImpl*> > IdentifierSet;
RefPtr<PropertyNameArrayData> m_data;
IdentifierSet m_set;
JSGlobalData* m_globalData;
+ size_t m_numCacheableSlots;
};
} // namespace JSC