Title: [169903] trunk/Source/_javascript_Core
Revision
169903
Author
[email protected]
Date
2014-06-12 11:22:46 -0700 (Thu, 12 Jun 2014)

Log Message

Move structureHasRareData out of TypeInfo
https://bugs.webkit.org/show_bug.cgi?id=133800

Reviewed by Andreas Kling.

StructureHasRareData was originally put in TypeInfo to avoid making Structure bigger,
but we have a few spare bits in Structure so it would be nice to remove this hack.

* runtime/JSTypeInfo.h:
(JSC::TypeInfo::newImpurePropertyFiresWatchpoints):
(JSC::TypeInfo::structureHasRareData): Deleted.
* runtime/Structure.cpp:
(JSC::Structure::Structure):
(JSC::Structure::allocateRareData):
(JSC::Structure::cloneRareDataFrom):
* runtime/Structure.h:
(JSC::Structure::previousID):
(JSC::Structure::objectToStringValue):
(JSC::Structure::setObjectToStringValue):
(JSC::Structure::setPreviousID):
(JSC::Structure::clearPreviousID):
(JSC::Structure::previous):
(JSC::Structure::rareData):
* runtime/StructureInlines.h:
(JSC::Structure::setEnumerationCache):
(JSC::Structure::enumerationCache):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (169902 => 169903)


--- trunk/Source/_javascript_Core/ChangeLog	2014-06-12 17:42:10 UTC (rev 169902)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-06-12 18:22:46 UTC (rev 169903)
@@ -1,3 +1,32 @@
+2014-06-12  Mark Hahnenberg  <[email protected]>
+
+        Move structureHasRareData out of TypeInfo
+        https://bugs.webkit.org/show_bug.cgi?id=133800
+
+        Reviewed by Andreas Kling.
+
+        StructureHasRareData was originally put in TypeInfo to avoid making Structure bigger, 
+        but we have a few spare bits in Structure so it would be nice to remove this hack.
+
+        * runtime/JSTypeInfo.h:
+        (JSC::TypeInfo::newImpurePropertyFiresWatchpoints):
+        (JSC::TypeInfo::structureHasRareData): Deleted.
+        * runtime/Structure.cpp:
+        (JSC::Structure::Structure):
+        (JSC::Structure::allocateRareData):
+        (JSC::Structure::cloneRareDataFrom):
+        * runtime/Structure.h:
+        (JSC::Structure::previousID):
+        (JSC::Structure::objectToStringValue):
+        (JSC::Structure::setObjectToStringValue):
+        (JSC::Structure::setPreviousID):
+        (JSC::Structure::clearPreviousID):
+        (JSC::Structure::previous):
+        (JSC::Structure::rareData):
+        * runtime/StructureInlines.h:
+        (JSC::Structure::setEnumerationCache):
+        (JSC::Structure::enumerationCache):
+
 2014-06-12  Zsolt Borbely  <[email protected]>
 
         Allow enum guards to be generated from the replay json files

Modified: trunk/Source/_javascript_Core/runtime/JSTypeInfo.h (169902 => 169903)


--- trunk/Source/_javascript_Core/runtime/JSTypeInfo.h	2014-06-12 17:42:10 UTC (rev 169902)
+++ trunk/Source/_javascript_Core/runtime/JSTypeInfo.h	2014-06-12 18:22:46 UTC (rev 169903)
@@ -49,8 +49,7 @@
     static const unsigned ProhibitsPropertyCaching = 1 << 9;
     static const unsigned HasImpureGetOwnPropertySlot = 1 << 10;
     static const unsigned NewImpurePropertyFiresWatchpoints = 1 << 11;
-    static const unsigned StructureHasRareData = 1 << 12;
-    static const unsigned StructureIsImmortal = 1 << 13;
+    static const unsigned StructureIsImmortal = 1 << 12;
 
     class TypeInfo {
     public:
@@ -96,7 +95,6 @@
         bool prohibitsPropertyCaching() const { return isSetOnFlags2(ProhibitsPropertyCaching); }
         bool hasImpureGetOwnPropertySlot() const { return isSetOnFlags2(HasImpureGetOwnPropertySlot); }
         bool newImpurePropertyFiresWatchpoints() const { return isSetOnFlags2(NewImpurePropertyFiresWatchpoints); }
-        bool structureHasRareData() const { return isSetOnFlags2(StructureHasRareData); }
         bool structureIsImmortal() const { return isSetOnFlags2(StructureIsImmortal); }
 
         static ptrdiff_t flagsOffset()

Modified: trunk/Source/_javascript_Core/runtime/Structure.cpp (169902 => 169903)


--- trunk/Source/_javascript_Core/runtime/Structure.cpp	2014-06-12 17:42:10 UTC (rev 169902)
+++ trunk/Source/_javascript_Core/runtime/Structure.cpp	2014-06-12 18:22:46 UTC (rev 169903)
@@ -169,10 +169,11 @@
     , m_preventExtensions(false)
     , m_didTransition(false)
     , m_staticFunctionReified(false)
+    , m_hasRareData(false)
 {
     ASSERT(inlineCapacity <= JSFinalObject::maxInlineCapacity());
     ASSERT(static_cast<PropertyOffset>(inlineCapacity) < firstOutOfLineOffset);
-    ASSERT(!typeInfo.structureHasRareData());
+    ASSERT(!m_hasRareData);
     ASSERT(hasReadOnlyOrGetterSetterPropertiesExcludingProto() || !m_classInfo->hasStaticSetterOrReadonlyProperties(vm));
     ASSERT(hasGetterSetterProperties() || !m_classInfo->hasStaticSetterOrReadonlyProperties(vm));
 }
@@ -198,6 +199,7 @@
     , m_preventExtensions(false)
     , m_didTransition(false)
     , m_staticFunctionReified(false)
+    , m_hasRareData(false)
 {
     TypeInfo typeInfo = TypeInfo(CompoundType, OverridesVisitChildren | StructureIsImmortal);
     m_blob = StructureIDBlob(vm.heap.structureIDTable().allocateID(this), 0, typeInfo);
@@ -226,13 +228,14 @@
     , m_preventExtensions(previous->m_preventExtensions)
     , m_didTransition(true)
     , m_staticFunctionReified(previous->m_staticFunctionReified)
+    , m_hasRareData(false)
 {
-    TypeInfo typeInfo = TypeInfo(previous->typeInfo().type(), previous->typeInfo().flags() & ~StructureHasRareData);
+    TypeInfo typeInfo = previous->typeInfo();
     m_blob = StructureIDBlob(vm.heap.structureIDTable().allocateID(this), previous->indexingTypeIncludingHistory(), typeInfo);
     m_outOfLineTypeFlags = typeInfo.outOfLineTypeFlags();
 
     ASSERT(!previous->typeInfo().structureIsImmortal());
-    if (previous->typeInfo().structureHasRareData() && previous->rareData()->needsCloning())
+    if (previous->m_hasRareData && previous->rareData()->needsCloning())
         cloneRareDataFrom(vm, previous);
     setPreviousID(vm, this, previous);
 
@@ -790,24 +793,21 @@
 
 void Structure::allocateRareData(VM& vm)
 {
-    ASSERT(!typeInfo().structureHasRareData());
+    ASSERT(!m_hasRareData);
     StructureRareData* rareData = StructureRareData::create(vm, previous());
-    TypeInfo oldTypeInfo = typeInfo();
-    TypeInfo newTypeInfo = TypeInfo(oldTypeInfo.type(), oldTypeInfo.flags() | StructureHasRareData);
-    m_outOfLineTypeFlags = newTypeInfo.outOfLineTypeFlags();
     m_previousOrRareData.set(vm, this, rareData);
-    ASSERT(typeInfo().structureHasRareData());
+    m_hasRareData = true;
+    ASSERT(m_hasRareData);
 }
 
 void Structure::cloneRareDataFrom(VM& vm, const Structure* other)
 {
-    ASSERT(other->typeInfo().structureHasRareData());
+    ASSERT(!m_hasRareData);
+    ASSERT(other->m_hasRareData);
     StructureRareData* newRareData = StructureRareData::clone(vm, other->rareData());
-    TypeInfo oldTypeInfo = typeInfo();
-    TypeInfo newTypeInfo = TypeInfo(oldTypeInfo.type(), oldTypeInfo.flags() | StructureHasRareData);
-    m_outOfLineTypeFlags = newTypeInfo.outOfLineTypeFlags();
     m_previousOrRareData.set(vm, this, newRareData);
-    ASSERT(typeInfo().structureHasRareData());
+    m_hasRareData = true;
+    ASSERT(m_hasRareData);
 }
 
 #if DUMP_PROPERTYMAP_STATS

Modified: trunk/Source/_javascript_Core/runtime/Structure.h (169902 => 169903)


--- trunk/Source/_javascript_Core/runtime/Structure.h	2014-06-12 17:42:10 UTC (rev 169902)
+++ trunk/Source/_javascript_Core/runtime/Structure.h	2014-06-12 18:22:46 UTC (rev 169903)
@@ -196,7 +196,7 @@
     Structure* previousID() const
     {
         ASSERT(structure()->classInfo() == info());
-        if (typeInfo().structureHasRareData())
+        if (m_hasRareData)
             return rareData()->previousID();
         return previous();
     }
@@ -305,14 +305,14 @@
 
     JSString* objectToStringValue()
     {
-        if (!typeInfo().structureHasRareData())
+        if (!m_hasRareData)
             return 0;
         return rareData()->objectToStringValue();
     }
 
     void setObjectToStringValue(VM& vm, const JSCell* owner, JSString* value)
     {
-        if (!typeInfo().structureHasRareData())
+        if (!m_hasRareData)
             allocateRareData(vm);
         rareData()->setObjectToStringValue(vm, owner, value);
     }
@@ -458,7 +458,7 @@
 
     void setPreviousID(VM& vm, Structure* transition, Structure* structure)
     {
-        if (typeInfo().structureHasRareData())
+        if (m_hasRareData)
             rareData()->setPreviousID(vm, transition, structure);
         else
             m_previousOrRareData.set(vm, transition, structure);
@@ -466,7 +466,7 @@
 
     void clearPreviousID()
     {
-        if (typeInfo().structureHasRareData())
+        if (m_hasRareData)
             rareData()->clearPreviousID();
         else
             m_previousOrRareData.clear();
@@ -485,13 +485,13 @@
 
     Structure* previous() const
     {
-        ASSERT(!typeInfo().structureHasRareData());
+        ASSERT(!m_hasRareData);
         return static_cast<Structure*>(m_previousOrRareData.get());
     }
 
     StructureRareData* rareData() const
     {
-        ASSERT(typeInfo().structureHasRareData());
+        ASSERT(m_hasRareData);
         return static_cast<StructureRareData*>(m_previousOrRareData.get());
     }
         
@@ -549,6 +549,7 @@
     unsigned m_preventExtensions : 1;
     unsigned m_didTransition : 1;
     unsigned m_staticFunctionReified : 1;
+    bool m_hasRareData : 1;
 };
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/StructureInlines.h (169902 => 169903)


--- trunk/Source/_javascript_Core/runtime/StructureInlines.h	2014-06-12 17:42:10 UTC (rev 169902)
+++ trunk/Source/_javascript_Core/runtime/StructureInlines.h	2014-06-12 18:22:46 UTC (rev 169903)
@@ -154,14 +154,14 @@
 inline void Structure::setEnumerationCache(VM& vm, JSPropertyNameIterator* enumerationCache)
 {
     ASSERT(!isDictionary());
-    if (!typeInfo().structureHasRareData())
+    if (!m_hasRareData)
         allocateRareData(vm);
     rareData()->setEnumerationCache(vm, this, enumerationCache);
 }
 
 inline JSPropertyNameIterator* Structure::enumerationCache()
 {
-    if (!typeInfo().structureHasRareData())
+    if (!m_hasRareData)
         return 0;
     return rareData()->enumerationCache();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to