summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/Structure.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-10-15 16:08:57 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2012-10-15 16:08:57 +0200
commit5466563f4b5b6b86523e3f89bb7f77e5b5270c78 (patch)
tree8caccf7cd03a15207cde3ba282c88bf132482a91 /Source/JavaScriptCore/runtime/Structure.cpp
parent33b26980cb24288b5a9f2590ccf32a949281bb79 (diff)
downloadqtwebkit-5466563f4b5b6b86523e3f89bb7f77e5b5270c78.tar.gz
Imported WebKit commit 0dc6cd75e1d4836eaffbb520be96fac4847cc9d2 (http://svn.webkit.org/repository/webkit/trunk@131300)
WebKit update which introduces the QtWebKitWidgets module that contains the WK1 widgets based API. (In fact it renames QtWebKit to QtWebKitWidgets while we're working on completing the entire split as part of https://bugs.webkit.org/show_bug.cgi?id=99314
Diffstat (limited to 'Source/JavaScriptCore/runtime/Structure.cpp')
-rw-r--r--Source/JavaScriptCore/runtime/Structure.cpp33
1 files changed, 21 insertions, 12 deletions
diff --git a/Source/JavaScriptCore/runtime/Structure.cpp b/Source/JavaScriptCore/runtime/Structure.cpp
index a59a0860d..a931def27 100644
--- a/Source/JavaScriptCore/runtime/Structure.cpp
+++ b/Source/JavaScriptCore/runtime/Structure.cpp
@@ -149,7 +149,7 @@ void Structure::dumpStatistics()
#endif
}
-Structure::Structure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype, const TypeInfo& typeInfo, const ClassInfo* classInfo, IndexingType indexingType)
+Structure::Structure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype, const TypeInfo& typeInfo, const ClassInfo* classInfo, IndexingType indexingType, PropertyOffset inlineCapacity)
: JSCell(globalData, globalData.structureStructure.get())
, m_typeInfo(typeInfo)
, m_indexingType(indexingType)
@@ -158,6 +158,7 @@ Structure::Structure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSV
, m_classInfo(classInfo)
, m_transitionWatchpointSet(InitializedWatching)
, m_outOfLineCapacity(0)
+ , m_inlineCapacity(inlineCapacity)
, m_offset(invalidOffset)
, m_dictionaryKind(NoneDictionaryKind)
, m_isPinnedPropertyTable(false)
@@ -182,6 +183,7 @@ Structure::Structure(JSGlobalData& globalData)
, m_classInfo(&s_info)
, m_transitionWatchpointSet(InitializedWatching)
, m_outOfLineCapacity(0)
+ , m_inlineCapacity(0)
, m_offset(invalidOffset)
, m_dictionaryKind(NoneDictionaryKind)
, m_isPinnedPropertyTable(false)
@@ -204,6 +206,7 @@ Structure::Structure(JSGlobalData& globalData, const Structure* previous)
, m_classInfo(previous->m_classInfo)
, m_transitionWatchpointSet(InitializedWatching)
, m_outOfLineCapacity(previous->m_outOfLineCapacity)
+ , m_inlineCapacity(previous->m_inlineCapacity)
, m_offset(invalidOffset)
, m_dictionaryKind(previous->m_dictionaryKind)
, m_isPinnedPropertyTable(false)
@@ -323,11 +326,15 @@ bool Structure::anyObjectInChainMayInterceptIndexedAccesses() const
}
}
-NonPropertyTransition Structure::suggestedIndexingTransition() const
+bool Structure::needsSlowPutIndexing() const
{
- ASSERT(!hasIndexedProperties(indexingType()));
-
- if (anyObjectInChainMayInterceptIndexedAccesses() || globalObject()->isHavingABadTime())
+ return anyObjectInChainMayInterceptIndexedAccesses()
+ || globalObject()->isHavingABadTime();
+}
+
+NonPropertyTransition Structure::suggestedArrayStorageTransition() const
+{
+ if (needsSlowPutIndexing())
return AllocateSlowPutArrayStorage;
return AllocateArrayStorage;
@@ -546,6 +553,7 @@ Structure* Structure::nonPropertyTransition(JSGlobalData& globalData, Structure*
transition->m_previous.set(globalData, transition, structure);
transition->m_attributesInPrevious = attributes;
transition->m_indexingType = indexingType;
+ transition->m_offset = structure->m_offset;
if (structure->m_propertyTable) {
if (structure->m_isPinnedPropertyTable)
@@ -608,20 +616,21 @@ Structure* Structure::flattenDictionaryStructure(JSGlobalData& globalData, JSObj
ASSERT(m_propertyTable);
size_t propertyCount = m_propertyTable->size();
+
+ // Holds our values compacted by insertion order.
Vector<JSValue> values(propertyCount);
-
+
+ // Copies out our values from their hashed locations, compacting property table offsets as we go.
unsigned i = 0;
- PropertyOffset firstOffset = firstPropertyOffsetFor(m_typeInfo.type());
PropertyTable::iterator end = m_propertyTable->end();
for (PropertyTable::iterator iter = m_propertyTable->begin(); iter != end; ++iter, ++i) {
values[i] = object->getDirectOffset(iter->offset);
- // Update property table to have the new property offsets
- iter->offset = i + firstOffset;
+ iter->offset = propertyOffsetFor(i, m_inlineCapacity);
}
- // Copy the original property values into their final locations
+ // Copies in our values to their compacted locations.
for (unsigned i = 0; i < propertyCount; i++)
- object->putDirectOffset(globalData, firstOffset + i, values[i]);
+ object->putDirectOffset(globalData, propertyOffsetFor(i, m_inlineCapacity), values[i]);
m_propertyTable->clearDeletedOffsets();
}
@@ -759,7 +768,7 @@ PropertyOffset Structure::putSpecificValue(JSGlobalData& globalData, PropertyNam
if (!m_propertyTable)
createPropertyMap();
- PropertyOffset newOffset = m_propertyTable->nextOffset(m_typeInfo.type());
+ PropertyOffset newOffset = m_propertyTable->nextOffset(m_inlineCapacity);
m_propertyTable->add(PropertyMapEntry(globalData, this, rep, newOffset, attributes, specificValue));