Title: [242471] releases/WebKitGTK/webkit-2.24/Source/_javascript_Core
- Revision
- 242471
- Author
- carlo...@webkit.org
- Date
- 2019-03-05 09:20:55 -0800 (Tue, 05 Mar 2019)
Log Message
Merge r242103 - Misc cleanup in StructureIDTable after r242096.
https://bugs.webkit.org/show_bug.cgi?id=195063
Reviewed by Saam Barati.
* runtime/StructureIDTable.cpp:
(JSC::StructureIDTable::allocateID):
- RELEASE_ASSERT that the StructureID allocation will succeed.
* runtime/StructureIDTable.h:
(JSC::StructureIDTable::decode):
(JSC::StructureIDTable::encode):
- Add back a comment that Yusuke requested but was lost when the patch was rolled
out and relanded.
- Applied bitwise_casts that Saam requested.
Modified Paths
Diff
Modified: releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/ChangeLog (242470 => 242471)
--- releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/ChangeLog 2019-03-05 17:20:51 UTC (rev 242470)
+++ releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/ChangeLog 2019-03-05 17:20:55 UTC (rev 242471)
@@ -1,5 +1,23 @@
2019-02-26 Mark Lam <mark....@apple.com>
+ Misc cleanup in StructureIDTable after r242096.
+ https://bugs.webkit.org/show_bug.cgi?id=195063
+
+ Reviewed by Saam Barati.
+
+ * runtime/StructureIDTable.cpp:
+ (JSC::StructureIDTable::allocateID):
+ - RELEASE_ASSERT that the StructureID allocation will succeed.
+
+ * runtime/StructureIDTable.h:
+ (JSC::StructureIDTable::decode):
+ (JSC::StructureIDTable::encode):
+ - Add back a comment that Yusuke requested but was lost when the patch was rolled
+ out and relanded.
+ - Applied bitwise_casts that Saam requested.
+
+2019-02-26 Mark Lam <mark....@apple.com>
+
Gardening: 32-bit build fix after r242096.
https://bugs.webkit.org/show_bug.cgi?id=194989
Modified: releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/runtime/StructureIDTable.cpp (242470 => 242471)
--- releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/runtime/StructureIDTable.cpp 2019-03-05 17:20:51 UTC (rev 242470)
+++ releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/runtime/StructureIDTable.cpp 2019-03-05 17:20:55 UTC (rev 242471)
@@ -135,11 +135,9 @@
ASSERT(m_size == m_capacity);
resize(m_capacity * 2);
ASSERT(m_size < m_capacity);
- ASSERT(m_firstFreeOffset);
+ RELEASE_ASSERT(m_firstFreeOffset);
}
- ASSERT(m_firstFreeOffset != s_unusedID);
-
// entropyBits must not be zero. This ensures that if a corrupted
// structureID is encountered (with incorrect entropyBits), the decoded
// structure pointer for that ID will be always be a bad pointer with
Modified: releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/runtime/StructureIDTable.h (242470 => 242471)
--- releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/runtime/StructureIDTable.h 2019-03-05 17:20:51 UTC (rev 242470)
+++ releases/WebKitGTK/webkit-2.24/Source/_javascript_Core/runtime/StructureIDTable.h 2019-03-05 17:20:55 UTC (rev 242471)
@@ -131,6 +131,25 @@
static constexpr StructureID s_unusedID = 0;
public:
+ // 1. StructureID is encoded as:
+ //
+ // ----------------------------------------------------------------
+ // | 1 Nuke Bit | 24 StructureIDTable index bits | 7 entropy bits |
+ // ----------------------------------------------------------------
+ //
+ // The entropy bits are chosen at random and assigned when a StructureID
+ // is allocated.
+ //
+ // 2. For each StructureID, the StructureIDTable stores encodedStructureBits
+ // which are encoded from the structure pointer as such:
+ //
+ // ----------------------------------------------------------------
+ // | 7 entropy bits | 57 structure pointer bits |
+ // ----------------------------------------------------------------
+ //
+ // The entropy bits here are the same 7 bits used in the encoding of the
+ // StructureID for this structure entry in the StructureIDTable.
+
static constexpr uint32_t s_numberOfNukeBits = 1;
static constexpr uint32_t s_numberOfEntropyBits = 7;
static constexpr uint32_t s_entropyBitsShiftForStructurePointer = (sizeof(intptr_t) * 8) - s_numberOfEntropyBits;
@@ -140,12 +159,12 @@
ALWAYS_INLINE Structure* StructureIDTable::decode(EncodedStructureBits bits, StructureID structureID)
{
- return reinterpret_cast<Structure*>(bits ^ (static_cast<uintptr_t>(structureID) << s_entropyBitsShiftForStructurePointer));
+ return bitwise_cast<Structure*>(bits ^ (static_cast<uintptr_t>(structureID) << s_entropyBitsShiftForStructurePointer));
}
ALWAYS_INLINE EncodedStructureBits StructureIDTable::encode(Structure* structure, StructureID structureID)
{
- return reinterpret_cast<EncodedStructureBits>(structure) ^ (static_cast<EncodedStructureBits>(structureID) << s_entropyBitsShiftForStructurePointer);
+ return bitwise_cast<EncodedStructureBits>(structure) ^ (static_cast<EncodedStructureBits>(structureID) << s_entropyBitsShiftForStructurePointer);
}
inline Structure* StructureIDTable::get(StructureID structureID)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes