Bug 1865597 - Add error checking when initializing parallel marking and disable on...
[gecko.git] / js / src / vm / ObjectFlags.h
blob5a24ec31c58082cbf5839cee9e9b5ef730ab844b
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef vm_ObjectFlags_h
8 #define vm_ObjectFlags_h
10 #include <stdint.h>
12 #include "util/EnumFlags.h" // js::EnumFlags
14 namespace js {
16 // Flags set on the Shape which describe the referring object. Once set these
17 // cannot be unset (except during object densification of sparse indexes), and
18 // are transferred from shape to shape as the object's last property changes.
20 // If you add a new flag here, please add appropriate code to JSObject::dump to
21 // dump it as part of the object representation.
22 enum class ObjectFlag : uint16_t {
23 IsUsedAsPrototype = 1 << 0,
24 NotExtensible = 1 << 1,
25 Indexed = 1 << 2,
26 HasInterestingSymbol = 1 << 3,
28 // If set, the shape's property map may contain an enumerable property. This
29 // only accounts for (own) shape properties: if the flag is not set, the
30 // object may still have (enumerable) dense elements, typed array elements, or
31 // a JSClass enumeration hook.
32 HasEnumerable = 1 << 4,
34 FrozenElements = 1 << 5, // See ObjectElements::FROZEN comment.
36 // If set, the shape teleporting optimization can no longer be used for
37 // accessing properties on this object.
38 // See: JSObject::hasInvalidatedTeleporting, ProtoChainSupportsTeleporting.
39 InvalidatedTeleporting = 1 << 6,
41 ImmutablePrototype = 1 << 7,
43 // See JSObject::isQualifiedVarObj().
44 QualifiedVarObj = 1 << 8,
46 // If set, the object may have a non-writable property or an accessor
47 // property.
49 // * This is only set for PlainObjects because we only need it for these
50 // objects and setting it for other objects confuses insertInitialShape.
52 // * This flag does not account for properties named "__proto__". This is
53 // because |Object.prototype| has a "__proto__" accessor property and we
54 // don't want to include it because it would result in the flag being set on
55 // most proto chains. Code using this flag must check for "__proto__"
56 // property names separately.
57 HasNonWritableOrAccessorPropExclProto = 1 << 9,
59 // If set, the object either mutated or deleted an accessor property. This is
60 // used to invalidate IC/Warp code specializing on specific getter/setter
61 // objects. See also the SMDOC comment in vm/GetterSetter.h.
62 HadGetterSetterChange = 1 << 10,
64 // If set, use the watchtower testing mechanism to log changes to this object.
65 UseWatchtowerTestingLog = 1 << 11,
67 // If set, access to existing properties of this global object can be guarded
68 // based on a per-global counter that is incremented when the global object
69 // has its properties reordered/shadowed, instead of a shape guard.
70 GenerationCountedGlobal = 1 << 12,
72 // If set, we need to verify the result of a proxy get/set trap.
74 // The [[Get]] and [[Set]] traps for proxy objects enforce certain invariants
75 // for non-configurable, non-writable data properties and non-configurable
76 // accessors. If the invariants are not maintained, we must throw a type
77 // error. If this flag is not set, and this is a NativeObject, *and* the
78 // class does not have a resolve hook, then this object does not have any
79 // such properties, and we can skip the slow check.
81 // See
82 // https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots
83 NeedsProxyGetSetResultValidation = 1 << 13
86 using ObjectFlags = EnumFlags<ObjectFlag>;
88 } // namespace js
90 #endif /* vm_ObjectFlags_h */