-unsigned PropertyDescriptor::attributesWithOverride(const PropertyDescriptor& other) const
-{
- unsigned mismatch = other.m_attributes ^ m_attributes;
- unsigned sharedSeen = other.m_seenAttributes & m_seenAttributes;
- unsigned newAttributes = m_attributes & defaultAttributes;
- if (sharedSeen & WritablePresent && mismatch & ReadOnly)
- newAttributes ^= ReadOnly;
- if (sharedSeen & ConfigurablePresent && mismatch & DontDelete)
- newAttributes ^= DontDelete;
- if (sharedSeen & EnumerablePresent && mismatch & DontEnum)
- newAttributes ^= DontEnum;
- return newAttributes;
+unsigned PropertyDescriptor::attributesOverridingCurrent(const PropertyDescriptor& current) const
+{
+ unsigned currentAttributes = current.m_attributes;
+ if (isDataDescriptor() && current.isAccessorDescriptor())
+ currentAttributes |= ReadOnly;
+ unsigned overrideMask = 0;
+ if (writablePresent())
+ overrideMask |= ReadOnly;
+ if (enumerablePresent())
+ overrideMask |= DontEnum;
+ if (configurablePresent())
+ overrideMask |= DontDelete;
+ if (isAccessorDescriptor())
+ overrideMask |= Accessor;
+ return (m_attributes & overrideMask) | (currentAttributes & ~overrideMask);