mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-06 23:37:31 +09:00
Simplify HeapSlot to make it trivially copyable
This removes the constructors, which were never called since we allocate arrays of HeapSlot with pod_malloc. The destructor is only ever called explicitly since we free this memory with js_free so it has been renamed to destroy(). Also removed is an unused manual barrier.
This commit is contained in:
parent
413f205479
commit
4f91b109d0
2 changed files with 8 additions and 29 deletions
|
|
@ -667,29 +667,15 @@ class HeapSlot : public WriteBarrieredBase<Value>
|
|||
Element = 1
|
||||
};
|
||||
|
||||
explicit HeapSlot() = delete;
|
||||
|
||||
explicit HeapSlot(NativeObject* obj, Kind kind, uint32_t slot, const Value& v)
|
||||
: WriteBarrieredBase<Value>(v)
|
||||
{
|
||||
post(obj, kind, slot, v);
|
||||
}
|
||||
|
||||
explicit HeapSlot(NativeObject* obj, Kind kind, uint32_t slot, const HeapSlot& s)
|
||||
: WriteBarrieredBase<Value>(s.value)
|
||||
{
|
||||
post(obj, kind, slot, s);
|
||||
}
|
||||
|
||||
~HeapSlot() {
|
||||
pre();
|
||||
}
|
||||
|
||||
void init(NativeObject* owner, Kind kind, uint32_t slot, const Value& v) {
|
||||
value = v;
|
||||
post(owner, kind, slot, v);
|
||||
}
|
||||
|
||||
void destroy() {
|
||||
pre();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool preconditionForSet(NativeObject* owner, Kind kind, uint32_t slot) const;
|
||||
bool preconditionForWriteBarrierPost(NativeObject* obj, Kind kind, uint32_t slot,
|
||||
|
|
@ -703,11 +689,6 @@ class HeapSlot : public WriteBarrieredBase<Value>
|
|||
post(owner, kind, slot, v);
|
||||
}
|
||||
|
||||
/* For users who need to manually barrier the raw types. */
|
||||
static void writeBarrierPost(NativeObject* owner, Kind kind, uint32_t slot, const Value& target) {
|
||||
reinterpret_cast<HeapSlot*>(const_cast<Value*>(&target))->post(owner, kind, slot, target);
|
||||
}
|
||||
|
||||
private:
|
||||
void post(NativeObject* owner, Kind kind, uint32_t slot, const Value& target) {
|
||||
MOZ_ASSERT(preconditionForWriteBarrierPost(owner, kind, slot, target));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue