Skip to content

Commit 246e2d7

Browse files
author
commit-queue@webkit.org
committed
Use reinterpret_cast_ptr in KeywordLookupGenerator, PropertyMapHashTable
https://bugs.webkit.org/show_bug.cgi?id=228819 Patch by Zan Dobersek <zdobersek@igalia.com> on 2021-08-05 Reviewed by Adrian Perez de Castro. Switch to using reinterpret_cast_ptr in KeywordLookupGenerator (which generates the KeywordLookup.h header) and PropertyMapHashTable, reducing a bit the GCC warning spewage when compiling for targets benefitting from the reinterpret_cast_ptr workaround. * KeywordLookupGenerator.py: * runtime/PropertyMapHashTable.h: (JSC::PropertyTable::table): (JSC::PropertyTable::table const): Canonical link: https://commits.webkit.org/240289@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280687 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 5ba5b44 commit 246e2d7

3 files changed

Lines changed: 26 additions & 6 deletions

File tree

Source/JavaScriptCore/ChangeLog

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
2021-08-05 Zan Dobersek <zdobersek@igalia.com>
2+
3+
Use reinterpret_cast_ptr in KeywordLookupGenerator, PropertyMapHashTable
4+
https://bugs.webkit.org/show_bug.cgi?id=228819
5+
6+
Reviewed by Adrian Perez de Castro.
7+
8+
Switch to using reinterpret_cast_ptr in KeywordLookupGenerator (which
9+
generates the KeywordLookup.h header) and PropertyMapHashTable, reducing
10+
a bit the GCC warning spewage when compiling for targets benefitting
11+
from the reinterpret_cast_ptr workaround.
12+
13+
* KeywordLookupGenerator.py:
14+
* runtime/PropertyMapHashTable.h:
15+
(JSC::PropertyTable::table):
16+
(JSC::PropertyTable::table const):
17+
118
2021-08-04 Yijia Huang <yijia_huang@apple.com>
219

320
[ARM64] Fix Zoom black screen during video meeting on Safari

Source/JavaScriptCore/KeywordLookupGenerator.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,8 @@ def printAsC(self):
219219
trie.fillOut()
220220
print("// This file was generated by KeywordLookupGenerator.py. Do not edit.")
221221
print("""
222+
#include <wtf/StdLibExtras.h>
223+
222224
#if CPU(NEEDS_ALIGNED_ACCESS)
223225
224226
#define COMPARE_2CHARS(address, char1, char2) \\
@@ -258,16 +260,16 @@ def printAsC(self):
258260
259261
260262
#define COMPARE_2CHARS(address, char1, char2) \\
261-
((reinterpret_cast<const uint16_t*>(address))[0] == CHARPAIR_TOUINT16(char1, char2))
263+
((reinterpret_cast_ptr<const uint16_t*>(address))[0] == CHARPAIR_TOUINT16(char1, char2))
262264
#define COMPARE_2UCHARS(address, char1, char2) \\
263-
((reinterpret_cast<const uint32_t*>(address))[0] == UCHARPAIR_TOUINT32(char1, char2))
265+
((reinterpret_cast_ptr<const uint32_t*>(address))[0] == UCHARPAIR_TOUINT32(char1, char2))
264266
265267
#if CPU(X86_64)
266268
267269
#define COMPARE_4CHARS(address, char1, char2, char3, char4) \\
268-
((reinterpret_cast<const uint32_t*>(address))[0] == CHARQUAD_TOUINT32(char1, char2, char3, char4))
270+
((reinterpret_cast_ptr<const uint32_t*>(address))[0] == CHARQUAD_TOUINT32(char1, char2, char3, char4))
269271
#define COMPARE_4UCHARS(address, char1, char2, char3, char4) \\
270-
((reinterpret_cast<const uint64_t*>(address))[0] == UCHARQUAD_TOUINT64(char1, char2, char3, char4))
272+
((reinterpret_cast_ptr<const uint64_t*>(address))[0] == UCHARQUAD_TOUINT64(char1, char2, char3, char4))
271273
272274
#else // CPU(X86_64)
273275

Source/JavaScriptCore/runtime/PropertyMapHashTable.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include "WriteBarrier.h"
2727
#include <wtf/HashTable.h>
2828
#include <wtf/MathExtras.h>
29+
#include <wtf/StdLibExtras.h>
2930
#include <wtf/Vector.h>
3031
#include <wtf/text/AtomStringImpl.h>
3132

@@ -548,13 +549,13 @@ inline T* PropertyTable::skipDeletedEntries(T* valuePtr, T* endValuePtr)
548549
inline PropertyTable::ValueType* PropertyTable::table()
549550
{
550551
// The table of values lies after the hash index.
551-
return reinterpret_cast<ValueType*>(m_index + m_indexSize);
552+
return reinterpret_cast_ptr<ValueType*>(m_index + m_indexSize);
552553
}
553554

554555
inline const PropertyTable::ValueType* PropertyTable::table() const
555556
{
556557
// The table of values lies after the hash index.
557-
return reinterpret_cast<const ValueType*>(m_index + m_indexSize);
558+
return reinterpret_cast_ptr<const ValueType*>(m_index + m_indexSize);
558559
}
559560

560561
inline unsigned PropertyTable::usedCount() const

0 commit comments

Comments
 (0)