11#include <private/qprimefornumbits_p.h>
79SharedInternalClassDataPrivate<PropertyKey>::SharedInternalClassDataPrivate(
const SharedInternalClassDataPrivate<PropertyKey> &
other,
92 const uint a = alloc() * 2;
101 return data ?
data->values.alloc : 0;
106 return data ?
data->values.size : 0;
112 data->values.size =
s;
126 if (
auto string =
t.asStringOrSymbol())
129 data->values.values[
i].rawValueRef() =
t.id();
139 const SharedInternalClassDataPrivate<PropertyAttributes> &
other,
uint pos,
144 m_engine(
other.m_engine)
149 m_engine->memoryManager->changeUnmanagedHeapSizeUsage(m_alloc *
sizeof(
PropertyAttributes));
152 :
other.m_inlineData;
154 if (m_alloc > NumAttributesInPointer)
164 const SharedInternalClassDataPrivate<PropertyAttributes> &
other)
166 m_alloc(
other.m_alloc),
167 m_size(
other.m_size),
168 m_engine(
other.m_engine)
170 m_engine->memoryManager->changeUnmanagedHeapSizeUsage(m_alloc *
sizeof(
PropertyAttributes));
171 if (m_alloc > NumAttributesInPointer) {
174 }
else if (m_alloc > 0) {
183 m_engine->memoryManager->changeUnmanagedHeapSizeUsage(
185 if (m_alloc > NumAttributesInPointer)
192 alloc = NumAttributesInPointer;
193 m_engine->memoryManager->changeUnmanagedHeapSizeUsage(alloc *
sizeof(
PropertyAttributes));
197 if (currentSize <
uint(std::numeric_limits<int>::max() / 2))
202 m_engine->memoryManager->changeUnmanagedHeapSizeUsage(
206 if (alloc > NumAttributesInPointer) {
208 if (m_alloc > NumAttributesInPointer) {
211 }
else if (m_alloc > 0) {
234 new (&
transitions) QVarLengthArray<Transition, 1>();
237 vtable = QV4::InternalClass::staticVTable();
249 new (&
nameMap) SharedInternalClassData<PropertyKey>(
other->nameMap);
250 new (&
propertyData) SharedInternalClassData<PropertyAttributes>(
other->propertyData);
251 new (&
transitions) QVarLengthArray<Transition, 1>();
277 t.lookup->parent =
nullptr;
282 parent->removeChildEntry(
this);
297 if (
key.isArrayIndex())
300 return key.asStringOrSymbol()->asReturnedValue();
309 object->setInternalClass(newClass);
346 QVarLengthArray<InternalClassTransition, 1> transitions;
349 Scoped<QV4::InternalClass>
child(scope, orig);
354 int structureChanges = 0;
356 Scoped<QV4::InternalClass> parent(scope, orig->
parent);
357 while (parent && remainingRedundantTransitions > 0) {
359 const auto it = std::find_if(
360 parent->d()->transitions.begin(), parent->d()->transitions.end(),
362 return child->d() == t.lookup;
364 Q_ASSERT(
it != parent->d()->transitions.end());
368 if ((structureChanges &
it->flags) !=
it->flags) {
369 transitions.push_back(*
it);
370 structureChanges |=
it->flags;
372 --remainingRedundantTransitions;
381 transitions.push_back(*
it);
383 --remainingRedundantTransitions;
387 parent =
child->d()->parent;
392 for (
auto it = transitions.rbegin();
it != transitions.rend(); ++
it) {
475 proto->setUsedAsProto();
477 Q_ASSERT(!proto || proto->internalClass->isUsedAsProto());
480 temp.prototype = proto;
492 newClass->prototype = proto;
498Heap::InternalClass *InternalClass::changeVTableImpl(
const VTable *vt)
516 return vtable == QV4::InternalClass::staticVTable()
569 object->setInternalClass(newClass);
582 return addMemberImpl(identifier,
data,
entry);
592 entry->setterIndex =
data.isAccessor() ?
size + 1 : UINT_MAX;
602 InternalClass *newClass = ic->d();
603 PropertyHash::Entry e = { identifier, newClass->size,
data.isAccessor() ? newClass->size + 1 : UINT_MAX };
604 newClass->propertyTable.addEntry(e, newClass->size);
606 newClass->nameMap.add(newClass->size, identifier);
607 newClass->propertyData.add(newClass->size,
data);
609 if (
data.isAccessor())
617void InternalClass::removeChildEntry(InternalClass *
child)
634 Q_ASSERT(oldClass->findEntry(identifier) !=
nullptr);
643 ||
object->internalClass()->size == oldClass->size);
669 attrs.setConfigurable(
false);
701 attrs.setWritable(
false);
702 attrs.setConfigurable(
false);
715 Scoped<QV4::InternalClass> ic(scope,
sealed());
716 return ic->d()->nonExtensible();
723 Scoped<QV4::InternalClass> ic(scope,
frozen());
724 return ic->d()->canned();
typename Base::iterator iterator
QSet< QString >::iterator it
Combined button and popup list for selecting options.
static void updateProtoUsage(Heap::Object *o, Heap::InternalClass *ic)
static Heap::InternalClass * cleanInternalClass(Heap::InternalClass *orig)
static PropertyAttributes attributesFromFlags(int flags)
static void addDummyEntry(InternalClass *newClass, PropertyHash::Entry e)
static const QCssKnownValue properties[NumProperties - 1]
static int grow(QLayoutStruct &ls, int delta)
static struct AttrInfo attrs[]
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
constexpr const T & qMin(const T &a, const T &b)
GLboolean GLboolean GLboolean b
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLsizei GLsizei GLchar * source
QT_BEGIN_NAMESPACE int qPrimeForNumBits(int numBits)
static constexpr ReturnedValue undefined()
Heap::InternalClass * internalClasses(InternalClassType icType)
Heap::InternalClass * classes[NClasses]
Heap::InternalClass * newClass(Heap::InternalClass *other)
void mark(QV4::MarkStack *markStack)
Pointer< InternalClass *, 0 > internalClass
Q_REQUIRED_RESULT InternalClass * locked()
Q_REQUIRED_RESULT InternalClass * cryopreserved()
static void addMember(QV4::Object *object, PropertyKey id, PropertyAttributes data, InternalClassEntry *entry)
Q_REQUIRED_RESULT InternalClass * sealed()
PropertyHash propertyTable
QVarLengthArray< Transition, 1 > transitions
SharedInternalClassData< PropertyKey > nameMap
Q_REQUIRED_RESULT InternalClass * nonExtensible()
bool isUsedAsProto() const
@ MaxRedundantTransitions
Q_REQUIRED_RESULT InternalClass * frozen()
Q_REQUIRED_RESULT InternalClass * canned()
Q_QML_EXPORT ReturnedValue keyAt(uint index) const
bool isImplicitlyFrozen() const
quint8 numRedundantTransitions
InternalClassTransition Transition
Q_REQUIRED_RESULT InternalClass * asProtoClass()
bool isExtensible() const
Q_REQUIRED_RESULT InternalClass * changeMember(PropertyKey identifier, PropertyAttributes data, InternalClassEntry *entry=nullptr)
InternalClassTransition & lookupOrInsertTransition(const InternalClassTransition &t)
static void markObjects(Heap::Base *ic, MarkStack *stack)
static void removeMember(QV4::Object *object, PropertyKey identifier)
void updateProtoUsage(Heap::Object *o)
PropertyHash::Entry * findEntry(const PropertyKey id)
SharedInternalClassData< PropertyAttributes > propertyData
static Heap::MemberData * allocate(QV4::ExecutionEngine *e, uint n, Heap::MemberData *old=nullptr)
PropertyHashData(int numBits)
PropertyHash::Entry * entries
void addEntry(const Entry &entry, int classSize)
void detach(bool grow, int classSize)
bool isStringOrSymbol() const
static PropertyKey fromId(quint64 id)
static PropertyKey invalid()
static constexpr Value fromReturnedValue(ReturnedValue val)
static void markCustom(Engine *engine, F &&markFunction)
static constexpr bool isInsertionBarrier