Title: [231172] trunk/Source/_javascript_Core
Revision
231172
Author
[email protected]
Date
2018-04-30 15:13:10 -0700 (Mon, 30 Apr 2018)

Log Message

Move the MayBePrototype JSCell header bit to InlineTypeFlags
https://bugs.webkit.org/show_bug.cgi?id=185143

Reviewed by Mark Lam.

* runtime/IndexingType.h:
* runtime/JSCellInlines.h:
(JSC::JSCell::setStructure):
(JSC::JSCell::mayBePrototype const):
(JSC::JSCell::didBecomePrototype):
* runtime/JSTypeInfo.h:
(JSC::TypeInfo::mayBePrototype):
(JSC::TypeInfo::mergeInlineTypeFlags):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (231171 => 231172)


--- trunk/Source/_javascript_Core/ChangeLog	2018-04-30 21:38:26 UTC (rev 231171)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-04-30 22:13:10 UTC (rev 231172)
@@ -1,5 +1,21 @@
 2018-04-30  Keith Miller  <[email protected]>
 
+        Move the MayBePrototype JSCell header bit to InlineTypeFlags
+        https://bugs.webkit.org/show_bug.cgi?id=185143
+
+        Reviewed by Mark Lam.
+
+        * runtime/IndexingType.h:
+        * runtime/JSCellInlines.h:
+        (JSC::JSCell::setStructure):
+        (JSC::JSCell::mayBePrototype const):
+        (JSC::JSCell::didBecomePrototype):
+        * runtime/JSTypeInfo.h:
+        (JSC::TypeInfo::mayBePrototype):
+        (JSC::TypeInfo::mergeInlineTypeFlags):
+
+2018-04-30  Keith Miller  <[email protected]>
+
         Remove unneeded exception check from String.fromCharCode
         https://bugs.webkit.org/show_bug.cgi?id=185083
 

Modified: trunk/Source/_javascript_Core/runtime/IndexingType.h (231171 => 231172)


--- trunk/Source/_javascript_Core/runtime/IndexingType.h	2018-04-30 21:38:26 UTC (rev 231171)
+++ trunk/Source/_javascript_Core/runtime/IndexingType.h	2018-04-30 22:13:10 UTC (rev 231172)
@@ -73,7 +73,6 @@
 // prototype.
 static const IndexingType IndexingTypeLockIsHeld          = 0x20;
 static const IndexingType IndexingTypeLockHasParked       = 0x40;
-static const IndexingType IndexingTypeMayBePrototype      = 0x80;
 
 // List of acceptable array types.
 static const IndexingType NonArray                        = 0x0;

Modified: trunk/Source/_javascript_Core/runtime/JSCellInlines.h (231171 => 231172)


--- trunk/Source/_javascript_Core/runtime/JSCellInlines.h	2018-04-30 21:38:26 UTC (rev 231171)
+++ trunk/Source/_javascript_Core/runtime/JSCellInlines.h	2018-04-30 22:13:10 UTC (rev 231172)
@@ -230,7 +230,7 @@
         || this->structure()->transitionWatchpointSetHasBeenInvalidated()
         || Heap::heap(this)->structureIDTable().get(structure->id()) == structure);
     m_structureID = structure->id();
-    m_flags = structure->typeInfo().inlineTypeFlags();
+    m_flags = TypeInfo::mergeInlineTypeFlags(structure->typeInfo().inlineTypeFlags(), m_flags);
     m_type = structure->typeInfo().type();
     IndexingType newIndexingType = structure->indexingTypeIncludingHistory();
     if (m_indexingTypeAndMisc != newIndexingType) {
@@ -342,7 +342,7 @@
 
 inline bool JSCell::mayBePrototype() const
 {
-    return m_indexingTypeAndMisc & IndexingTypeMayBePrototype;
+    return TypeInfo::mayBePrototype(inlineTypeFlags());
 }
 
 inline void JSCell::didBecomePrototype()
@@ -349,7 +349,7 @@
 {
     if (mayBePrototype())
         return;
-    WTF::atomicExchangeOr(&m_indexingTypeAndMisc, IndexingTypeMayBePrototype);
+    m_flags |= static_cast<TypeInfo::InlineTypeFlags>(TypeInfoMayBePrototype);
 }
 
 inline JSObject* JSCell::toObject(ExecState* exec, JSGlobalObject* globalObject) const

Modified: trunk/Source/_javascript_Core/runtime/JSTypeInfo.h (231171 => 231172)


--- trunk/Source/_javascript_Core/runtime/JSTypeInfo.h	2018-04-30 21:38:26 UTC (rev 231171)
+++ trunk/Source/_javascript_Core/runtime/JSTypeInfo.h	2018-04-30 22:13:10 UTC (rev 231172)
@@ -43,6 +43,7 @@
 static const unsigned OverridesGetOwnPropertySlot = 1 << 3;
 static const unsigned OverridesToThis = 1 << 4; // If this is false then this returns something other than 'this'. Non-object cells that are visible to JS have this set as do some exotic objects.
 static const unsigned HasStaticPropertyTable = 1 << 5;
+static const unsigned TypeInfoMayBePrototype = 1 << 7; // Unlike other inline flags, this will only be set on the cell itself and will not be set on the Structure.
 
 // Out of line flags.
 
@@ -88,6 +89,7 @@
     bool overridesGetOwnPropertySlot() const { return overridesGetOwnPropertySlot(inlineTypeFlags()); }
     static bool overridesGetOwnPropertySlot(InlineTypeFlags flags) { return flags & OverridesGetOwnPropertySlot; }
     static bool hasStaticPropertyTable(InlineTypeFlags flags) { return flags & HasStaticPropertyTable; }
+    static bool mayBePrototype(InlineTypeFlags flags) { return flags & TypeInfoMayBePrototype; }
     bool overridesToThis() const { return isSetOnFlags1(OverridesToThis); }
     bool structureIsImmortal() const { return isSetOnFlags2(StructureIsImmortal); }
     bool overridesGetPropertyNames() const { return isSetOnFlags2(OverridesGetPropertyNames); }
@@ -115,6 +117,12 @@
         return OBJECT_OFFSETOF(TypeInfo, m_type);
     }
 
+    // Since the Structure doesn't track TypeInfoMayBePrototype, we need to make sure we copy it.
+    static InlineTypeFlags mergeInlineTypeFlags(InlineTypeFlags structureFlags, InlineTypeFlags oldCellFlags)
+    {
+        return structureFlags | (oldCellFlags & static_cast<InlineTypeFlags>(TypeInfoMayBePrototype));
+    }
+
     InlineTypeFlags inlineTypeFlags() const { return m_flags; }
     OutOfLineTypeFlags outOfLineTypeFlags() const { return m_flags2; }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to