-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
firefox: avoid using the highest byte of pointer
- Loading branch information
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
https://github.com/termux/termux-packages/issues/22907 | ||
|
||
--- a/layout/generic/IntrinsicISizesCache.h | ||
+++ b/layout/generic/IntrinsicISizesCache.h | ||
@@ -131,25 +131,14 @@ | ||
}; | ||
|
||
// If the high bit of mOutOfLine is 1, then it points to an OutOfLineCache. | ||
+ bool mIsOutOfLine = false; | ||
union { | ||
InlineCache mInline; | ||
- struct { | ||
-#ifndef HAVE_64BIT_BUILD | ||
- uintptr_t mPadding = 0; | ||
-#endif | ||
- uintptr_t mOutOfLine = 0; | ||
- }; | ||
+ uintptr_t mOutOfLine = 0; | ||
}; | ||
|
||
- static constexpr uintptr_t kHighBit = uintptr_t(1) | ||
- << (sizeof(void*) * CHAR_BIT - 1); | ||
- | ||
bool IsOutOfLine() const { | ||
-#ifdef HAVE_64BIT_BUILD | ||
- return mOutOfLine & kHighBit; | ||
-#else | ||
- return mPadding & kHighBit; | ||
-#endif | ||
+ return mIsOutOfLine; | ||
} | ||
bool IsInline() const { return !IsOutOfLine(); } | ||
OutOfLineCache* EnsureOutOfLine() { | ||
@@ -159,13 +148,8 @@ | ||
auto inlineCache = mInline; | ||
auto* ool = new OutOfLineCache(); | ||
ool->mCacheWithoutPercentageBasis = inlineCache; | ||
-#ifdef HAVE_64BIT_BUILD | ||
- MOZ_ASSERT((reinterpret_cast<uintptr_t>(ool) & kHighBit) == 0); | ||
- mOutOfLine = reinterpret_cast<uintptr_t>(ool) | kHighBit; | ||
-#else | ||
mOutOfLine = reinterpret_cast<uintptr_t>(ool); | ||
- mPadding = kHighBit; | ||
-#endif | ||
+ mIsOutOfLine = true; | ||
MOZ_ASSERT(IsOutOfLine()); | ||
return ool; | ||
} | ||
@@ -174,16 +158,10 @@ | ||
if (!IsOutOfLine()) { | ||
return nullptr; | ||
} | ||
-#ifdef HAVE_64BIT_BUILD | ||
- return reinterpret_cast<OutOfLineCache*>(mOutOfLine & ~kHighBit); | ||
-#else | ||
return reinterpret_cast<OutOfLineCache*>(mOutOfLine); | ||
-#endif | ||
} | ||
}; | ||
|
||
-static_assert(sizeof(IntrinsicISizesCache) == 8, "Unexpected cache size"); | ||
- | ||
} // namespace mozilla | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters