mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Split up Heap.h to Cell.h and 903519 - Change Relocated marker to not confuse string vs object bit, RelocationOverlay.h aspect.
Split up Heap.h to Cell.h and 903519 - Change Relocated marker to not confuse string vs object bit, RelocationOverlay.h aspect.
This commit is contained in:
parent
d8d6e3aa8a
commit
762d129624
3 changed files with 25 additions and 10 deletions
|
|
@ -420,7 +420,8 @@ static MOZ_ALWAYS_INLINE void
|
|||
AssertValidToSkipBarrier(TenuredCell* thing)
|
||||
{
|
||||
MOZ_ASSERT(!IsInsideNursery(thing));
|
||||
MOZ_ASSERT_IF(thing, MapAllocToTraceKind(thing->getAllocKind()) != JS::TraceKind::Object);
|
||||
MOZ_ASSERT_IF(thing, MapAllocToTraceKind(thing->getAllocKind()) != JS::TraceKind::Object &&
|
||||
MapAllocToTraceKind(thing->getAllocKind()) != JS::TraceKind::String);
|
||||
}
|
||||
|
||||
/* static */ MOZ_ALWAYS_INLINE void
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "js/HeapAPI.h"
|
||||
#include "vm/Shape.h"
|
||||
#include "jsobj.h"
|
||||
namespace js {
|
||||
namespace gc {
|
||||
|
||||
|
|
@ -26,11 +29,22 @@ struct Cell;
|
|||
*/
|
||||
class RelocationOverlay
|
||||
{
|
||||
/* The low bit is set so this should never equal a normal pointer. */
|
||||
static const uintptr_t Relocated = uintptr_t(0xbad0bad1);
|
||||
/* See comment in js/public/HeapAPI.h. */
|
||||
static const uint32_t Relocated = js::gc::Relocated;
|
||||
|
||||
#if MOZ_LITTLE_ENDIAN
|
||||
/*
|
||||
* Keep the low 32 bits untouched. Use them to distinguish strings from
|
||||
* objects in the nursery.
|
||||
*/
|
||||
uint32_t preserve_;
|
||||
|
||||
/* Set to Relocated when moved. */
|
||||
uintptr_t magic_;
|
||||
uint32_t magic_;
|
||||
#else
|
||||
uint32_t magic_;
|
||||
uint32_t preserve_;
|
||||
#endif
|
||||
|
||||
/* The location |this| was moved to. */
|
||||
Cell* newLocation_;
|
||||
|
|
@ -39,16 +53,15 @@ class RelocationOverlay
|
|||
RelocationOverlay* next_;
|
||||
|
||||
public:
|
||||
static const RelocationOverlay* fromCell(const Cell* cell) {
|
||||
return reinterpret_cast<const RelocationOverlay*>(cell);
|
||||
}
|
||||
static RelocationOverlay* fromCell(Cell* cell) {
|
||||
return reinterpret_cast<RelocationOverlay*>(cell);
|
||||
}
|
||||
|
||||
// ADD THIS: Const-friendly version
|
||||
static const RelocationOverlay* fromCell(const Cell* cell) {
|
||||
return reinterpret_cast<const RelocationOverlay*>(cell);
|
||||
}
|
||||
|
||||
bool isForwarded() const {
|
||||
(void) preserve_; // Suppress warning
|
||||
return magic_ == Relocated;
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +82,7 @@ class RelocationOverlay
|
|||
return next_;
|
||||
}
|
||||
|
||||
static bool isCellForwarded(Cell* cell) {
|
||||
static bool isCellForwarded(const Cell* cell) {
|
||||
return fromCell(cell)->isForwarded();
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "gc/Cell.h"
|
||||
#include "gc/Heap.h"
|
||||
#include "gc/Cell.h"
|
||||
|
||||
namespace js {
|
||||
namespace gc {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue