зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1713285 part 4 - Rename ShapeProperty to PropertyInfo. r=evilpie
Depends on D116226 Differential Revision: https://phabricator.services.mozilla.com/D116227
This commit is contained in:
Родитель
9c8366f529
Коммит
62c26b1027
|
@ -636,7 +636,7 @@ bool js::ArraySetLength(JSContext* cx, Handle<ArrayObject*> arr, HandleId id,
|
|||
bool lengthIsWritable = arr->lengthIsWritable();
|
||||
#ifdef DEBUG
|
||||
{
|
||||
mozilla::Maybe<ShapeProperty> lengthProp = arr->lookupPure(id);
|
||||
mozilla::Maybe<PropertyInfo> lengthProp = arr->lookupPure(id);
|
||||
MOZ_ASSERT(lengthProp.isSome());
|
||||
MOZ_ASSERT(lengthProp->writable() == lengthIsWritable);
|
||||
}
|
||||
|
@ -825,7 +825,7 @@ bool js::ArraySetLength(JSContext* cx, Handle<ArrayObject*> arr, HandleId id,
|
|||
|
||||
// Step 20.
|
||||
if (desc.hasWritable() && !desc.writable()) {
|
||||
Maybe<ShapeProperty> lengthProp = arr->lookup(cx, id);
|
||||
Maybe<PropertyInfo> lengthProp = arr->lookup(cx, id);
|
||||
MOZ_ASSERT(lengthProp.isSome());
|
||||
MOZ_ASSERT(lengthProp->isCustomDataProperty());
|
||||
PropertyFlags flags = lengthProp->flags();
|
||||
|
@ -4051,7 +4051,7 @@ void js::ArraySpeciesLookup::initialize(JSContext* cx) {
|
|||
state_ = State::Disabled;
|
||||
|
||||
// Look up Array.prototype[@@iterator] and ensure it's a data property.
|
||||
Maybe<ShapeProperty> ctorProp =
|
||||
Maybe<PropertyInfo> ctorProp =
|
||||
arrayProto->lookup(cx, NameToId(cx->names().constructor));
|
||||
if (ctorProp.isNothing() || !ctorProp->isDataProperty()) {
|
||||
return;
|
||||
|
@ -4068,7 +4068,7 @@ void js::ArraySpeciesLookup::initialize(JSContext* cx) {
|
|||
}
|
||||
|
||||
// Look up the '@@species' value on Array
|
||||
Maybe<ShapeProperty> speciesProp =
|
||||
Maybe<PropertyInfo> speciesProp =
|
||||
arrayCtor->lookup(cx, SYMBOL_TO_JSID(cx->wellKnownSymbols().species));
|
||||
if (speciesProp.isNothing() || !arrayCtor->hasGetter(*speciesProp)) {
|
||||
return;
|
||||
|
|
|
@ -488,7 +488,7 @@ static bool JO(JSContext* cx, HandleObject obj, StringifyContext* scx) {
|
|||
return false;
|
||||
}
|
||||
MOZ_ASSERT(prop.isNativeProperty() &&
|
||||
prop.shapeProperty().isDataDescriptor());
|
||||
prop.propertyInfo().isDataDescriptor());
|
||||
}
|
||||
#endif // DEBUG
|
||||
if (!GetProperty(cx, obj, obj, id, &outputValue)) {
|
||||
|
|
|
@ -381,7 +381,7 @@ template <SetInitGetPrototypeOp getPrototypeOp, SetInitIsBuiltinOp isBuiltinOp>
|
|||
}
|
||||
|
||||
// Look up the 'add' value on the prototype object.
|
||||
mozilla::Maybe<ShapeProperty> addProp = setProto->lookup(cx, cx->names().add);
|
||||
mozilla::Maybe<PropertyInfo> addProp = setProto->lookup(cx, cx->names().add);
|
||||
if (addProp.isNothing() || !addProp->isDataProperty()) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -378,7 +378,7 @@ ModuleRequestObject* ModuleRequestObject::create(JSContext* cx,
|
|||
// IndirectBindingMap
|
||||
|
||||
IndirectBindingMap::Binding::Binding(ModuleEnvironmentObject* environment,
|
||||
jsid targetName, ShapeProperty prop)
|
||||
jsid targetName, PropertyInfo prop)
|
||||
: environment(environment),
|
||||
#ifdef DEBUG
|
||||
targetName(targetName),
|
||||
|
@ -414,7 +414,7 @@ bool IndirectBindingMap::put(JSContext* cx, HandleId name,
|
|||
map_.emplace(cx->zone());
|
||||
}
|
||||
|
||||
mozilla::Maybe<ShapeProperty> prop = environment->lookup(cx, targetName);
|
||||
mozilla::Maybe<PropertyInfo> prop = environment->lookup(cx, targetName);
|
||||
MOZ_ASSERT(prop.isSome());
|
||||
if (!map_->put(name, Binding(environment, targetName, *prop))) {
|
||||
ReportOutOfMemory(cx);
|
||||
|
@ -425,7 +425,7 @@ bool IndirectBindingMap::put(JSContext* cx, HandleId name,
|
|||
}
|
||||
|
||||
bool IndirectBindingMap::lookup(jsid name, ModuleEnvironmentObject** envOut,
|
||||
mozilla::Maybe<ShapeProperty>* propOut) const {
|
||||
mozilla::Maybe<PropertyInfo>* propOut) const {
|
||||
if (!map_) {
|
||||
return false;
|
||||
}
|
||||
|
@ -571,7 +571,7 @@ bool ModuleNamespaceObject::ProxyHandler::getOwnPropertyDescriptor(
|
|||
|
||||
const IndirectBindingMap& bindings = ns->bindings();
|
||||
ModuleEnvironmentObject* env;
|
||||
mozilla::Maybe<ShapeProperty> prop;
|
||||
mozilla::Maybe<PropertyInfo> prop;
|
||||
if (!bindings.lookup(id, &env, &prop)) {
|
||||
// Not found.
|
||||
desc.reset();
|
||||
|
@ -638,7 +638,7 @@ bool ModuleNamespaceObject::ProxyHandler::defineProperty(
|
|||
const IndirectBindingMap& bindings =
|
||||
proxy->as<ModuleNamespaceObject>().bindings();
|
||||
ModuleEnvironmentObject* env;
|
||||
mozilla::Maybe<ShapeProperty> prop;
|
||||
mozilla::Maybe<PropertyInfo> prop;
|
||||
if (!bindings.lookup(id, &env, &prop)) {
|
||||
return result.fail(JSMSG_CANT_DEFINE_PROP_OBJECT_NOT_EXTENSIBLE);
|
||||
}
|
||||
|
@ -679,7 +679,7 @@ bool ModuleNamespaceObject::ProxyHandler::get(JSContext* cx, HandleObject proxy,
|
|||
}
|
||||
|
||||
ModuleEnvironmentObject* env;
|
||||
mozilla::Maybe<ShapeProperty> prop;
|
||||
mozilla::Maybe<PropertyInfo> prop;
|
||||
if (!ns->bindings().lookup(id, &env, &prop)) {
|
||||
vp.setUndefined();
|
||||
return true;
|
||||
|
|
|
@ -177,7 +177,7 @@ class IndirectBindingMap {
|
|||
bool has(jsid name) const { return map_ ? map_->has(name) : false; }
|
||||
|
||||
bool lookup(jsid name, ModuleEnvironmentObject** envOut,
|
||||
mozilla::Maybe<ShapeProperty>* propOut) const;
|
||||
mozilla::Maybe<PropertyInfo>* propOut) const;
|
||||
|
||||
template <typename Func>
|
||||
void forEachExportedName(Func func) const {
|
||||
|
@ -193,12 +193,12 @@ class IndirectBindingMap {
|
|||
private:
|
||||
struct Binding {
|
||||
Binding(ModuleEnvironmentObject* environment, jsid targetName,
|
||||
ShapeProperty prop);
|
||||
PropertyInfo prop);
|
||||
HeapPtr<ModuleEnvironmentObject*> environment;
|
||||
#ifdef DEBUG
|
||||
HeapPtr<jsid> targetName;
|
||||
#endif
|
||||
ShapeProperty prop;
|
||||
PropertyInfo prop;
|
||||
};
|
||||
|
||||
using Map =
|
||||
|
|
|
@ -930,7 +930,7 @@ static bool CanAddNewPropertyExcludingProtoFast(PlainObject* obj) {
|
|||
nextKey = fromProp.key();
|
||||
propValue = fromPlain->getSlot(fromProp.slot());
|
||||
|
||||
Maybe<ShapeProperty> toProp;
|
||||
Maybe<PropertyInfo> toProp;
|
||||
if (toWasEmpty) {
|
||||
MOZ_ASSERT(!toPlain->containsPure(nextKey));
|
||||
MOZ_ASSERT(toProp.isNothing());
|
||||
|
@ -1724,7 +1724,7 @@ static bool EnumerableOwnProperties(JSContext* cx, const JS::CallArgs& args) {
|
|||
if (JSID_IS_INT(id) && nobj->containsDenseElement(JSID_TO_INT(id))) {
|
||||
value.set(nobj->getDenseElement(JSID_TO_INT(id)));
|
||||
} else {
|
||||
Maybe<ShapeProperty> prop = nobj->lookup(cx, id);
|
||||
Maybe<PropertyInfo> prop = nobj->lookup(cx, id);
|
||||
if (prop.isNothing() || !prop->enumerable()) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -4622,12 +4622,12 @@ class ShapeSnapshot {
|
|||
struct PropertySnapshot {
|
||||
HeapPtr<Shape*> propShape;
|
||||
HeapPtr<PropertyKey> key;
|
||||
ShapeProperty prop;
|
||||
PropertyInfo prop;
|
||||
|
||||
explicit PropertySnapshot(Shape* shape)
|
||||
: propShape(shape),
|
||||
key(shape->propertyWithKey().key()),
|
||||
prop(propShape->property()) {}
|
||||
key(propShape->propertyInfoWithKey().key()),
|
||||
prop(propShape->propertyInfo()) {}
|
||||
void trace(JSTracer* trc) {
|
||||
TraceEdge(trc, &propShape, "propShape");
|
||||
TraceEdge(trc, &key, "key");
|
||||
|
@ -4756,7 +4756,7 @@ void ShapeSnapshot::checkSelf(JSContext* cx) const {
|
|||
|
||||
for (const PropertySnapshot& propSnapshot : properties_) {
|
||||
Shape* propShape = propSnapshot.propShape;
|
||||
ShapeProperty prop = propSnapshot.prop;
|
||||
PropertyInfo prop = propSnapshot.prop;
|
||||
|
||||
// Skip if the Shape no longer matches the snapshotted data. This can
|
||||
// only happen for non-configurable dictionary properties.
|
||||
|
@ -4817,7 +4817,7 @@ void ShapeSnapshot::check(JSContext* cx, const ShapeSnapshot& later) const {
|
|||
MOZ_RELEASE_ASSERT(properties_[i] == later.properties_[i]);
|
||||
// Non-configurable accessor properties and non-configurable, non-writable
|
||||
// data properties shouldn't have had their slot mutated.
|
||||
ShapeProperty prop = properties_[i].prop;
|
||||
PropertyInfo prop = properties_[i].prop;
|
||||
if (!prop.configurable()) {
|
||||
if (prop.isAccessorProperty() ||
|
||||
(prop.isDataProperty() && !prop.writable())) {
|
||||
|
|
|
@ -2472,11 +2472,11 @@ bool DebuggerObject::forceLexicalInitializationByName(
|
|||
result = false;
|
||||
if (prop.isFound()) {
|
||||
MOZ_ASSERT(prop.isNativeProperty());
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
Value v = globalLexical->as<NativeObject>().getSlot(shapeProp.slot());
|
||||
if (shapeProp.isDataProperty() && v.isMagic() &&
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
Value v = globalLexical->as<NativeObject>().getSlot(propInfo.slot());
|
||||
if (propInfo.isDataProperty() && v.isMagic() &&
|
||||
v.whyMagic() == JS_UNINITIALIZED_LEXICAL) {
|
||||
globalLexical->as<NativeObject>().setSlot(shapeProp.slot(),
|
||||
globalLexical->as<NativeObject>().setSlot(propInfo.slot(),
|
||||
UndefinedValue());
|
||||
result = true;
|
||||
}
|
||||
|
|
|
@ -3749,7 +3749,7 @@ bool BaselineCompilerCodeGen::emit_GetImport() {
|
|||
|
||||
jsid id = NameToId(script->getName(handler.pc()));
|
||||
ModuleEnvironmentObject* targetEnv;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
MOZ_ALWAYS_TRUE(env->lookupImport(id, &targetEnv, &prop));
|
||||
|
||||
frame.syncStack(0);
|
||||
|
|
|
@ -238,7 +238,7 @@ GetPropIRGenerator::GetPropIRGenerator(JSContext* cx, HandleScript script,
|
|||
: IRGenerator(cx, script, pc, cacheKind, state), val_(val), idVal_(idVal) {}
|
||||
|
||||
static void EmitLoadSlotResult(CacheIRWriter& writer, ObjOperandId holderId,
|
||||
NativeObject* holder, ShapeProperty prop) {
|
||||
NativeObject* holder, PropertyInfo prop) {
|
||||
if (holder->isFixedSlot(prop.slot())) {
|
||||
writer.loadFixedSlotResult(holderId,
|
||||
NativeObject::getFixedSlotOffset(prop.slot()));
|
||||
|
@ -461,7 +461,7 @@ static bool IsCacheableProtoChain(NativeObject* obj, NativeObject* holder) {
|
|||
#endif
|
||||
|
||||
static bool IsCacheableGetPropReadSlot(NativeObject* obj, NativeObject* holder,
|
||||
ShapeProperty prop) {
|
||||
PropertyInfo prop) {
|
||||
MOZ_ASSERT(IsCacheableProtoChain(obj, holder));
|
||||
|
||||
return prop.isDataProperty();
|
||||
|
@ -476,7 +476,7 @@ enum NativeGetPropCacheability {
|
|||
|
||||
static NativeGetPropCacheability IsCacheableGetPropCall(NativeObject* obj,
|
||||
NativeObject* holder,
|
||||
ShapeProperty prop) {
|
||||
PropertyInfo prop) {
|
||||
MOZ_ASSERT(IsCacheableProtoChain(obj, holder));
|
||||
|
||||
if (!prop.isAccessorProperty()) {
|
||||
|
@ -556,7 +556,7 @@ static bool IsCacheableNoProperty(JSContext* cx, NativeObject* obj,
|
|||
|
||||
static NativeGetPropCacheability CanAttachNativeGetProp(
|
||||
JSContext* cx, JSObject* obj, PropertyKey id, NativeObject** holder,
|
||||
Maybe<ShapeProperty>* shapeProp, jsbytecode* pc) {
|
||||
Maybe<PropertyInfo>* propInfo, jsbytecode* pc) {
|
||||
MOZ_ASSERT(JSID_IS_STRING(id) || JSID_IS_SYMBOL(id));
|
||||
MOZ_ASSERT(!*holder);
|
||||
|
||||
|
@ -574,13 +574,13 @@ static NativeGetPropCacheability CanAttachNativeGetProp(
|
|||
if (prop.isNativeProperty()) {
|
||||
MOZ_ASSERT(baseHolder);
|
||||
*holder = baseHolder;
|
||||
*shapeProp = mozilla::Some(prop.shapeProperty());
|
||||
*propInfo = mozilla::Some(prop.propertyInfo());
|
||||
|
||||
if (IsCacheableGetPropReadSlot(nobj, *holder, shapeProp->ref())) {
|
||||
if (IsCacheableGetPropReadSlot(nobj, *holder, propInfo->ref())) {
|
||||
return CanAttachReadSlot;
|
||||
}
|
||||
|
||||
return IsCacheableGetPropCall(nobj, *holder, shapeProp->ref());
|
||||
return IsCacheableGetPropCall(nobj, *holder, propInfo->ref());
|
||||
}
|
||||
|
||||
if (!prop.isFound()) {
|
||||
|
@ -831,7 +831,7 @@ static void EmitReadSlotGuard(CacheIRWriter& writer, NativeObject* obj,
|
|||
|
||||
template <SlotReadType MaybeCrossCompartment = SlotReadType::Normal>
|
||||
static void EmitReadSlotResult(CacheIRWriter& writer, NativeObject* obj,
|
||||
NativeObject* holder, Maybe<ShapeProperty> prop,
|
||||
NativeObject* holder, Maybe<PropertyInfo> prop,
|
||||
ObjOperandId objId) {
|
||||
Maybe<ObjOperandId> holderId;
|
||||
EmitReadSlotGuard<MaybeCrossCompartment>(writer, obj, holder, objId,
|
||||
|
@ -850,7 +850,7 @@ static void EmitReadSlotResult(CacheIRWriter& writer, NativeObject* obj,
|
|||
static void EmitCallGetterResultNoGuards(JSContext* cx, CacheIRWriter& writer,
|
||||
NativeObject* obj,
|
||||
NativeObject* holder,
|
||||
ShapeProperty prop,
|
||||
PropertyInfo prop,
|
||||
ValOperandId receiverId) {
|
||||
JSFunction* target = &holder->getGetter(prop)->as<JSFunction>();
|
||||
bool sameRealm = cx->realm() == target->realm();
|
||||
|
@ -877,7 +877,7 @@ static void EmitCallGetterResultNoGuards(JSContext* cx, CacheIRWriter& writer,
|
|||
// See the SMDOC comment in vm/GetterSetter.h for more info on Getter/Setter
|
||||
// properties
|
||||
static void EmitGuardGetterSetterSlot(CacheIRWriter& writer,
|
||||
NativeObject* holder, ShapeProperty prop,
|
||||
NativeObject* holder, PropertyInfo prop,
|
||||
ObjOperandId holderId,
|
||||
bool holderIsConstant = false) {
|
||||
// If the holder is guaranteed to be the same object, and it never had a
|
||||
|
@ -902,7 +902,7 @@ static void EmitGuardGetterSetterSlot(CacheIRWriter& writer,
|
|||
|
||||
static void EmitCallGetterResultGuards(CacheIRWriter& writer, NativeObject* obj,
|
||||
NativeObject* holder, HandleId id,
|
||||
ShapeProperty prop, ObjOperandId objId,
|
||||
PropertyInfo prop, ObjOperandId objId,
|
||||
ICState::Mode mode) {
|
||||
// Use the megamorphic guard if we're in megamorphic mode, except if |obj|
|
||||
// is a Window as GuardHasGetterSetter doesn't support this yet (Window may
|
||||
|
@ -933,7 +933,7 @@ static void EmitCallGetterResultGuards(CacheIRWriter& writer, NativeObject* obj,
|
|||
|
||||
static void EmitCallGetterResult(JSContext* cx, CacheIRWriter& writer,
|
||||
NativeObject* obj, NativeObject* holder,
|
||||
HandleId id, ShapeProperty prop,
|
||||
HandleId id, PropertyInfo prop,
|
||||
ObjOperandId objId, ValOperandId receiverId,
|
||||
ICState::Mode mode) {
|
||||
EmitCallGetterResultGuards(writer, obj, holder, id, prop, objId, mode);
|
||||
|
@ -983,7 +983,7 @@ static bool CanAttachDOMCall(JSContext* cx, JSJitInfo::OpType type,
|
|||
|
||||
static bool CanAttachDOMGetterSetter(JSContext* cx, JSJitInfo::OpType type,
|
||||
NativeObject* obj, NativeObject* holder,
|
||||
ShapeProperty prop, ICState::Mode mode) {
|
||||
PropertyInfo prop, ICState::Mode mode) {
|
||||
MOZ_ASSERT(type == JSJitInfo::Getter || type == JSJitInfo::Setter);
|
||||
|
||||
JSObject* accessor = type == JSJitInfo::Getter ? holder->getGetter(prop)
|
||||
|
@ -995,7 +995,7 @@ static bool CanAttachDOMGetterSetter(JSContext* cx, JSJitInfo::OpType type,
|
|||
|
||||
static void EmitCallDOMGetterResultNoGuards(CacheIRWriter& writer,
|
||||
NativeObject* holder,
|
||||
ShapeProperty prop,
|
||||
PropertyInfo prop,
|
||||
ObjOperandId objId) {
|
||||
JSFunction* getter = &holder->getGetter(prop)->as<JSFunction>();
|
||||
writer.callDOMGetterResult(objId, getter->jitInfo());
|
||||
|
@ -1004,7 +1004,7 @@ static void EmitCallDOMGetterResultNoGuards(CacheIRWriter& writer,
|
|||
|
||||
static void EmitCallDOMGetterResult(JSContext* cx, CacheIRWriter& writer,
|
||||
NativeObject* obj, NativeObject* holder,
|
||||
HandleId id, ShapeProperty prop,
|
||||
HandleId id, PropertyInfo prop,
|
||||
ObjOperandId objId) {
|
||||
// Note: this relies on EmitCallGetterResultGuards emitting a shape guard
|
||||
// for specialized stubs.
|
||||
|
@ -1035,7 +1035,7 @@ AttachDecision GetPropIRGenerator::tryAttachNative(HandleObject obj,
|
|||
ObjOperandId objId,
|
||||
HandleId id,
|
||||
ValOperandId receiverId) {
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
NativeObject* holder = nullptr;
|
||||
|
||||
NativeGetPropCacheability type =
|
||||
|
@ -1142,7 +1142,7 @@ AttachDecision GetPropIRGenerator::tryAttachWindowProxy(HandleObject obj,
|
|||
// Now try to do the lookup on the Window (the current global).
|
||||
GlobalObject* windowObj = cx_->global();
|
||||
NativeObject* holder = nullptr;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
NativeGetPropCacheability type =
|
||||
CanAttachNativeGetProp(cx_, windowObj, id, &holder, &prop, pc_);
|
||||
switch (type) {
|
||||
|
@ -1238,7 +1238,7 @@ AttachDecision GetPropIRGenerator::tryAttachCrossCompartmentWrapper(
|
|||
}
|
||||
|
||||
NativeObject* holder = nullptr;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
|
||||
// Enter realm of target to prevent failing compartment assertions when doing
|
||||
// the lookup.
|
||||
|
@ -1504,7 +1504,7 @@ AttachDecision GetPropIRGenerator::tryAttachDOMProxyExpando(
|
|||
|
||||
// Try to do the lookup on the expando object.
|
||||
NativeObject* holder = nullptr;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
NativeGetPropCacheability canCache =
|
||||
CanAttachNativeGetProp(cx_, expandoObj, id, &holder, &prop, pc_);
|
||||
if (canCache == CanAttachNone) {
|
||||
|
@ -1600,7 +1600,7 @@ AttachDecision GetPropIRGenerator::tryAttachDOMProxyUnshadowed(
|
|||
}
|
||||
|
||||
NativeObject* holder = nullptr;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
NativeGetPropCacheability canCache =
|
||||
CanAttachNativeGetProp(cx_, checkObj, id, &holder, &prop, pc_);
|
||||
if (canCache == CanAttachNone) {
|
||||
|
@ -1754,7 +1754,7 @@ AttachDecision GetPropIRGenerator::tryAttachTypedArray(HandleObject obj,
|
|||
}
|
||||
|
||||
NativeObject* holder = nullptr;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
NativeGetPropCacheability type =
|
||||
CanAttachNativeGetProp(cx_, obj, id, &holder, &prop, pc_);
|
||||
if (type != CanAttachNativeGetter) {
|
||||
|
@ -1837,7 +1837,7 @@ AttachDecision GetPropIRGenerator::tryAttachDataView(HandleObject obj,
|
|||
}
|
||||
|
||||
NativeObject* holder = nullptr;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
NativeGetPropCacheability type =
|
||||
CanAttachNativeGetProp(cx_, obj, id, &holder, &prop, pc_);
|
||||
if (type != CanAttachNativeGetter) {
|
||||
|
@ -1901,7 +1901,7 @@ AttachDecision GetPropIRGenerator::tryAttachArrayBufferMaybeShared(
|
|||
}
|
||||
|
||||
NativeObject* holder = nullptr;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
NativeGetPropCacheability type =
|
||||
CanAttachNativeGetProp(cx_, obj, id, &holder, &prop, pc_);
|
||||
if (type != CanAttachNativeGetter) {
|
||||
|
@ -1952,7 +1952,7 @@ AttachDecision GetPropIRGenerator::tryAttachRegExp(HandleObject obj,
|
|||
}
|
||||
|
||||
NativeObject* holder = nullptr;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
NativeGetPropCacheability type =
|
||||
CanAttachNativeGetProp(cx_, obj, id, &holder, &prop, pc_);
|
||||
if (type != CanAttachNativeGetter) {
|
||||
|
@ -2096,7 +2096,7 @@ AttachDecision GetPropIRGenerator::tryAttachModuleNamespace(HandleObject obj,
|
|||
|
||||
auto* ns = &obj->as<ModuleNamespaceObject>();
|
||||
ModuleEnvironmentObject* env = nullptr;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
if (!ns->bindings().lookup(id, &env, &prop)) {
|
||||
return AttachDecision::NoAction;
|
||||
}
|
||||
|
@ -2159,7 +2159,7 @@ AttachDecision GetPropIRGenerator::tryAttachPrimitive(ValOperandId valId,
|
|||
}
|
||||
|
||||
NativeObject* holder = nullptr;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
NativeGetPropCacheability type =
|
||||
CanAttachNativeGetProp(cx_, proto, id, &holder, &prop, pc_);
|
||||
switch (type) {
|
||||
|
@ -2685,7 +2685,7 @@ AttachDecision GetNameIRGenerator::tryAttachStub() {
|
|||
static bool CanAttachGlobalName(JSContext* cx,
|
||||
GlobalLexicalEnvironmentObject* globalLexical,
|
||||
PropertyKey id, NativeObject** holder,
|
||||
Maybe<ShapeProperty>* prop) {
|
||||
Maybe<PropertyInfo>* prop) {
|
||||
// The property must be found, and it must be found as a normal data property.
|
||||
NativeObject* current = globalLexical;
|
||||
while (true) {
|
||||
|
@ -2724,7 +2724,7 @@ AttachDecision GetNameIRGenerator::tryAttachGlobalNameValue(ObjOperandId objId,
|
|||
auto* globalLexical = &env_->as<GlobalLexicalEnvironmentObject>();
|
||||
|
||||
NativeObject* holder = nullptr;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
if (!CanAttachGlobalName(cx_, globalLexical, id, &holder, &prop)) {
|
||||
return AttachDecision::NoAction;
|
||||
}
|
||||
|
@ -2788,7 +2788,7 @@ AttachDecision GetNameIRGenerator::tryAttachGlobalNameGetter(ObjOperandId objId,
|
|||
MOZ_ASSERT(globalLexical->isGlobal());
|
||||
|
||||
NativeObject* holder = nullptr;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
if (!CanAttachGlobalName(cx_, globalLexical, id, &holder, &prop)) {
|
||||
return AttachDecision::NoAction;
|
||||
}
|
||||
|
@ -2863,7 +2863,7 @@ AttachDecision GetNameIRGenerator::tryAttachEnvironmentName(ObjOperandId objId,
|
|||
}
|
||||
|
||||
JSObject* env = env_;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
NativeObject* holder = nullptr;
|
||||
|
||||
while (env) {
|
||||
|
@ -2970,7 +2970,7 @@ AttachDecision BindNameIRGenerator::tryAttachGlobalName(ObjOperandId objId,
|
|||
MOZ_ASSERT(globalLexical->isGlobal());
|
||||
|
||||
JSObject* result = nullptr;
|
||||
if (Maybe<ShapeProperty> prop = globalLexical->lookup(cx_, id)) {
|
||||
if (Maybe<PropertyInfo> prop = globalLexical->lookup(cx_, id)) {
|
||||
// If this is an uninitialized lexical or a const, we need to return a
|
||||
// RuntimeLexicalErrorObject.
|
||||
if (globalLexical->getSlot(prop->slot()).isMagic() || !prop->writable()) {
|
||||
|
@ -2989,7 +2989,7 @@ AttachDecision BindNameIRGenerator::tryAttachGlobalName(ObjOperandId objId,
|
|||
// If the property exists on the global and is non-configurable, it cannot
|
||||
// be shadowed by the lexical scope so we can just return the global without
|
||||
// a shape guard.
|
||||
Maybe<ShapeProperty> prop = result->as<GlobalObject>().lookup(cx_, id);
|
||||
Maybe<PropertyInfo> prop = result->as<GlobalObject>().lookup(cx_, id);
|
||||
if (prop.isNothing() || prop->configurable()) {
|
||||
writer.guardShape(objId, globalLexical->lastProperty());
|
||||
}
|
||||
|
@ -3009,7 +3009,7 @@ AttachDecision BindNameIRGenerator::tryAttachEnvironmentName(ObjOperandId objId,
|
|||
}
|
||||
|
||||
JSObject* env = env_;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
while (true) {
|
||||
if (!env->is<GlobalObject>() && !env->is<EnvironmentObject>()) {
|
||||
return AttachDecision::NoAction;
|
||||
|
@ -3568,7 +3568,7 @@ AttachDecision SetPropIRGenerator::tryAttachStub() {
|
|||
}
|
||||
|
||||
static void EmitStoreSlotAndReturn(CacheIRWriter& writer, ObjOperandId objId,
|
||||
NativeObject* nobj, ShapeProperty prop,
|
||||
NativeObject* nobj, PropertyInfo prop,
|
||||
ValOperandId rhsId) {
|
||||
if (nobj->isFixedSlot(prop.slot())) {
|
||||
size_t offset = NativeObject::getFixedSlotOffset(prop.slot());
|
||||
|
@ -3580,9 +3580,9 @@ static void EmitStoreSlotAndReturn(CacheIRWriter& writer, ObjOperandId objId,
|
|||
writer.returnFromIC();
|
||||
}
|
||||
|
||||
static Maybe<ShapeProperty> LookupShapeForSetSlot(JSOp op, NativeObject* obj,
|
||||
jsid id) {
|
||||
Maybe<ShapeProperty> prop = obj->lookupPure(id);
|
||||
static Maybe<PropertyInfo> LookupShapeForSetSlot(JSOp op, NativeObject* obj,
|
||||
jsid id) {
|
||||
Maybe<PropertyInfo> prop = obj->lookupPure(id);
|
||||
if (prop.isNothing() || !prop->isDataProperty() || !prop->writable()) {
|
||||
return mozilla::Nothing();
|
||||
}
|
||||
|
@ -3598,7 +3598,7 @@ static Maybe<ShapeProperty> LookupShapeForSetSlot(JSOp op, NativeObject* obj,
|
|||
}
|
||||
|
||||
static bool CanAttachNativeSetSlot(JSOp op, JSObject* obj, PropertyKey id,
|
||||
Maybe<ShapeProperty>* prop) {
|
||||
Maybe<PropertyInfo>* prop) {
|
||||
if (!obj->is<NativeObject>()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -3610,7 +3610,7 @@ static bool CanAttachNativeSetSlot(JSOp op, JSObject* obj, PropertyKey id,
|
|||
// There is no need to guard on the shape. Global lexical bindings are
|
||||
// non-configurable and can not be shadowed.
|
||||
static bool IsGlobalLexicalSetGName(JSOp op, NativeObject* obj,
|
||||
ShapeProperty prop) {
|
||||
PropertyInfo prop) {
|
||||
// Ensure that the env can't change.
|
||||
if (op != JSOp::SetGName && op != JSOp::StrictSetGName) {
|
||||
return false;
|
||||
|
@ -3631,7 +3631,7 @@ AttachDecision SetPropIRGenerator::tryAttachNativeSetSlot(HandleObject obj,
|
|||
ObjOperandId objId,
|
||||
HandleId id,
|
||||
ValOperandId rhsId) {
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
if (!CanAttachNativeSetSlot(JSOp(*pc_), obj, id, &prop)) {
|
||||
return AttachDecision::NoAction;
|
||||
}
|
||||
|
@ -3708,7 +3708,7 @@ void SetPropIRGenerator::trackAttached(const char* name) {
|
|||
|
||||
static bool IsCacheableSetPropCallNative(NativeObject* obj,
|
||||
NativeObject* holder,
|
||||
ShapeProperty prop) {
|
||||
PropertyInfo prop) {
|
||||
MOZ_ASSERT(IsCacheableProtoChain(obj, holder));
|
||||
|
||||
if (!prop.isAccessorProperty()) {
|
||||
|
@ -3738,7 +3738,7 @@ static bool IsCacheableSetPropCallNative(NativeObject* obj,
|
|||
|
||||
static bool IsCacheableSetPropCallScripted(NativeObject* obj,
|
||||
NativeObject* holder,
|
||||
ShapeProperty prop) {
|
||||
PropertyInfo prop) {
|
||||
MOZ_ASSERT(IsCacheableProtoChain(obj, holder));
|
||||
|
||||
if (IsWindow(obj)) {
|
||||
|
@ -3765,7 +3765,7 @@ static bool IsCacheableSetPropCallScripted(NativeObject* obj,
|
|||
|
||||
static bool CanAttachSetter(JSContext* cx, jsbytecode* pc, JSObject* obj,
|
||||
PropertyKey id, NativeObject** holder,
|
||||
Maybe<ShapeProperty>* shapeProp) {
|
||||
Maybe<PropertyInfo>* propInfo) {
|
||||
// Don't attach a setter stub for ops like JSOp::InitElem.
|
||||
MOZ_ASSERT(IsPropertySetOp(JSOp(*pc)));
|
||||
|
||||
|
@ -3779,18 +3779,18 @@ static bool CanAttachSetter(JSContext* cx, jsbytecode* pc, JSObject* obj,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!IsCacheableSetPropCallScripted(nobj, *holder, prop.shapeProperty()) &&
|
||||
!IsCacheableSetPropCallNative(nobj, *holder, prop.shapeProperty())) {
|
||||
if (!IsCacheableSetPropCallScripted(nobj, *holder, prop.propertyInfo()) &&
|
||||
!IsCacheableSetPropCallNative(nobj, *holder, prop.propertyInfo())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*shapeProp = mozilla::Some(prop.shapeProperty());
|
||||
*propInfo = mozilla::Some(prop.propertyInfo());
|
||||
return true;
|
||||
}
|
||||
|
||||
static void EmitCallSetterNoGuards(JSContext* cx, CacheIRWriter& writer,
|
||||
NativeObject* obj, NativeObject* holder,
|
||||
ShapeProperty prop, ObjOperandId objId,
|
||||
PropertyInfo prop, ObjOperandId objId,
|
||||
ValOperandId rhsId) {
|
||||
JSFunction* target = &holder->getSetter(prop)->as<JSFunction>();
|
||||
bool sameRealm = cx->realm() == target->realm();
|
||||
|
@ -3808,7 +3808,7 @@ static void EmitCallSetterNoGuards(JSContext* cx, CacheIRWriter& writer,
|
|||
}
|
||||
|
||||
static void EmitCallDOMSetterNoGuards(JSContext* cx, CacheIRWriter& writer,
|
||||
NativeObject* holder, ShapeProperty prop,
|
||||
NativeObject* holder, PropertyInfo prop,
|
||||
ObjOperandId objId, ValOperandId rhsId) {
|
||||
JSFunction* setter = &holder->getSetter(prop)->as<JSFunction>();
|
||||
MOZ_ASSERT(cx->realm() == setter->realm());
|
||||
|
@ -3822,7 +3822,7 @@ AttachDecision SetPropIRGenerator::tryAttachSetter(HandleObject obj,
|
|||
HandleId id,
|
||||
ValOperandId rhsId) {
|
||||
NativeObject* holder = nullptr;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
if (!CanAttachSetter(cx_, pc_, obj, id, &holder, &prop)) {
|
||||
return AttachDecision::NoAction;
|
||||
}
|
||||
|
@ -4221,7 +4221,7 @@ AttachDecision SetPropIRGenerator::tryAttachDOMProxyUnshadowed(
|
|||
}
|
||||
|
||||
NativeObject* holder = nullptr;
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
if (!CanAttachSetter(cx_, pc_, proto, id, &holder, &prop)) {
|
||||
return AttachDecision::NoAction;
|
||||
}
|
||||
|
@ -4269,7 +4269,7 @@ AttachDecision SetPropIRGenerator::tryAttachDOMProxyExpando(
|
|||
expandoObj = &expandoAndGeneration->expando.toObject();
|
||||
}
|
||||
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
if (CanAttachNativeSetSlot(JSOp(*pc_), expandoObj, id, &prop)) {
|
||||
auto* nativeExpandoObj = &expandoObj->as<NativeObject>();
|
||||
|
||||
|
@ -4405,7 +4405,7 @@ AttachDecision SetPropIRGenerator::tryAttachWindowProxy(HandleObject obj,
|
|||
// Now try to do the set on the Window (the current global).
|
||||
GlobalObject* windowObj = cx_->global();
|
||||
|
||||
Maybe<ShapeProperty> prop;
|
||||
Maybe<PropertyInfo> prop;
|
||||
if (!CanAttachNativeSetSlot(JSOp(*pc_), windowObj, id, &prop)) {
|
||||
return AttachDecision::NoAction;
|
||||
}
|
||||
|
@ -4483,7 +4483,7 @@ bool SetPropIRGenerator::canAttachAddSlotStub(HandleObject obj, HandleId id) {
|
|||
}
|
||||
|
||||
// If prototype defines this property in a non-plain way, don't optimize.
|
||||
Maybe<ShapeProperty> protoProp = proto->as<NativeObject>().lookup(cx_, id);
|
||||
Maybe<PropertyInfo> protoProp = proto->as<NativeObject>().lookup(cx_, id);
|
||||
if (protoProp.isSome() && !protoProp->isDataProperty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -4540,12 +4540,12 @@ AttachDecision SetPropIRGenerator::tryAttachAddSlotStub(HandleShape oldShape) {
|
|||
}
|
||||
auto* nobj = &obj->as<NativeObject>();
|
||||
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
NativeObject* holder = nobj;
|
||||
|
||||
// The property must be the last added property of the object.
|
||||
Shape* newShape = holder->lastProperty();
|
||||
MOZ_RELEASE_ASSERT(newShape->property() == shapeProp);
|
||||
MOZ_RELEASE_ASSERT(newShape->propertyInfo() == propInfo);
|
||||
|
||||
// Old shape should be parent of new shape. Object flag updates may make this
|
||||
// false even for simple data properties. It may be possible to support these
|
||||
|
@ -4555,8 +4555,8 @@ AttachDecision SetPropIRGenerator::tryAttachAddSlotStub(HandleShape oldShape) {
|
|||
}
|
||||
|
||||
// Basic shape checks.
|
||||
if (newShape->inDictionary() || !shapeProp.isDataProperty() ||
|
||||
!shapeProp.writable()) {
|
||||
if (newShape->inDictionary() || !propInfo.isDataProperty() ||
|
||||
!propInfo.writable()) {
|
||||
return AttachDecision::NoAction;
|
||||
}
|
||||
|
||||
|
@ -4575,12 +4575,12 @@ AttachDecision SetPropIRGenerator::tryAttachAddSlotStub(HandleShape oldShape) {
|
|||
|
||||
ShapeGuardProtoChain(writer, nobj, objId);
|
||||
|
||||
if (holder->isFixedSlot(shapeProp.slot())) {
|
||||
size_t offset = NativeObject::getFixedSlotOffset(shapeProp.slot());
|
||||
if (holder->isFixedSlot(propInfo.slot())) {
|
||||
size_t offset = NativeObject::getFixedSlotOffset(propInfo.slot());
|
||||
writer.addAndStoreFixedSlot(objId, offset, rhsValId, newShape);
|
||||
trackAttached("AddSlot");
|
||||
} else {
|
||||
size_t offset = holder->dynamicSlotIndex(shapeProp.slot()) * sizeof(Value);
|
||||
size_t offset = holder->dynamicSlotIndex(propInfo.slot()) * sizeof(Value);
|
||||
uint32_t numOldSlots = NativeObject::calculateDynamicSlots(oldShape);
|
||||
uint32_t numNewSlots = holder->numDynamicSlots();
|
||||
if (numOldSlots == numNewSlots) {
|
||||
|
@ -4647,14 +4647,14 @@ AttachDecision InstanceOfIRGenerator::tryAttachStub() {
|
|||
|
||||
// If the above succeeded, then these should be true about @@hasInstance,
|
||||
// because the property on Function.__proto__ is an immutable data property:
|
||||
MOZ_ASSERT(hasInstanceProp.shapeProperty().isDataProperty());
|
||||
MOZ_ASSERT(!hasInstanceProp.shapeProperty().configurable());
|
||||
MOZ_ASSERT(!hasInstanceProp.shapeProperty().writable());
|
||||
MOZ_ASSERT(hasInstanceProp.propertyInfo().isDataProperty());
|
||||
MOZ_ASSERT(!hasInstanceProp.propertyInfo().configurable());
|
||||
MOZ_ASSERT(!hasInstanceProp.propertyInfo().writable());
|
||||
|
||||
MOZ_ASSERT(IsCacheableProtoChain(fun, hasInstanceHolder));
|
||||
|
||||
// Ensure that the function's prototype slot is the same.
|
||||
Maybe<ShapeProperty> prop = fun->lookupPure(cx_->names().prototype);
|
||||
Maybe<PropertyInfo> prop = fun->lookupPure(cx_->names().prototype);
|
||||
if (prop.isNothing() || !prop->isDataProperty()) {
|
||||
trackAttached(IRGenerator::NotAttached);
|
||||
return AttachDecision::NoAction;
|
||||
|
@ -4873,7 +4873,7 @@ static bool IsArrayPrototypeOptimizable(JSContext* cx, ArrayObject* arr,
|
|||
}
|
||||
|
||||
// Ensure that Array.prototype's @@iterator slot is unchanged.
|
||||
Maybe<ShapeProperty> prop = proto->lookupPure(iteratorKey);
|
||||
Maybe<PropertyInfo> prop = proto->lookupPure(iteratorKey);
|
||||
if (prop.isNothing() || !prop->isDataProperty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -4901,7 +4901,7 @@ static bool IsArrayIteratorPrototypeOptimizable(JSContext* cx,
|
|||
*arrIterProto = proto;
|
||||
|
||||
// Ensure that %ArrayIteratorPrototype%'s "next" slot is unchanged.
|
||||
Maybe<ShapeProperty> prop = proto->lookupPure(cx->names().next);
|
||||
Maybe<PropertyInfo> prop = proto->lookupPure(cx->names().next);
|
||||
if (prop.isNothing() || !prop->isDataProperty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -9159,7 +9159,7 @@ AttachDecision CallIRGenerator::tryAttachCallScripted(
|
|||
// expect. Note that getThisForScripted checked newTarget is a function
|
||||
// with a non-configurable .prototype data property.
|
||||
JSFunction* newTarget = &newTarget_.toObject().as<JSFunction>();
|
||||
Maybe<ShapeProperty> prop = newTarget->lookupPure(cx_->names().prototype);
|
||||
Maybe<PropertyInfo> prop = newTarget->lookupPure(cx_->names().prototype);
|
||||
MOZ_ASSERT(prop.isSome());
|
||||
MOZ_ASSERT(newTarget->numFixedSlots() == 0, "Stub code relies on this");
|
||||
uint32_t slot = prop->slot();
|
||||
|
|
|
@ -1837,7 +1837,7 @@ static MOZ_ALWAYS_INLINE bool GetNativeDataPropertyPure(JSContext* cx,
|
|||
|
||||
while (true) {
|
||||
if (Shape* shape = obj->lastProperty()->search(cx, id)) {
|
||||
ShapeProperty prop = shape->property();
|
||||
PropertyInfo prop = shape->propertyInfo();
|
||||
if (!prop.isDataProperty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1945,7 +1945,7 @@ bool SetNativeDataPropertyPure(JSContext* cx, JSObject* obj, PropertyName* name,
|
|||
return false;
|
||||
}
|
||||
|
||||
ShapeProperty prop = shape->property();
|
||||
PropertyInfo prop = shape->propertyInfo();
|
||||
if (!prop.isDataProperty() || !prop.writable()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1968,7 +1968,7 @@ bool ObjectHasGetterSetterPure(JSContext* cx, JSObject* objArg, jsid id,
|
|||
|
||||
while (true) {
|
||||
if (Shape* shape = nobj->lastProperty()->search(cx, id)) {
|
||||
ShapeProperty prop = shape->property();
|
||||
PropertyInfo prop = shape->propertyInfo();
|
||||
if (!prop.isAccessorProperty()) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -219,7 +219,7 @@ template <typename T, typename... Args>
|
|||
ModuleEnvironmentObject* env = GetModuleEnvironmentForScript(script);
|
||||
MOZ_ASSERT(env);
|
||||
|
||||
mozilla::Maybe<ShapeProperty> prop;
|
||||
mozilla::Maybe<PropertyInfo> prop;
|
||||
ModuleEnvironmentObject* targetEnv;
|
||||
MOZ_ALWAYS_TRUE(env->lookupImport(NameToId(name), &targetEnv, &prop));
|
||||
|
||||
|
|
|
@ -759,17 +759,17 @@ static bool DefineMappedIndex(JSContext* cx, Handle<MappedArgumentsObject*> obj,
|
|||
|
||||
MOZ_ASSERT(prop.isNativeProperty());
|
||||
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
MOZ_ASSERT(shapeProp.writable());
|
||||
MOZ_ASSERT(shapeProp.isCustomDataProperty());
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
MOZ_ASSERT(propInfo.writable());
|
||||
MOZ_ASSERT(propInfo.isCustomDataProperty());
|
||||
|
||||
// Change the property's attributes by implementing the relevant parts of
|
||||
// ValidateAndApplyPropertyDescriptor (ES2021 draft, 10.1.6.3), in particular
|
||||
// steps 4 and 9.
|
||||
|
||||
// Determine whether the property should be configurable and/or enumerable.
|
||||
bool configurable = shapeProp.configurable();
|
||||
bool enumerable = shapeProp.enumerable();
|
||||
bool configurable = propInfo.configurable();
|
||||
bool enumerable = propInfo.enumerable();
|
||||
if (configurable) {
|
||||
if (desc.hasConfigurable()) {
|
||||
configurable = desc.configurable();
|
||||
|
@ -785,7 +785,7 @@ static bool DefineMappedIndex(JSContext* cx, Handle<MappedArgumentsObject*> obj,
|
|||
}
|
||||
}
|
||||
|
||||
PropertyFlags flags = shapeProp.flags();
|
||||
PropertyFlags flags = propInfo.flags();
|
||||
flags.setFlag(PropertyFlag::Configurable, configurable);
|
||||
flags.setFlag(PropertyFlag::Enumerable, enumerable);
|
||||
if (!NativeObject::changeCustomDataPropAttributes(cx, obj, id, flags)) {
|
||||
|
|
|
@ -456,7 +456,7 @@ bool ModuleEnvironmentObject::hasImportBinding(HandlePropertyName name) {
|
|||
|
||||
bool ModuleEnvironmentObject::lookupImport(
|
||||
jsid name, ModuleEnvironmentObject** envOut,
|
||||
mozilla::Maybe<ShapeProperty>* propOut) {
|
||||
mozilla::Maybe<PropertyInfo>* propOut) {
|
||||
return importBindings().lookup(name, envOut, propOut);
|
||||
}
|
||||
|
||||
|
@ -472,11 +472,11 @@ bool ModuleEnvironmentObject::lookupProperty(JSContext* cx, HandleObject obj,
|
|||
PropertyResult* propp) {
|
||||
const IndirectBindingMap& bindings =
|
||||
obj->as<ModuleEnvironmentObject>().importBindings();
|
||||
mozilla::Maybe<ShapeProperty> shapeProp;
|
||||
mozilla::Maybe<PropertyInfo> propInfo;
|
||||
ModuleEnvironmentObject* env;
|
||||
if (bindings.lookup(id, &env, &shapeProp)) {
|
||||
if (bindings.lookup(id, &env, &propInfo)) {
|
||||
objp.set(env);
|
||||
propp->setNativeProperty(*shapeProp);
|
||||
propp->setNativeProperty(*propInfo);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -507,7 +507,7 @@ bool ModuleEnvironmentObject::getProperty(JSContext* cx, HandleObject obj,
|
|||
MutableHandleValue vp) {
|
||||
const IndirectBindingMap& bindings =
|
||||
obj->as<ModuleEnvironmentObject>().importBindings();
|
||||
mozilla::Maybe<ShapeProperty> prop;
|
||||
mozilla::Maybe<PropertyInfo> prop;
|
||||
ModuleEnvironmentObject* env;
|
||||
if (bindings.lookup(id, &env, &prop)) {
|
||||
vp.set(env->getSlot(prop->slot()));
|
||||
|
@ -537,7 +537,7 @@ bool ModuleEnvironmentObject::getOwnPropertyDescriptor(
|
|||
MutableHandle<mozilla::Maybe<PropertyDescriptor>> desc) {
|
||||
const IndirectBindingMap& bindings =
|
||||
obj->as<ModuleEnvironmentObject>().importBindings();
|
||||
mozilla::Maybe<ShapeProperty> prop;
|
||||
mozilla::Maybe<PropertyInfo> prop;
|
||||
ModuleEnvironmentObject* env;
|
||||
if (bindings.lookup(id, &env, &prop)) {
|
||||
desc.set(mozilla::Some(PropertyDescriptor::Data(
|
||||
|
@ -3442,7 +3442,7 @@ bool js::CheckLexicalNameConflict(
|
|||
HandleObject varObj, HandlePropertyName name) {
|
||||
const char* redeclKind = nullptr;
|
||||
RootedId id(cx, NameToId(name));
|
||||
mozilla::Maybe<ShapeProperty> prop;
|
||||
mozilla::Maybe<PropertyInfo> prop;
|
||||
if (varObj->is<GlobalObject>() &&
|
||||
varObj->as<GlobalObject>().realm()->isInVarNames(name)) {
|
||||
// ES 15.1.11 step 5.a
|
||||
|
@ -3479,7 +3479,7 @@ bool js::CheckLexicalNameConflict(
|
|||
[[nodiscard]] static bool CheckVarNameConflict(
|
||||
JSContext* cx, Handle<LexicalEnvironmentObject*> lexicalEnv,
|
||||
HandlePropertyName name) {
|
||||
mozilla::Maybe<ShapeProperty> prop = lexicalEnv->lookup(cx, name);
|
||||
mozilla::Maybe<PropertyInfo> prop = lexicalEnv->lookup(cx, name);
|
||||
if (prop.isSome()) {
|
||||
ReportRuntimeRedeclaration(cx, name, prop->writable() ? "let" : "const");
|
||||
return false;
|
||||
|
@ -3674,15 +3674,15 @@ static bool InitHoistedFunctionDeclarations(JSContext* cx, HandleScript script,
|
|||
MOZ_ASSERT(varObj->is<NativeObject>() ||
|
||||
varObj->is<DebugEnvironmentProxy>());
|
||||
if (varObj->is<GlobalObject>()) {
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
if (shapeProp.configurable()) {
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
if (propInfo.configurable()) {
|
||||
if (!DefineDataProperty(cx, varObj, name, rval, attrs)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
MOZ_ASSERT(shapeProp.isDataProperty());
|
||||
MOZ_ASSERT(shapeProp.writable());
|
||||
MOZ_ASSERT(shapeProp.enumerable());
|
||||
MOZ_ASSERT(propInfo.isDataProperty());
|
||||
MOZ_ASSERT(propInfo.writable());
|
||||
MOZ_ASSERT(propInfo.enumerable());
|
||||
}
|
||||
|
||||
// Careful: the presence of a shape, even one appearing to derive from
|
||||
|
@ -4195,7 +4195,7 @@ JSObject* js::MaybeOptimizeBindGlobalName(JSContext* cx,
|
|||
// 'let') at compile time.
|
||||
Rooted<GlobalLexicalEnvironmentObject*> env(cx,
|
||||
&global->lexicalEnvironment());
|
||||
mozilla::Maybe<ShapeProperty> prop = env->lookup(cx, name);
|
||||
mozilla::Maybe<PropertyInfo> prop = env->lookup(cx, name);
|
||||
if (prop.isSome()) {
|
||||
if (prop->writable() &&
|
||||
!env->getSlot(prop->slot()).isMagic(JS_UNINITIALIZED_LEXICAL)) {
|
||||
|
|
|
@ -445,7 +445,7 @@ class ModuleEnvironmentObject : public EnvironmentObject {
|
|||
bool hasImportBinding(HandlePropertyName name);
|
||||
|
||||
bool lookupImport(jsid name, ModuleEnvironmentObject** envOut,
|
||||
mozilla::Maybe<ShapeProperty>* propOut);
|
||||
mozilla::Maybe<PropertyInfo>* propOut);
|
||||
|
||||
void fixEnclosingEnvironmentAfterRealmMerge(GlobalObject& global);
|
||||
|
||||
|
|
|
@ -208,7 +208,7 @@ void AbstractGeneratorObject::finalSuspend(HandleObject obj) {
|
|||
static AbstractGeneratorObject* GetGeneratorObjectForCall(JSContext* cx,
|
||||
CallObject& callObj) {
|
||||
// The ".generator" binding is always present and always "aliased".
|
||||
mozilla::Maybe<ShapeProperty> prop =
|
||||
mozilla::Maybe<PropertyInfo> prop =
|
||||
callObj.lookup(cx, cx->names().dotGenerator);
|
||||
if (prop.isNothing()) {
|
||||
return nullptr;
|
||||
|
@ -230,7 +230,7 @@ AbstractGeneratorObject* js::GetGeneratorObjectForFrame(
|
|||
if (frame.isModuleFrame()) {
|
||||
ModuleEnvironmentObject* moduleEnv =
|
||||
frame.script()->module()->environment();
|
||||
mozilla::Maybe<ShapeProperty> prop =
|
||||
mozilla::Maybe<PropertyInfo> prop =
|
||||
moduleEnv->lookup(cx, cx->names().dotGenerator);
|
||||
Value genValue = moduleEnv->getSlot(prop->slot());
|
||||
return genValue.isObject()
|
||||
|
|
|
@ -750,7 +750,7 @@ class GlobalObject : public NativeObject {
|
|||
}
|
||||
|
||||
NativeObject* holder = &slot.toObject().as<NativeObject>();
|
||||
mozilla::Maybe<ShapeProperty> prop = holder->lookupPure(name);
|
||||
mozilla::Maybe<PropertyInfo> prop = holder->lookupPure(name);
|
||||
if (prop.isNothing()) {
|
||||
*vp = UndefinedValue();
|
||||
return false;
|
||||
|
@ -769,7 +769,7 @@ class GlobalObject : public NativeObject {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (mozilla::Maybe<ShapeProperty> prop = holder->lookup(cx, name)) {
|
||||
if (mozilla::Maybe<PropertyInfo> prop = holder->lookup(cx, name)) {
|
||||
vp.set(holder->getSlot(prop->slot()));
|
||||
*exists = true;
|
||||
} else {
|
||||
|
|
|
@ -53,13 +53,13 @@ static inline bool IsUninitializedLexicalSlot(HandleObject obj,
|
|||
return false;
|
||||
}
|
||||
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
if (!shapeProp.isDataProperty()) {
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
if (!propInfo.isDataProperty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return IsUninitializedLexical(
|
||||
obj->as<NativeObject>().getSlot(shapeProp.slot()));
|
||||
obj->as<NativeObject>().getSlot(propInfo.slot()));
|
||||
}
|
||||
|
||||
static inline bool CheckUninitializedLexical(JSContext* cx, PropertyName* name_,
|
||||
|
@ -123,17 +123,17 @@ inline bool FetchName(JSContext* cx, HandleObject receiver, HandleObject holder,
|
|||
return false;
|
||||
}
|
||||
} else {
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
if (shapeProp.isDataProperty()) {
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
if (propInfo.isDataProperty()) {
|
||||
/* Fast path for Object instance properties. */
|
||||
vp.set(holder->as<NativeObject>().getSlot(shapeProp.slot()));
|
||||
vp.set(holder->as<NativeObject>().getSlot(propInfo.slot()));
|
||||
} else {
|
||||
// Unwrap 'with' environments for reasons given in
|
||||
// GetNameBoundInEnvironment.
|
||||
RootedObject normalized(cx, MaybeUnwrapWithEnvironment(receiver));
|
||||
RootedId id(cx, NameToId(name));
|
||||
if (!NativeGetExistingProperty(cx, normalized, holder.as<NativeObject>(),
|
||||
id, shapeProp, vp)) {
|
||||
id, propInfo, vp)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -154,12 +154,12 @@ inline bool FetchNameNoGC(NativeObject* pobj, PropertyResult prop, Value* vp) {
|
|||
return false;
|
||||
}
|
||||
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
if (!shapeProp.isDataProperty()) {
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
if (!propInfo.isDataProperty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*vp = pobj->getSlot(shapeProp.slot());
|
||||
*vp = pobj->getSlot(propInfo.slot());
|
||||
return !IsUninitializedLexical(*vp);
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,7 @@ inline void InitGlobalLexicalOperation(
|
|||
lexicalEnv == &cx->global()->lexicalEnvironment());
|
||||
MOZ_ASSERT(JSOp(*pc) == JSOp::InitGLexical);
|
||||
|
||||
mozilla::Maybe<ShapeProperty> prop =
|
||||
mozilla::Maybe<PropertyInfo> prop =
|
||||
lexicalEnv->lookup(cx, script->getName(pc));
|
||||
MOZ_ASSERT(prop.isSome());
|
||||
MOZ_ASSERT(IsUninitializedLexical(lexicalEnv->getSlot(prop->slot())));
|
||||
|
|
|
@ -441,7 +441,7 @@ bool JSFunction::hasNonConfigurablePrototypeDataProperty() {
|
|||
#ifdef DEBUG
|
||||
PropertyName* prototypeName =
|
||||
runtimeFromMainThread()->commonNames->prototype;
|
||||
Maybe<ShapeProperty> prop = lookupPure(prototypeName);
|
||||
Maybe<PropertyInfo> prop = lookupPure(prototypeName);
|
||||
MOZ_ASSERT(prop.isSome());
|
||||
MOZ_ASSERT(prop->isDataProperty());
|
||||
MOZ_ASSERT(!prop->configurable());
|
||||
|
@ -455,7 +455,7 @@ bool JSFunction::hasNonConfigurablePrototypeDataProperty() {
|
|||
}
|
||||
|
||||
PropertyName* prototypeName = runtimeFromMainThread()->commonNames->prototype;
|
||||
Maybe<ShapeProperty> prop = lookupPure(prototypeName);
|
||||
Maybe<PropertyInfo> prop = lookupPure(prototypeName);
|
||||
return prop.isSome() && prop->isDataProperty() && !prop->configurable();
|
||||
}
|
||||
|
||||
|
|
|
@ -2024,7 +2024,7 @@ bool js::LookupNameUnqualified(JSContext* cx, HandlePropertyName name,
|
|||
return false;
|
||||
}
|
||||
} else if (env->is<LexicalEnvironmentObject>() &&
|
||||
!prop.shapeProperty().writable()) {
|
||||
!prop.propertyInfo().writable()) {
|
||||
// Assigning to a named lambda callee name is a no-op in sloppy mode.
|
||||
if (!(env->is<BlockLexicalEnvironmentObject>() &&
|
||||
env->as<BlockLexicalEnvironmentObject>().scope().kind() ==
|
||||
|
@ -2098,12 +2098,12 @@ static inline bool NativeGetPureInline(NativeObject* pobj, jsid id,
|
|||
}
|
||||
|
||||
// Fail if we have a custom getter.
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
if (!shapeProp.isDataProperty()) {
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
if (!propInfo.isDataProperty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
*vp = pobj->getSlot(shapeProp.slot());
|
||||
*vp = pobj->getSlot(propInfo.slot());
|
||||
MOZ_ASSERT(!vp->isMagic());
|
||||
return true;
|
||||
}
|
||||
|
@ -2146,9 +2146,9 @@ static inline bool NativeGetGetterPureInline(NativeObject* holder,
|
|||
JSFunction** fp) {
|
||||
MOZ_ASSERT(prop.isNativeProperty());
|
||||
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
if (holder->hasGetter(shapeProp)) {
|
||||
JSObject* getter = holder->getGetter(shapeProp);
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
if (holder->hasGetter(propInfo)) {
|
||||
JSObject* getter = holder->getGetter(propInfo);
|
||||
if (getter->is<JSFunction>()) {
|
||||
*fp = &getter->as<JSFunction>();
|
||||
return true;
|
||||
|
@ -2206,14 +2206,14 @@ bool js::GetOwnNativeGetterPure(JSContext* cx, JSObject* obj, jsid id,
|
|||
return true;
|
||||
}
|
||||
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
|
||||
NativeObject* nobj = &obj->as<NativeObject>();
|
||||
if (!nobj->hasGetter(shapeProp)) {
|
||||
if (!nobj->hasGetter(propInfo)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
JSObject* getterObj = nobj->getGetter(shapeProp);
|
||||
JSObject* getterObj = nobj->getGetter(propInfo);
|
||||
if (!getterObj->is<JSFunction>()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -2234,7 +2234,7 @@ bool js::HasOwnDataPropertyPure(JSContext* cx, JSObject* obj, jsid id,
|
|||
return false;
|
||||
}
|
||||
|
||||
*result = prop.isNativeProperty() && prop.shapeProperty().isDataProperty();
|
||||
*result = prop.isNativeProperty() && prop.propertyInfo().isDataProperty();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -3148,7 +3148,7 @@ JS_FRIEND_API void js::DumpId(jsid id, js::GenericPrinter& out) {
|
|||
|
||||
static void DumpProperty(const NativeObject* obj, Shape& shape,
|
||||
js::GenericPrinter& out) {
|
||||
PropertyInfoWithKey prop = shape.propertyWithKey();
|
||||
PropertyInfoWithKey prop = shape.propertyInfoWithKey();
|
||||
jsid id = prop.key();
|
||||
if (JSID_IS_ATOM(id)) {
|
||||
id.toAtom()->dumpCharsNoNewline(out);
|
||||
|
|
|
@ -583,7 +583,7 @@ MOZ_ALWAYS_INLINE bool NativeObject::setLastPropertyForNewDataProperty(
|
|||
|
||||
MOZ_ASSERT(shape->previous() == lastProperty());
|
||||
MOZ_ASSERT(shape->base() == lastProperty()->base());
|
||||
MOZ_ASSERT(shape->property().isDataProperty());
|
||||
MOZ_ASSERT(shape->propertyInfo().isDataProperty());
|
||||
MOZ_ASSERT(shape->slotSpan() == lastProperty()->slotSpan() + 1);
|
||||
|
||||
size_t slot = shape->slot();
|
||||
|
@ -681,7 +681,7 @@ static MOZ_ALWAYS_INLINE bool CallResolveOp(JSContext* cx,
|
|||
|
||||
MOZ_ASSERT(!obj->is<TypedArrayObject>());
|
||||
|
||||
mozilla::Maybe<ShapeProperty> prop = obj->lookup(cx, id);
|
||||
mozilla::Maybe<PropertyInfo> prop = obj->lookup(cx, id);
|
||||
if (prop.isSome()) {
|
||||
propp->setNativeProperty(*prop);
|
||||
} else {
|
||||
|
@ -745,7 +745,7 @@ static MOZ_ALWAYS_INLINE bool NativeLookupOwnPropertyInline(
|
|||
// Check for a native property. Call Shape::search directly (instead of
|
||||
// NativeObject::lookup) because it's inlined.
|
||||
if (Shape* shape = obj->lastProperty()->search(cx, id)) {
|
||||
propp->setNativeProperty(shape->property());
|
||||
propp->setNativeProperty(shape->propertyInfo());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -297,16 +297,16 @@ bool js::NativeObject::isNumFixedSlots(uint32_t nfixed) const {
|
|||
|
||||
#endif /* DEBUG */
|
||||
|
||||
mozilla::Maybe<ShapeProperty> js::NativeObject::lookup(JSContext* cx, jsid id) {
|
||||
mozilla::Maybe<PropertyInfo> js::NativeObject::lookup(JSContext* cx, jsid id) {
|
||||
MOZ_ASSERT(is<NativeObject>());
|
||||
Shape* shape = Shape::search(cx, lastProperty(), id);
|
||||
return shape ? mozilla::Some(shape->property()) : mozilla::Nothing();
|
||||
return shape ? mozilla::Some(shape->propertyInfo()) : mozilla::Nothing();
|
||||
}
|
||||
|
||||
mozilla::Maybe<ShapeProperty> js::NativeObject::lookupPure(jsid id) {
|
||||
mozilla::Maybe<PropertyInfo> js::NativeObject::lookupPure(jsid id) {
|
||||
MOZ_ASSERT(is<NativeObject>());
|
||||
Shape* shape = Shape::searchNoHashify(lastProperty(), id);
|
||||
return shape ? mozilla::Some(shape->property()) : mozilla::Nothing();
|
||||
return shape ? mozilla::Some(shape->propertyInfo()) : mozilla::Nothing();
|
||||
}
|
||||
|
||||
bool NativeObject::ensureSlotsForDictionaryObject(JSContext* cx,
|
||||
|
@ -1240,7 +1240,7 @@ static bool ChangeProperty(JSContext* cx, HandleNativeObject obj, HandleId id,
|
|||
// If we're redefining a getter/setter property but the getter and setter
|
||||
// objects are still the same, use the existing GetterSetter.
|
||||
if (existing->isNativeProperty()) {
|
||||
ShapeProperty prop = existing->shapeProperty();
|
||||
PropertyInfo prop = existing->propertyInfo();
|
||||
if (prop.isAccessorProperty()) {
|
||||
GetterSetter* current = obj->getGetterSetter(prop);
|
||||
if (current->getter() == getter && current->setter() == setter) {
|
||||
|
@ -1426,7 +1426,7 @@ static MOZ_ALWAYS_INLINE bool AddDataProperty(JSContext* cx,
|
|||
|
||||
static bool IsAccessorDescriptor(const PropertyResult& prop) {
|
||||
if (prop.isNativeProperty()) {
|
||||
return prop.shapeProperty().isAccessorProperty();
|
||||
return prop.propertyInfo().isAccessorProperty();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(prop.isDenseElement() || prop.isTypedArrayElement());
|
||||
|
@ -1452,14 +1452,14 @@ static bool GetExistingDataProperty(JSContext* cx, HandleNativeObject obj,
|
|||
return obj->as<TypedArrayObject>().getElement<CanGC>(cx, idx, vp);
|
||||
}
|
||||
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
if (shapeProp.isDataProperty()) {
|
||||
vp.set(obj->getSlot(shapeProp.slot()));
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
if (propInfo.isDataProperty()) {
|
||||
vp.set(obj->getSlot(propInfo.slot()));
|
||||
return true;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(!cx->isHelperThreadContext());
|
||||
MOZ_RELEASE_ASSERT(shapeProp.isCustomDataProperty());
|
||||
MOZ_RELEASE_ASSERT(propInfo.isCustomDataProperty());
|
||||
return GetCustomDataProperty(cx, obj, id, vp);
|
||||
}
|
||||
|
||||
|
@ -1504,23 +1504,22 @@ static bool DefinePropertyIsRedundant(JSContext* cx, HandleNativeObject obj,
|
|||
// Check for custom data properties for ArrayObject/ArgumentsObject.
|
||||
// PropertyDescriptor can't represent these properties so they're never
|
||||
// redundant.
|
||||
if (prop.isNativeProperty() &&
|
||||
prop.shapeProperty().isCustomDataProperty()) {
|
||||
if (prop.isNativeProperty() && prop.propertyInfo().isCustomDataProperty()) {
|
||||
return true;
|
||||
}
|
||||
} else if (desc.isAccessorDescriptor()) {
|
||||
if (!prop.isNativeProperty()) {
|
||||
return true;
|
||||
}
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
if (desc.hasGetterObject() &&
|
||||
(!shapeProp.isAccessorProperty() ||
|
||||
desc.getterObject() != obj->getGetter(shapeProp))) {
|
||||
(!propInfo.isAccessorProperty() ||
|
||||
desc.getterObject() != obj->getGetter(propInfo))) {
|
||||
return true;
|
||||
}
|
||||
if (desc.hasSetterObject() &&
|
||||
(!shapeProp.isAccessorProperty() ||
|
||||
desc.setterObject() != obj->getSetter(shapeProp))) {
|
||||
(!propInfo.isAccessorProperty() ||
|
||||
desc.setterObject() != obj->getSetter(propInfo))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -1690,9 +1689,9 @@ bool js::NativeDefineProperty(JSContext* cx, HandleNativeObject obj,
|
|||
desc.setValue(currentValue);
|
||||
desc.setWritable(attrs.writable());
|
||||
} else {
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
desc.setGetterObject(obj->getGetter(shapeProp));
|
||||
desc.setSetterObject(obj->getSetter(shapeProp));
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
desc.setGetterObject(obj->getGetter(propInfo));
|
||||
desc.setSetterObject(obj->getSetter(propInfo));
|
||||
}
|
||||
} else if (desc.isDataDescriptor() != IsDataDescriptor(prop)) {
|
||||
// Step 6.
|
||||
|
@ -1744,8 +1743,8 @@ bool js::NativeDefineProperty(JSContext* cx, HandleNativeObject obj,
|
|||
}
|
||||
} else {
|
||||
// Step 8.
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
MOZ_ASSERT(shapeProp.isAccessorProperty());
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
MOZ_ASSERT(propInfo.isAccessorProperty());
|
||||
MOZ_ASSERT(desc.isAccessorDescriptor());
|
||||
|
||||
// The spec says to use SameValue, but since the values in
|
||||
|
@ -1753,22 +1752,22 @@ bool js::NativeDefineProperty(JSContext* cx, HandleNativeObject obj,
|
|||
if (desc.hasSetterObject()) {
|
||||
// Step 8.a.i.
|
||||
if (!attrs.configurable() &&
|
||||
desc.setterObject() != obj->getSetter(shapeProp)) {
|
||||
desc.setterObject() != obj->getSetter(propInfo)) {
|
||||
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
||||
}
|
||||
} else {
|
||||
// Fill in desc.[[Set]] from shape.
|
||||
desc.setSetterObject(obj->getSetter(shapeProp));
|
||||
desc.setSetterObject(obj->getSetter(propInfo));
|
||||
}
|
||||
if (desc.hasGetterObject()) {
|
||||
// Step 8.a.ii.
|
||||
if (!attrs.configurable() &&
|
||||
desc.getterObject() != obj->getGetter(shapeProp)) {
|
||||
desc.getterObject() != obj->getGetter(propInfo)) {
|
||||
return result.fail(JSMSG_CANT_REDEFINE_PROP);
|
||||
}
|
||||
} else {
|
||||
// Fill in desc.[[Get]] from shape.
|
||||
desc.setGetterObject(obj->getGetter(shapeProp));
|
||||
desc.setGetterObject(obj->getGetter(propInfo));
|
||||
}
|
||||
|
||||
// Step 8.a.iii (Omitted).
|
||||
|
@ -1965,7 +1964,7 @@ bool js::AddOrUpdateSparseElementHelper(JSContext* cx, HandleArrayObject obj,
|
|||
}
|
||||
|
||||
// At this point we're updating a property: See SetExistingProperty
|
||||
ShapeProperty prop = shape->property();
|
||||
PropertyInfo prop = shape->propertyInfo();
|
||||
if (prop.isDataProperty() && prop.writable()) {
|
||||
obj->setSlot(prop.slot(), v);
|
||||
return true;
|
||||
|
@ -2043,11 +2042,11 @@ bool js::NativeGetOwnPropertyDescriptor(
|
|||
return true;
|
||||
}
|
||||
|
||||
if (prop.isNativeProperty() && prop.shapeProperty().isAccessorProperty()) {
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
if (prop.isNativeProperty() && prop.propertyInfo().isAccessorProperty()) {
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
desc.set(mozilla::Some(PropertyDescriptor::Accessor(
|
||||
obj->getGetter(shapeProp), obj->getSetter(shapeProp),
|
||||
shapeProp.propAttributes())));
|
||||
obj->getGetter(propInfo), obj->getSetter(propInfo),
|
||||
propInfo.propAttributes())));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2094,7 +2093,7 @@ static bool GetCustomDataProperty(JSContext* cx, HandleObject obj, HandleId id,
|
|||
|
||||
static inline bool CallGetter(JSContext* cx, HandleNativeObject obj,
|
||||
HandleValue receiver, HandleId id,
|
||||
ShapeProperty prop, MutableHandleValue vp) {
|
||||
PropertyInfo prop, MutableHandleValue vp) {
|
||||
MOZ_ASSERT(!prop.isDataProperty());
|
||||
|
||||
if (prop.isAccessorProperty()) {
|
||||
|
@ -2111,7 +2110,7 @@ template <AllowGC allowGC>
|
|||
static MOZ_ALWAYS_INLINE bool GetExistingProperty(
|
||||
JSContext* cx, typename MaybeRooted<Value, allowGC>::HandleType receiver,
|
||||
typename MaybeRooted<NativeObject*, allowGC>::HandleType obj,
|
||||
typename MaybeRooted<jsid, allowGC>::HandleType id, ShapeProperty prop,
|
||||
typename MaybeRooted<jsid, allowGC>::HandleType id, PropertyInfo prop,
|
||||
typename MaybeRooted<Value, allowGC>::MutableHandleType vp) {
|
||||
if (prop.isDataProperty()) {
|
||||
vp.set(obj->getSlot(prop.slot()));
|
||||
|
@ -2133,7 +2132,7 @@ static MOZ_ALWAYS_INLINE bool GetExistingProperty(
|
|||
|
||||
bool js::NativeGetExistingProperty(JSContext* cx, HandleObject receiver,
|
||||
HandleNativeObject obj, HandleId id,
|
||||
ShapeProperty prop, MutableHandleValue vp) {
|
||||
PropertyInfo prop, MutableHandleValue vp) {
|
||||
RootedValue receiverValue(cx, ObjectValue(*receiver));
|
||||
return GetExistingProperty<CanGC>(cx, receiverValue, obj, id, prop, vp);
|
||||
}
|
||||
|
@ -2238,8 +2237,8 @@ bool js::GetSparseElementHelper(JSContext* cx, HandleArrayObject obj,
|
|||
}
|
||||
|
||||
RootedValue receiver(cx, ObjectValue(*obj));
|
||||
return GetExistingProperty<CanGC>(cx, receiver, obj, id, shape->property(),
|
||||
result);
|
||||
return GetExistingProperty<CanGC>(cx, receiver, obj, id,
|
||||
shape->propertyInfo(), result);
|
||||
}
|
||||
|
||||
template <AllowGC allowGC>
|
||||
|
@ -2273,7 +2272,7 @@ static MOZ_ALWAYS_INLINE bool NativeGetPropertyInline(
|
|||
}
|
||||
|
||||
return GetExistingProperty<allowGC>(cx, receiver, pobj, id,
|
||||
prop.shapeProperty(), vp);
|
||||
prop.propertyInfo(), vp);
|
||||
}
|
||||
|
||||
// Steps 4.a-b.
|
||||
|
@ -2405,7 +2404,7 @@ static bool MaybeReportUndeclaredVarAssignment(JSContext* cx, HandleId id) {
|
|||
* conforms to no standard and there is a lot of legacy baggage here.
|
||||
*/
|
||||
static bool NativeSetExistingDataProperty(JSContext* cx, HandleNativeObject obj,
|
||||
HandleId id, ShapeProperty prop,
|
||||
HandleId id, PropertyInfo prop,
|
||||
HandleValue v,
|
||||
ObjectOpResult& result) {
|
||||
MOZ_ASSERT(obj->is<NativeObject>());
|
||||
|
@ -2602,10 +2601,10 @@ static bool SetExistingProperty(JSContext* cx, HandleId id, HandleValue v,
|
|||
}
|
||||
|
||||
// Step 5 for all other properties.
|
||||
ShapeProperty shapeProp = prop.shapeProperty();
|
||||
if (shapeProp.isDataDescriptor()) {
|
||||
PropertyInfo propInfo = prop.propertyInfo();
|
||||
if (propInfo.isDataDescriptor()) {
|
||||
// Step 5.a.
|
||||
if (!shapeProp.writable()) {
|
||||
if (!propInfo.writable()) {
|
||||
return result.fail(JSMSG_READ_ONLY);
|
||||
}
|
||||
|
||||
|
@ -2616,7 +2615,7 @@ static bool SetExistingProperty(JSContext* cx, HandleId id, HandleValue v,
|
|||
// result is |shapeProp|.
|
||||
|
||||
// Steps 5.e.i-ii.
|
||||
return NativeSetExistingDataProperty(cx, pobj, id, shapeProp, v, result);
|
||||
return NativeSetExistingDataProperty(cx, pobj, id, propInfo, v, result);
|
||||
}
|
||||
|
||||
// Shadow pobj[id] by defining a new data property receiver[id].
|
||||
|
@ -2625,9 +2624,9 @@ static bool SetExistingProperty(JSContext* cx, HandleId id, HandleValue v,
|
|||
}
|
||||
|
||||
// Steps 6-11.
|
||||
MOZ_ASSERT(shapeProp.isAccessorProperty());
|
||||
MOZ_ASSERT(propInfo.isAccessorProperty());
|
||||
|
||||
JSObject* setterObject = pobj->getSetter(shapeProp);
|
||||
JSObject* setterObject = pobj->getSetter(propInfo);
|
||||
if (!setterObject) {
|
||||
return result.fail(JSMSG_GETTER_ONLY);
|
||||
}
|
||||
|
|
|
@ -572,7 +572,7 @@ class NativeObject : public JSObject {
|
|||
}
|
||||
|
||||
PropertyInfoWithKey getLastProperty() const {
|
||||
return shape()->propertyWithKey();
|
||||
return shape()->propertyInfoWithKey();
|
||||
}
|
||||
|
||||
uint32_t propertyCount() const { return lastProperty()->entryCount(); }
|
||||
|
@ -904,8 +904,8 @@ class NativeObject : public JSObject {
|
|||
|
||||
bool empty() const { return lastProperty()->isEmptyShape(); }
|
||||
|
||||
mozilla::Maybe<ShapeProperty> lookup(JSContext* cx, jsid id);
|
||||
mozilla::Maybe<ShapeProperty> lookup(JSContext* cx, PropertyName* name) {
|
||||
mozilla::Maybe<PropertyInfo> lookup(JSContext* cx, jsid id);
|
||||
mozilla::Maybe<PropertyInfo> lookup(JSContext* cx, PropertyName* name) {
|
||||
return lookup(cx, NameToId(name));
|
||||
}
|
||||
|
||||
|
@ -913,21 +913,21 @@ class NativeObject : public JSObject {
|
|||
bool contains(JSContext* cx, PropertyName* name) {
|
||||
return lookup(cx, name).isSome();
|
||||
}
|
||||
bool contains(JSContext* cx, jsid id, ShapeProperty prop) {
|
||||
mozilla::Maybe<ShapeProperty> found = lookup(cx, id);
|
||||
bool contains(JSContext* cx, jsid id, PropertyInfo prop) {
|
||||
mozilla::Maybe<PropertyInfo> found = lookup(cx, id);
|
||||
return found.isSome() && *found == prop;
|
||||
}
|
||||
|
||||
/* Contextless; can be called from other pure code. */
|
||||
mozilla::Maybe<ShapeProperty> lookupPure(jsid id);
|
||||
mozilla::Maybe<ShapeProperty> lookupPure(PropertyName* name) {
|
||||
mozilla::Maybe<PropertyInfo> lookupPure(jsid id);
|
||||
mozilla::Maybe<PropertyInfo> lookupPure(PropertyName* name) {
|
||||
return lookupPure(NameToId(name));
|
||||
}
|
||||
|
||||
bool containsPure(jsid id) { return lookupPure(id).isSome(); }
|
||||
bool containsPure(PropertyName* name) { return containsPure(NameToId(name)); }
|
||||
bool containsPure(jsid id, ShapeProperty prop) {
|
||||
mozilla::Maybe<ShapeProperty> found = lookupPure(id);
|
||||
bool containsPure(jsid id, PropertyInfo prop) {
|
||||
mozilla::Maybe<PropertyInfo> found = lookupPure(id);
|
||||
return found.isSome() && *found == prop;
|
||||
}
|
||||
|
||||
|
@ -1093,7 +1093,7 @@ class NativeObject : public JSObject {
|
|||
GetterSetter* getGetterSetter(uint32_t slot) const {
|
||||
return getSlot(slot).toGCThing()->as<GetterSetter>();
|
||||
}
|
||||
GetterSetter* getGetterSetter(ShapeProperty prop) const {
|
||||
GetterSetter* getGetterSetter(PropertyInfo prop) const {
|
||||
MOZ_ASSERT(prop.isAccessorProperty());
|
||||
return getGetterSetter(prop.slot());
|
||||
}
|
||||
|
@ -1103,32 +1103,32 @@ class NativeObject : public JSObject {
|
|||
JSObject* getGetter(uint32_t slot) const {
|
||||
return getGetterSetter(slot)->getter();
|
||||
}
|
||||
JSObject* getGetter(ShapeProperty prop) const {
|
||||
JSObject* getGetter(PropertyInfo prop) const {
|
||||
return getGetterSetter(prop)->getter();
|
||||
}
|
||||
JSObject* getSetter(ShapeProperty prop) const {
|
||||
JSObject* getSetter(PropertyInfo prop) const {
|
||||
return getGetterSetter(prop)->setter();
|
||||
}
|
||||
|
||||
// Returns true if the property has a non-nullptr getter or setter object.
|
||||
// |prop| can be any property.
|
||||
bool hasGetter(ShapeProperty prop) const {
|
||||
bool hasGetter(PropertyInfo prop) const {
|
||||
return prop.isAccessorProperty() && getGetter(prop);
|
||||
}
|
||||
bool hasSetter(ShapeProperty prop) const {
|
||||
bool hasSetter(PropertyInfo prop) const {
|
||||
return prop.isAccessorProperty() && getSetter(prop);
|
||||
}
|
||||
|
||||
// If the property has a non-nullptr getter/setter, return it as ObjectValue.
|
||||
// Else return |undefined|. |prop| must be an accessor property.
|
||||
Value getGetterValue(ShapeProperty prop) const {
|
||||
Value getGetterValue(PropertyInfo prop) const {
|
||||
MOZ_ASSERT(prop.isAccessorProperty());
|
||||
if (JSObject* getterObj = getGetter(prop)) {
|
||||
return ObjectValue(*getterObj);
|
||||
}
|
||||
return UndefinedValue();
|
||||
}
|
||||
Value getSetterValue(ShapeProperty prop) const {
|
||||
Value getSetterValue(PropertyInfo prop) const {
|
||||
MOZ_ASSERT(prop.isAccessorProperty());
|
||||
if (JSObject* setterObj = getSetter(prop)) {
|
||||
return ObjectValue(*setterObj);
|
||||
|
@ -1708,8 +1708,7 @@ extern bool NativeLookupOwnProperty(
|
|||
*/
|
||||
extern bool NativeGetExistingProperty(JSContext* cx, HandleObject receiver,
|
||||
HandleNativeObject obj, HandleId id,
|
||||
ShapeProperty prop,
|
||||
MutableHandleValue vp);
|
||||
PropertyInfo prop, MutableHandleValue vp);
|
||||
|
||||
/* * */
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ bool js::ForOfPIC::Chain::initialize(JSContext* cx) {
|
|||
disabled_ = true;
|
||||
|
||||
// Look up Array.prototype[@@iterator], ensure it's a slotful shape.
|
||||
mozilla::Maybe<ShapeProperty> iterProp =
|
||||
mozilla::Maybe<PropertyInfo> iterProp =
|
||||
arrayProto->lookup(cx, SYMBOL_TO_JSID(cx->wellKnownSymbols().iterator));
|
||||
if (iterProp.isNothing() || !iterProp->isDataProperty()) {
|
||||
return true;
|
||||
|
@ -84,7 +84,7 @@ bool js::ForOfPIC::Chain::initialize(JSContext* cx) {
|
|||
}
|
||||
|
||||
// Look up the 'next' value on ArrayIterator.prototype
|
||||
mozilla::Maybe<ShapeProperty> nextProp =
|
||||
mozilla::Maybe<PropertyInfo> nextProp =
|
||||
arrayIteratorProto->lookup(cx, cx->names().next);
|
||||
if (nextProp.isNothing() || !nextProp->isDataProperty()) {
|
||||
return true;
|
||||
|
|
|
@ -82,7 +82,7 @@ void js::PromiseLookup::initialize(JSContext* cx) {
|
|||
|
||||
// Check condition 2:
|
||||
// Look up Promise.prototype.constructor and ensure it's a data property.
|
||||
mozilla::Maybe<ShapeProperty> ctorProp =
|
||||
mozilla::Maybe<PropertyInfo> ctorProp =
|
||||
promiseProto->lookup(cx, cx->names().constructor);
|
||||
if (ctorProp.isNothing() || !ctorProp->isDataProperty()) {
|
||||
return;
|
||||
|
@ -100,7 +100,7 @@ void js::PromiseLookup::initialize(JSContext* cx) {
|
|||
|
||||
// Check condition 3:
|
||||
// Look up Promise.prototype.then and ensure it's a data property.
|
||||
mozilla::Maybe<ShapeProperty> thenProp =
|
||||
mozilla::Maybe<PropertyInfo> thenProp =
|
||||
promiseProto->lookup(cx, cx->names().then);
|
||||
if (thenProp.isNothing() || !thenProp->isDataProperty()) {
|
||||
return;
|
||||
|
@ -114,7 +114,7 @@ void js::PromiseLookup::initialize(JSContext* cx) {
|
|||
|
||||
// Check condition 4:
|
||||
// Look up the '@@species' value on Promise.
|
||||
mozilla::Maybe<ShapeProperty> speciesProp =
|
||||
mozilla::Maybe<PropertyInfo> speciesProp =
|
||||
promiseCtor->lookup(cx, SYMBOL_TO_JSID(cx->wellKnownSymbols().species));
|
||||
if (speciesProp.isNothing() || !promiseCtor->hasGetter(*speciesProp)) {
|
||||
return;
|
||||
|
@ -130,7 +130,7 @@ void js::PromiseLookup::initialize(JSContext* cx) {
|
|||
|
||||
// Check condition 5:
|
||||
// Look up Promise.resolve and ensure it's a data property.
|
||||
mozilla::Maybe<ShapeProperty> resolveProp =
|
||||
mozilla::Maybe<PropertyInfo> resolveProp =
|
||||
promiseCtor->lookup(cx, cx->names().resolve);
|
||||
if (resolveProp.isNothing() || !resolveProp->isDataProperty()) {
|
||||
return;
|
||||
|
|
|
@ -26,7 +26,7 @@ class PropertyResult {
|
|||
};
|
||||
union {
|
||||
// Set if kind is NativeProperty.
|
||||
ShapeProperty shapeProp_;
|
||||
PropertyInfo propInfo_;
|
||||
// Set if kind is DenseElement.
|
||||
uint32_t denseIndex_;
|
||||
// Set if kind is TypedArrayElement.
|
||||
|
@ -36,7 +36,7 @@ class PropertyResult {
|
|||
bool ignoreProtoChain_ = false;
|
||||
|
||||
public:
|
||||
// Note: because ShapeProperty does not have a default constructor, we can't
|
||||
// Note: because PropertyInfo does not have a default constructor, we can't
|
||||
// use |= default| here.
|
||||
PropertyResult() {}
|
||||
|
||||
|
@ -56,9 +56,9 @@ class PropertyResult {
|
|||
bool isTypedArrayElement() const { return kind_ == Kind::TypedArrayElement; }
|
||||
bool isNativeProperty() const { return kind_ == Kind::NativeProperty; }
|
||||
|
||||
ShapeProperty shapeProperty() const {
|
||||
PropertyInfo propertyInfo() const {
|
||||
MOZ_ASSERT(isNativeProperty());
|
||||
return shapeProp_;
|
||||
return propInfo_;
|
||||
}
|
||||
|
||||
uint32_t denseElementIndex() const {
|
||||
|
@ -73,9 +73,9 @@ class PropertyResult {
|
|||
|
||||
void setNotFound() { kind_ = Kind::NotFound; }
|
||||
|
||||
void setNativeProperty(ShapeProperty prop) {
|
||||
void setNativeProperty(PropertyInfo prop) {
|
||||
kind_ = Kind::NativeProperty;
|
||||
shapeProp_ = prop;
|
||||
propInfo_ = prop;
|
||||
}
|
||||
|
||||
void setTypedObjectProperty() { kind_ = Kind::NonNativeProperty; }
|
||||
|
|
|
@ -1815,7 +1815,7 @@ static bool intrinsic_CreateNamespaceBinding(JSContext* cx, unsigned argc,
|
|||
MOZ_ASSERT(args[2].toObject().is<ModuleNamespaceObject>());
|
||||
// The property already exists in the evironment but is not writable, so set
|
||||
// the slot directly.
|
||||
mozilla::Maybe<ShapeProperty> prop = environment->lookup(cx, name);
|
||||
mozilla::Maybe<PropertyInfo> prop = environment->lookup(cx, name);
|
||||
MOZ_ASSERT(prop.isSome());
|
||||
environment->setSlot(prop->slot(), args[2]);
|
||||
args.rval().setUndefined();
|
||||
|
@ -1832,7 +1832,7 @@ static bool intrinsic_EnsureModuleEnvironmentNamespace(JSContext* cx,
|
|||
RootedModuleEnvironmentObject environment(cx, &module->initialEnvironment());
|
||||
// The property already exists in the evironment but is not writable, so set
|
||||
// the slot directly.
|
||||
mozilla::Maybe<ShapeProperty> prop =
|
||||
mozilla::Maybe<PropertyInfo> prop =
|
||||
environment->lookup(cx, cx->names().starNamespaceStar);
|
||||
MOZ_ASSERT(prop.isSome());
|
||||
environment->setSlot(prop->slot(), args[1]);
|
||||
|
@ -2881,7 +2881,7 @@ static void GetUnclonedValue(NativeObject* selfHostedObject,
|
|||
// non-permanent atoms here should be impossible.
|
||||
MOZ_ASSERT_IF(JSID_IS_STRING(id), JSID_TO_STRING(id)->isPermanentAtom());
|
||||
|
||||
mozilla::Maybe<ShapeProperty> prop = selfHostedObject->lookupPure(id);
|
||||
mozilla::Maybe<PropertyInfo> prop = selfHostedObject->lookupPure(id);
|
||||
MOZ_ASSERT(prop.isSome());
|
||||
MOZ_ASSERT(prop->isDataProperty());
|
||||
*vp = selfHostedObject->getSlot(prop->slot());
|
||||
|
@ -2919,7 +2919,7 @@ static bool CloneProperties(JSContext* cx, HandleNativeObject selfHostedObject,
|
|||
if (!ids.append(props[i].key())) {
|
||||
return false;
|
||||
}
|
||||
ShapeProperty prop = props[i];
|
||||
PropertyInfo prop = props[i];
|
||||
uint8_t propAttrs = 0;
|
||||
if (prop.enumerable()) {
|
||||
propAttrs |= JSPROP_ENUMERATE;
|
||||
|
|
|
@ -169,7 +169,7 @@ static inline JS::PropertyAttributes GetPropertyAttributes(
|
|||
JS::PropertyAttribute::Enumerable, JS::PropertyAttribute::Writable};
|
||||
}
|
||||
|
||||
return prop.shapeProperty().propAttributes();
|
||||
return prop.propertyInfo().propAttributes();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -664,7 +664,7 @@ bool NativeObject::addEnumerableDataProperty(JSContext* cx,
|
|||
break;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(child->property().isDataProperty());
|
||||
MOZ_ASSERT(child->propertyInfo().isDataProperty());
|
||||
|
||||
child = PropertyTreeReadBarrier(cx, lastProperty, child);
|
||||
if (!child) {
|
||||
|
@ -746,7 +746,7 @@ bool NativeObject::addEnumerableDataProperty(JSContext* cx,
|
|||
*/
|
||||
static void AssertCanChangeFlags(Shape* shape, PropertyFlags flags) {
|
||||
#ifdef DEBUG
|
||||
ShapeProperty prop = shape->property();
|
||||
PropertyInfo prop = shape->propertyInfo();
|
||||
if (prop.configurable()) {
|
||||
return;
|
||||
}
|
||||
|
@ -823,7 +823,7 @@ bool NativeObject::changeProperty(JSContext* cx, HandleNativeObject obj,
|
|||
ObjectFlags objectFlags =
|
||||
GetObjectFlagsForNewProperty(obj->lastProperty(), id, flags, cx);
|
||||
|
||||
if (shape->property().isAccessorProperty()) {
|
||||
if (shape->propertyInfo().isAccessorProperty()) {
|
||||
objectFlags.setFlag(ObjectFlag::HadGetterSetterChange);
|
||||
}
|
||||
|
||||
|
@ -1026,7 +1026,8 @@ bool NativeObject::removeProperty(JSContext* cx, HandleNativeObject obj,
|
|||
// object flag is set. This is necessary because the slot holding the
|
||||
// GetterSetter can be changed indirectly by removing the property and then
|
||||
// adding it back with a different GetterSetter value but the same shape.
|
||||
if (shape->property().isAccessorProperty() && !obj->hadGetterSetterChange()) {
|
||||
if (shape->propertyInfo().isAccessorProperty() &&
|
||||
!obj->hadGetterSetterChange()) {
|
||||
if (!NativeObject::setHadGetterSetterChange(cx, obj)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1059,12 +1059,12 @@ class Shape : public gc::CellWithTenuredGCPointer<gc::TenuredCell, BaseShape> {
|
|||
}
|
||||
|
||||
public:
|
||||
ShapeProperty property() const {
|
||||
PropertyInfo propertyInfo() const {
|
||||
MOZ_ASSERT(!isEmptyShape());
|
||||
return ShapeProperty(propFlags, maybeSlot());
|
||||
return PropertyInfo(propFlags, maybeSlot());
|
||||
}
|
||||
|
||||
PropertyInfoWithKey propertyWithKey() const {
|
||||
PropertyInfoWithKey propertyInfoWithKey() const {
|
||||
return PropertyInfoWithKey(propFlags, maybeSlot(), propid());
|
||||
}
|
||||
|
||||
|
@ -1482,7 +1482,7 @@ class MOZ_RAII ShapePropertyIter {
|
|||
|
||||
PropertyInfoWithKey get() const {
|
||||
MOZ_ASSERT(!done());
|
||||
return cursor_->propertyWithKey();
|
||||
return cursor_->propertyInfoWithKey();
|
||||
}
|
||||
|
||||
PropertyInfoWithKey operator*() const { return get(); }
|
||||
|
|
|
@ -84,10 +84,10 @@ constexpr PropertyFlags PropertyFlags::defaultDataPropFlags = {
|
|||
PropertyFlag::Configurable, PropertyFlag::Enumerable,
|
||||
PropertyFlag::Writable};
|
||||
|
||||
// ShapeProperty contains information (PropertyFlags, slot number) for a
|
||||
// PropertyInfo contains information (PropertyFlags, slot number) for a
|
||||
// property stored in the Shape tree. Property lookups on NativeObjects return a
|
||||
// ShapeProperty.
|
||||
class ShapeProperty {
|
||||
// PropertyInfo.
|
||||
class PropertyInfo {
|
||||
static constexpr uint32_t FlagsMask = 0xff;
|
||||
static constexpr uint32_t SlotShift = 8;
|
||||
|
||||
|
@ -99,13 +99,13 @@ class ShapeProperty {
|
|||
"SHAPE_MAXIMUM_SLOT must fit in slotAndFlags_");
|
||||
|
||||
public:
|
||||
ShapeProperty(PropertyFlags flags, uint32_t slot)
|
||||
PropertyInfo(PropertyFlags flags, uint32_t slot)
|
||||
: slotAndFlags_((slot << SlotShift) | flags.toRaw()) {
|
||||
MOZ_ASSERT(maybeSlot() == slot);
|
||||
MOZ_ASSERT(this->flags() == flags);
|
||||
}
|
||||
|
||||
ShapeProperty(const ShapeProperty& other) = default;
|
||||
PropertyInfo(const PropertyInfo& other) = default;
|
||||
|
||||
bool isDataProperty() const { return flags().isDataProperty(); }
|
||||
bool isCustomDataProperty() const { return flags().isCustomDataProperty(); }
|
||||
|
@ -143,20 +143,20 @@ class ShapeProperty {
|
|||
return attrs;
|
||||
}
|
||||
|
||||
bool operator==(const ShapeProperty& other) const {
|
||||
bool operator==(const PropertyInfo& other) const {
|
||||
return slotAndFlags_ == other.slotAndFlags_;
|
||||
}
|
||||
bool operator!=(const ShapeProperty& other) const {
|
||||
bool operator!=(const PropertyInfo& other) const {
|
||||
return !operator==(other);
|
||||
}
|
||||
};
|
||||
|
||||
class PropertyInfoWithKey : public ShapeProperty {
|
||||
class PropertyInfoWithKey : public PropertyInfo {
|
||||
PropertyKey key_;
|
||||
|
||||
public:
|
||||
PropertyInfoWithKey(PropertyFlags flags, uint32_t slot, PropertyKey key)
|
||||
: ShapeProperty(flags, slot), key_(key) {}
|
||||
: PropertyInfo(flags, slot), key_(key) {}
|
||||
|
||||
PropertyKey key() const { return key_; }
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче