Various fixes.

Various fixes. INIT_ROPE_FLAGS does not exist in this time of js engine, unsure why it was added. String.h fix  closure. Don't comment out new code in Barrier.h. Mir.h change back to MAryInstruction<4>, since MQuaternaryInstruction does not work and calls MAryInstruction<4> anyway. Note this likely need  parts of 1412912  hopefully solve failing static asserts.
This commit is contained in:
win7-7 2026-01-04 19:07:01 +02:00 committed by wuggy
commit 44bd6d9e6b
3 changed files with 24 additions and 10 deletions

View file

@ -215,9 +215,11 @@ RelocationOverlay::forwardTo(Cell* cell)
MOZ_ASSERT(!isForwarded());
// The location of magic_ is important because it must never be valid to see
// the value Relocated there in a GC thing that has not been moved.
static_assert(offsetof(RelocationOverlay, magic_) == offsetof(JSObject, group_) &&
offsetof(RelocationOverlay, magic_) == offsetof(js::Shape, base_) &&
offsetof(RelocationOverlay, magic_) == offsetof(JSString, d.u1.flags),
static_assert(offsetof(RelocationOverlay, magic_) == offsetof(JSObject, group_) + sizeof(uint32_t),
"RelocationOverlay::magic_ is in the wrong location");
static_assert(offsetof(RelocationOverlay, magic_) == offsetof(js::Shape, base_) + sizeof(uint32_t),
"RelocationOverlay::magic_ is in the wrong location");
static_assert(offsetof(RelocationOverlay, magic_) == offsetof(JSString, d.u1.length),
"RelocationOverlay::magic_ is in the wrong location");
magic_ = Relocated;
newLocation_ = cell;

View file

@ -587,7 +587,7 @@ struct String
{
static const uint32_t INLINE_CHARS_BIT = JS_BIT(2);
static const uint32_t LATIN1_CHARS_BIT = JS_BIT(6);
static const uint32_t ROPE_FLAGS = 0;
static const uint32_t ROPE_FLAGS = NON_ATOM_BIT;
static const uint32_t TYPE_FLAGS_MASK = JS_BIT(6) - 1;
uint32_t flags;
uint32_t length;

View file

@ -251,11 +251,11 @@ class JSString : public js::gc::TenuredCell
static const uint32_t INLINE_CHARS_BIT = JS_BIT(2);
static const uint32_t ATOM_BIT = JS_BIT(3);
static const uint32_t ROPE_FLAGS = 0;
static const uint32_t DEPENDENT_FLAGS = HAS_BASE_BIT;
static const uint32_t UNDEPENDED_FLAGS = FLAT_BIT | HAS_BASE_BIT;
static const uint32_t EXTENSIBLE_FLAGS = FLAT_BIT | JS_BIT(4);
static const uint32_t EXTERNAL_FLAGS = JS_BIT(5);
static const uint32_t ROPE_FLAGS = NON_ATOM_BIT;
static const uint32_t DEPENDENT_FLAGS = NON_ATOM_BIT | HAS_BASE_BIT;
static const uint32_t UNDEPENDED_FLAGS = NON_ATOM_BIT | FLAT_BIT | HAS_BASE_BIT;
static const uint32_t EXTENSIBLE_FLAGS = NON_ATOM_BIT | FLAT_BIT | JS_BIT(4);
static const uint32_t EXTERNAL_FLAGS = NON_ATOM_BIT | JS_BIT(5);
static const uint32_t FAT_INLINE_MASK = INLINE_CHARS_BIT | JS_BIT(4);
static const uint32_t PERMANENT_ATOM_MASK = ATOM_BIT | JS_BIT(5);
@ -506,11 +506,12 @@ class JSString : public js::gc::TenuredCell
static const JS::TraceKind TraceKind = JS::TraceKind::String;
JS::Zone* zone() const {
if (isTenured()) {
if (isTenured()) {
// Allow permanent atoms to be accessed across zones and runtimes.
if (isPermanentAtom())
return zoneFromAnyThread();
return asTenured().zone();
}
return js::Nursery::getStringZone(this);
}
@ -1588,4 +1589,15 @@ JSAtom::asPropertyName()
return static_cast<js::PropertyName*>(this);
}
namespace js {
namespace gc {
template<>
inline JSString*
Cell::as<JSString>() {
MOZ_ASSERT(is<JSString>());
return reinterpret_cast<JSString*>(this);
}
}
}
#endif /* vm_String_h */