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/. */ 6 7 #ifndef vm_ObjectFlags_h 8 #define vm_ObjectFlags_h 9 10 #include "util/EnumFlags.h" // js::EnumFlags 11 12 namespace js { 13 14 // Flags set on the Shape which describe the referring object. Once set these 15 // cannot be unset (except during object densification of sparse indexes), and 16 // are transferred from shape to shape as the object's last property changes. 17 // 18 // If you add a new flag here, please add appropriate code to JSObject::dump to 19 // dump it as part of the object representation. 20 enum class ObjectFlag : uint16_t { 21 IsUsedAsPrototype = 1 << 0, 22 NotExtensible = 1 << 1, 23 Indexed = 1 << 2, 24 HasInterestingSymbol = 1 << 3, 25 26 // If set, the shape's property map may contain an enumerable property. This 27 // only accounts for (own) shape properties: if the flag is not set, the 28 // object may still have (enumerable) dense elements, typed array elements, or 29 // a JSClass enumeration hook. 30 HasEnumerable = 1 << 4, 31 32 FrozenElements = 1 << 5, // See ObjectElements::FROZEN comment. 33 34 // If set, the shape teleporting optimization can no longer be used for 35 // accessing properties on this object. 36 // See: JSObject::hasInvalidatedTeleporting, ProtoChainSupportsTeleporting. 37 InvalidatedTeleporting = 1 << 6, 38 39 ImmutablePrototype = 1 << 7, 40 41 // See JSObject::isQualifiedVarObj(). 42 QualifiedVarObj = 1 << 8, 43 44 // If set, the object may have a non-writable property or an accessor 45 // property. 46 // 47 // * This is only set for PlainObjects because we only need it for these 48 // objects and setting it for other objects confuses insertInitialShape. 49 // 50 // * This flag does not account for properties named "__proto__". This is 51 // because |Object.prototype| has a "__proto__" accessor property and we 52 // don't want to include it because it would result in the flag being set on 53 // most proto chains. Code using this flag must check for "__proto__" 54 // property names separately. 55 HasNonWritableOrAccessorPropExclProto = 1 << 9, 56 57 // If set, the object either mutated or deleted an accessor property. This is 58 // used to invalidate IC/Warp code specializing on specific getter/setter 59 // objects. See also the SMDOC comment in vm/GetterSetter.h. 60 HadGetterSetterChange = 1 << 10, 61 62 // If set, invoke the watchtower testing callback for changes to this object. 63 UseWatchtowerTestingCallback = 1 << 11, 64 }; 65 66 using ObjectFlags = EnumFlags<ObjectFlag>; 67 68 } // namespace js 69 70 #endif /* vm_ObjectFlags_h */ 71