summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/runtime/Structure.h
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.h
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.h')
-rw-r--r--Source/JavaScriptCore/runtime/Structure.h82
1 files changed, 17 insertions, 65 deletions
diff --git a/Source/JavaScriptCore/runtime/Structure.h b/Source/JavaScriptCore/runtime/Structure.h
index e77287b20..f45e9f1d9 100644
--- a/Source/JavaScriptCore/runtime/Structure.h
+++ b/Source/JavaScriptCore/runtime/Structure.h
@@ -69,7 +69,7 @@ namespace JSC {
typedef JSCell Base;
- static Structure* create(JSGlobalData&, JSGlobalObject*, JSValue prototype, const TypeInfo&, const ClassInfo*, IndexingType = 0);
+ static Structure* create(JSGlobalData&, JSGlobalObject*, JSValue prototype, const TypeInfo&, const ClassInfo*, IndexingType = NonArray, PropertyOffset inlineCapacity = 0);
protected:
void finishCreation(JSGlobalData& globalData)
@@ -128,6 +128,8 @@ namespace JSC {
Structure* flattenDictionaryStructure(JSGlobalData&, JSObject*);
+ static const bool needsDestruction = true;
+ static const bool hasImmortalStructure = true;
static void destroy(JSCell*);
// These should be used with caution.
@@ -152,7 +154,8 @@ namespace JSC {
bool anyObjectInChainMayInterceptIndexedAccesses() const;
- NonPropertyTransition suggestedIndexingTransition() const;
+ bool needsSlowPutIndexing() const;
+ NonPropertyTransition suggestedArrayStorageTransition() const;
JSGlobalObject* globalObject() const { return m_globalObject.get(); }
void setGlobalObject(JSGlobalData& globalData, JSGlobalObject* globalObject) { m_globalObject.set(globalData, this, globalObject); }
@@ -177,24 +180,6 @@ namespace JSC {
ASSERT(structure()->classInfo() == &s_info);
return m_outOfLineCapacity;
}
- unsigned outOfLineSizeForKnownFinalObject() const
- {
- ASSERT(m_typeInfo.type() == FinalObjectType);
- if (m_propertyTable) {
- unsigned totalSize = m_propertyTable->propertyStorageSize();
- if (totalSize < static_cast<unsigned>(inlineStorageCapacity))
- return 0;
- return totalSize - inlineStorageCapacity;
- }
- return numberOfOutOfLineSlotsForLastOffset(m_offset);
- }
- unsigned outOfLineSizeForKnownNonFinalObject() const
- {
- ASSERT(m_typeInfo.type() != FinalObjectType);
- if (m_propertyTable)
- return m_propertyTable->propertyStorageSize();
- return numberOfOutOfLineSlotsForLastOffset(m_offset);
- }
unsigned outOfLineSize() const
{
ASSERT(structure()->classInfo() == &s_info);
@@ -209,31 +194,20 @@ namespace JSC {
}
bool hasInlineStorage() const
{
- return m_typeInfo.type() == FinalObjectType;
+ return !!m_inlineCapacity;
}
unsigned inlineCapacity() const
{
- if (hasInlineStorage())
- return inlineStorageCapacity;
- return 0;
+ return m_inlineCapacity;
}
- unsigned inlineSizeForKnownFinalObject() const
+ unsigned inlineSize() const
{
- ASSERT(m_typeInfo.type() == FinalObjectType);
unsigned result;
if (m_propertyTable)
result = m_propertyTable->propertyStorageSize();
else
result = m_offset + 1;
- if (result > static_cast<unsigned>(inlineStorageCapacity))
- return inlineStorageCapacity;
- return result;
- }
- unsigned inlineSize() const
- {
- if (!hasInlineStorage())
- return 0;
- return inlineSizeForKnownFinalObject();
+ return std::min<unsigned>(result, m_inlineCapacity);
}
unsigned totalStorageSize() const
{
@@ -251,16 +225,12 @@ namespace JSC {
{
if (hasInlineStorage())
return 0;
- return inlineStorageCapacity;
+ return firstOutOfLineOffset;
}
PropertyOffset lastValidOffset() const
{
- if (m_propertyTable) {
- PropertyOffset size = m_propertyTable->propertyStorageSize();
- if (!hasInlineStorage())
- size += inlineStorageCapacity;
- return size - 1;
- }
+ if (m_propertyTable)
+ return propertyOffsetFor(m_propertyTable->propertyStorageSize() - 1, m_inlineCapacity);
return m_offset;
}
bool isValidOffset(PropertyOffset offset) const
@@ -381,7 +351,7 @@ namespace JSC {
private:
friend class LLIntOffsetsExtractor;
- JS_EXPORT_PRIVATE Structure(JSGlobalData&, JSGlobalObject*, JSValue prototype, const TypeInfo&, const ClassInfo*, IndexingType = 0);
+ JS_EXPORT_PRIVATE Structure(JSGlobalData&, JSGlobalObject*, JSValue prototype, const TypeInfo&, const ClassInfo*, IndexingType, PropertyOffset inlineCapacity);
Structure(JSGlobalData&);
Structure(JSGlobalData&, const Structure*);
@@ -457,6 +427,8 @@ namespace JSC {
mutable InlineWatchpointSet m_transitionWatchpointSet;
uint32_t m_outOfLineCapacity;
+ uint8_t m_inlineCapacity;
+ COMPILE_ASSERT(firstOutOfLineOffset < 256, firstOutOfLineOffset_fits);
// m_offset does not account for anonymous slots
PropertyOffset m_offset;
@@ -473,22 +445,11 @@ namespace JSC {
unsigned m_staticFunctionReified;
};
- template <> inline void* allocateCell<Structure>(Heap& heap)
- {
-#if ENABLE(GC_VALIDATION)
- ASSERT(!heap.globalData()->isInitializingObject());
- heap.globalData()->setInitializingObjectClass(&Structure::s_info);
-#endif
- JSCell* result = static_cast<JSCell*>(heap.allocateStructure(sizeof(Structure)));
- result->clearStructure();
- return result;
- }
-
- inline Structure* Structure::create(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype, const TypeInfo& typeInfo, const ClassInfo* classInfo, IndexingType indexingType)
+ inline Structure* Structure::create(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype, const TypeInfo& typeInfo, const ClassInfo* classInfo, IndexingType indexingType, PropertyOffset inlineCapacity)
{
ASSERT(globalData.structureStructure);
ASSERT(classInfo);
- Structure* structure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData, globalObject, prototype, typeInfo, classInfo, indexingType);
+ Structure* structure = new (NotNull, allocateCell<Structure>(globalData.heap)) Structure(globalData, globalObject, prototype, typeInfo, classInfo, indexingType, inlineCapacity);
structure->finishCreation(globalData);
return structure;
}
@@ -628,15 +589,6 @@ namespace JSC {
ASSERT(m_structure || !globalData.structureStructure);
}
- inline const ClassInfo* JSCell::classInfo() const
- {
-#if ENABLE(GC_VALIDATION)
- return m_structure.unvalidatedGet()->classInfo();
-#else
- return m_structure->classInfo();
-#endif
- }
-
} // namespace JSC
#endif // Structure_h