mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1781074 - Remove Value::isNurseryAllocatableGCThing, use isGCThing instead. r=jonco
Most of the GC things typically stored in a `JS::Value` can be nursery allocated now, so using `isGCThing` should result in more compact code with fewer branches. Barriers in JIT code are already doing something similar since bug 1636916. Differential Revision: https://phabricator.services.mozilla.com/D152651
This commit is contained in:
parent
b5a9365200
commit
7a3e8cacb7
@ -723,10 +723,6 @@ class alignas(8) Value {
|
||||
#endif
|
||||
}
|
||||
|
||||
bool isNurseryAllocatableGCThing() const {
|
||||
return hasObjectPayload() || isString() || isBigInt();
|
||||
}
|
||||
|
||||
bool isBoolean() const { return toTag() == JSVAL_TAG_BOOLEAN; }
|
||||
|
||||
bool isTrue() const {
|
||||
|
@ -374,22 +374,19 @@ struct InternalBarrierMethods<Value> {
|
||||
|
||||
// If the target needs an entry, add it.
|
||||
js::gc::StoreBuffer* sb;
|
||||
if (next.isNurseryAllocatableGCThing() &&
|
||||
(sb = next.toGCThing()->storeBuffer())) {
|
||||
if (next.isGCThing() && (sb = next.toGCThing()->storeBuffer())) {
|
||||
// If we know that the prev has already inserted an entry, we can
|
||||
// skip doing the lookup to add the new entry. Note that we cannot
|
||||
// safely assert the presence of the entry because it may have been
|
||||
// added via a different store buffer.
|
||||
if (prev.isNurseryAllocatableGCThing() &&
|
||||
prev.toGCThing()->storeBuffer()) {
|
||||
if (prev.isGCThing() && prev.toGCThing()->storeBuffer()) {
|
||||
return;
|
||||
}
|
||||
sb->putValue(vp);
|
||||
return;
|
||||
}
|
||||
// Remove the prev entry if the new value does not need it.
|
||||
if (prev.isNurseryAllocatableGCThing() &&
|
||||
(sb = prev.toGCThing()->storeBuffer())) {
|
||||
if (prev.isGCThing() && (sb = prev.toGCThing()->storeBuffer())) {
|
||||
sb->unputValue(vp);
|
||||
}
|
||||
}
|
||||
@ -999,7 +996,7 @@ class HeapSlot : public WriteBarriered<Value> {
|
||||
#ifdef DEBUG
|
||||
assertPreconditionForPostWriteBarrier(owner, kind, slot, target);
|
||||
#endif
|
||||
if (this->value.isNurseryAllocatableGCThing()) {
|
||||
if (this->value.isGCThing()) {
|
||||
gc::Cell* cell = this->value.toGCThing();
|
||||
if (cell->storeBuffer()) {
|
||||
cell->storeBuffer()->putSlot(owner, kind, slot, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user