Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 962566d

Browse files
committed
Bug 1715512 part 5 - Add GetObjectFlagsForNewProperty overload that takes JSClass and ObjectFlags instead of shape. r=jonco
The overload taking a shape will be removed in a later patch. Differential Revision: https://phabricator.services.mozilla.com/D117305
1 parent fe0f6be commit 962566d

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

js/src/vm/ObjectFlags-inl.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616

1717
namespace js {
1818

19-
MOZ_ALWAYS_INLINE ObjectFlags GetObjectFlagsForNewProperty(
20-
Shape* last, jsid id, PropertyFlags propFlags, JSContext* cx) {
21-
ObjectFlags flags = last->objectFlags();
22-
19+
MOZ_ALWAYS_INLINE ObjectFlags
20+
GetObjectFlagsForNewProperty(const JSClass* clasp, ObjectFlags flags, jsid id,
21+
PropertyFlags propFlags, JSContext* cx) {
2322
uint32_t index;
2423
if (IdIsIndex(id, &index)) {
2524
flags.setFlag(ObjectFlag::Indexed);
@@ -28,14 +27,20 @@ MOZ_ALWAYS_INLINE ObjectFlags GetObjectFlagsForNewProperty(
2827
}
2928

3029
if ((!propFlags.isDataProperty() || !propFlags.writable()) &&
31-
last->getObjectClass() == &PlainObject::class_ &&
32-
!id.isAtom(cx->names().proto)) {
30+
clasp == &PlainObject::class_ && !id.isAtom(cx->names().proto)) {
3331
flags.setFlag(ObjectFlag::HasNonWritableOrAccessorPropExclProto);
3432
}
3533

3634
return flags;
3735
}
3836

37+
MOZ_ALWAYS_INLINE ObjectFlags GetObjectFlagsForNewProperty(
38+
Shape* last, jsid id, PropertyFlags propFlags, JSContext* cx) {
39+
ObjectFlags flags = last->objectFlags();
40+
const JSClass* clasp = last->getObjectClass();
41+
return GetObjectFlagsForNewProperty(clasp, flags, id, propFlags, cx);
42+
}
43+
3944
} // namespace js
4045

4146
#endif /* vm_ObjectFlags_inl_h */

0 commit comments

Comments
 (0)