aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-01-10 20:35:18 +0100
committerLars Knoll <lars.knoll@digia.com>2015-01-21 13:18:38 +0100
commit85bf8d732b9651ce7b88d5464b8b3aae138e1893 (patch)
tree321d5a2471be898670a49b7bc942d1f13de4bd58 /src/qml/jsruntime
parent7ee429dd7a12dc38a4e4af8888325d111883a2ff (diff)
Remove the remaining bit of code that use the vtable in the internalClass
Change-Id: Ia52f0e6db325aab37477d455f163487b319dce29 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4arraybuffer.cpp2
-rw-r--r--src/qml/jsruntime/qv4arraydata_p.h2
-rw-r--r--src/qml/jsruntime/qv4dataview.cpp2
-rw-r--r--src/qml/jsruntime/qv4dateobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4dateobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4engine.cpp78
-rw-r--r--src/qml/jsruntime/qv4engine_p.h28
-rw-r--r--src/qml/jsruntime/qv4errorobject.cpp22
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4internalclass.cpp52
-rw-r--r--src/qml/jsruntime/qv4internalclass_p.h11
-rw-r--r--src/qml/jsruntime/qv4jsonobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4managed.cpp2
-rw-r--r--src/qml/jsruntime/qv4mathobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4memberdata.cpp2
-rw-r--r--src/qml/jsruntime/qv4object_p.h6
-rw-r--r--src/qml/jsruntime/qv4regexp.cpp2
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4regexpobject_p.h2
-rw-r--r--src/qml/jsruntime/qv4sequenceobject.cpp4
-rw-r--r--src/qml/jsruntime/qv4string.cpp4
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp2
-rw-r--r--src/qml/jsruntime/qv4typedarray.cpp2
-rw-r--r--src/qml/jsruntime/qv4variantobject.cpp2
24 files changed, 66 insertions, 175 deletions
diff --git a/src/qml/jsruntime/qv4arraybuffer.cpp b/src/qml/jsruntime/qv4arraybuffer.cpp
index f54161ea18..665d7cfced 100644
--- a/src/qml/jsruntime/qv4arraybuffer.cpp
+++ b/src/qml/jsruntime/qv4arraybuffer.cpp
@@ -84,7 +84,7 @@ ReturnedValue ArrayBufferCtor::method_isView(CallContext *ctx)
Heap::ArrayBuffer::ArrayBuffer(ExecutionEngine *e, int length)
- : Heap::Object(e->arrayBufferClass, e->arrayBufferPrototype.asObject())
+ : Heap::Object(e->emptyClass, e->arrayBufferPrototype.asObject())
{
data = QTypedArrayData<char>::allocate(length + 1);
if (!data) {
diff --git a/src/qml/jsruntime/qv4arraydata_p.h b/src/qml/jsruntime/qv4arraydata_p.h
index 2ba6cedf90..e32aea7423 100644
--- a/src/qml/jsruntime/qv4arraydata_p.h
+++ b/src/qml/jsruntime/qv4arraydata_p.h
@@ -119,7 +119,7 @@ struct ArrayData : public Base {
struct SimpleArrayData : public ArrayData {
SimpleArrayData(ExecutionEngine *engine)
- : ArrayData(engine->simpleArrayDataClass)
+ : ArrayData(engine->emptyClass)
{}
uint mappedIndex(uint index) const { return (index + offset) % alloc; }
diff --git a/src/qml/jsruntime/qv4dataview.cpp b/src/qml/jsruntime/qv4dataview.cpp
index 36d597fb6e..6bbf9eeade 100644
--- a/src/qml/jsruntime/qv4dataview.cpp
+++ b/src/qml/jsruntime/qv4dataview.cpp
@@ -77,7 +77,7 @@ ReturnedValue DataViewCtor::call(Managed *that, CallData *callData)
Heap::DataView::DataView(ExecutionEngine *e)
- : Heap::Object(e->dataViewClass, e->dataViewPrototype.asObject()),
+ : Heap::Object(e->emptyClass, e->dataViewPrototype.asObject()),
buffer(0),
byteLength(0),
byteOffset(0)
diff --git a/src/qml/jsruntime/qv4dateobject.cpp b/src/qml/jsruntime/qv4dateobject.cpp
index 4379e3ff94..7c845fd068 100644
--- a/src/qml/jsruntime/qv4dateobject.cpp
+++ b/src/qml/jsruntime/qv4dateobject.cpp
@@ -631,7 +631,7 @@ static double getLocalTZA()
DEFINE_OBJECT_VTABLE(DateObject);
Heap::DateObject::DateObject(QV4::ExecutionEngine *engine, const QDateTime &date)
- : Heap::Object(engine->dateClass, engine->datePrototype.asObject())
+ : Heap::Object(engine->emptyClass, engine->datePrototype.asObject())
{
setVTable(QV4::DateObject::staticVTable());
value.setDouble(date.isValid() ? date.toMSecsSinceEpoch() : qSNaN());
diff --git a/src/qml/jsruntime/qv4dateobject_p.h b/src/qml/jsruntime/qv4dateobject_p.h
index b164de6baa..9b0eb91109 100644
--- a/src/qml/jsruntime/qv4dateobject_p.h
+++ b/src/qml/jsruntime/qv4dateobject_p.h
@@ -53,7 +53,7 @@ struct DateObject : Object {
}
DateObject(QV4::ExecutionEngine *engine, const ValueRef date)
- : Object(engine->dateClass, engine->datePrototype.asObject())
+ : Object(engine->emptyClass, engine->datePrototype.asObject())
{
value = date;
}
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 0ee4dafcf0..a48a78b08e 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -244,9 +244,6 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
classPool = new InternalClassPool;
emptyClass = new (classPool) InternalClass(this);
- executionContextClass = InternalClass::create(this, ExecutionContext::staticVTable());
- stringClass = InternalClass::create(this, String::staticVTable());
- regExpValueClass = InternalClass::create(this, RegExp::staticVTable());
id_empty = newIdentifier(QString());
id_undefined = newIdentifier(QStringLiteral("undefined"));
@@ -285,77 +282,49 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
id_buffer = newIdentifier(QStringLiteral("buffer"));
id_lastIndex = newIdentifier(QStringLiteral("lastIndex"));
- memberDataClass = InternalClass::create(this, MemberData::staticVTable());
+ objectPrototype = memoryManager->alloc<ObjectPrototype>(emptyClass, (QV4::Object *)0);
- objectPrototype = memoryManager->alloc<ObjectPrototype>(InternalClass::create(this, ObjectPrototype::staticVTable()), (QV4::Object *)0);
- objectClass = InternalClass::create(this, Object::staticVTable());
- Q_ASSERT(objectClass->vtable == Object::staticVTable());
-
- arrayClass = InternalClass::create(this, ArrayObject::staticVTable());
- arrayClass = arrayClass->addMember(id_length, Attr_NotConfigurable|Attr_NotEnumerable);
+ arrayClass = emptyClass->addMember(id_length, Attr_NotConfigurable|Attr_NotEnumerable);
arrayPrototype = memoryManager->alloc<ArrayPrototype>(arrayClass, objectPrototype.asObject());
- simpleArrayDataClass = InternalClass::create(this, SimpleArrayData::staticVTable());
-
- InternalClass *argsClass = InternalClass::create(this, ArgumentsObject::staticVTable());
- argsClass = argsClass->addMember(id_length, Attr_NotEnumerable);
+ InternalClass *argsClass = emptyClass->addMember(id_length, Attr_NotEnumerable);
argumentsObjectClass = argsClass->addMember(id_callee, Attr_Data|Attr_NotEnumerable);
strictArgumentsObjectClass = argsClass->addMember(id_callee, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
strictArgumentsObjectClass = strictArgumentsObjectClass->addMember(id_caller, Attr_Accessor|Attr_NotConfigurable|Attr_NotEnumerable);
- Q_ASSERT(argumentsObjectClass->vtable == ArgumentsObject::staticVTable());
- Q_ASSERT(strictArgumentsObjectClass->vtable == ArgumentsObject::staticVTable());
m_globalObject = newObject();
Q_ASSERT(globalObject()->d()->vtable);
initRootContext();
- stringPrototype = memoryManager->alloc<StringPrototype>(InternalClass::create(this, StringPrototype::staticVTable()), objectPrototype.asObject());
- stringObjectClass = InternalClass::create(this, String::staticVTable());
-
- numberPrototype = memoryManager->alloc<NumberPrototype>(InternalClass::create(this, NumberPrototype::staticVTable()), objectPrototype.asObject());
- numberClass = InternalClass::create(this, NumberObject::staticVTable());
+ stringPrototype = memoryManager->alloc<StringPrototype>(emptyClass, objectPrototype.asObject());
+ numberPrototype = memoryManager->alloc<NumberPrototype>(emptyClass, objectPrototype.asObject());
+ booleanPrototype = memoryManager->alloc<BooleanPrototype>(emptyClass, objectPrototype.asObject());
+ datePrototype = memoryManager->alloc<DatePrototype>(emptyClass, objectPrototype.asObject());
- booleanPrototype = memoryManager->alloc<BooleanPrototype>(InternalClass::create(this, BooleanPrototype::staticVTable()), objectPrototype.asObject());
- booleanClass = InternalClass::create(this, BooleanObject::staticVTable());
-
- datePrototype = memoryManager->alloc<DatePrototype>(InternalClass::create(this, DatePrototype::staticVTable()), objectPrototype.asObject());
- dateClass = InternalClass::create(this, DateObject::staticVTable());
-
- InternalClass *functionProtoClass = InternalClass::create(this, FunctionObject::staticVTable());
uint index;
- functionProtoClass = functionProtoClass->addMember(id_prototype, Attr_NotEnumerable, &index);
+ InternalClass *functionProtoClass = emptyClass->addMember(id_prototype, Attr_NotEnumerable, &index);
Q_ASSERT(index == Heap::FunctionObject::Index_Prototype);
functionPrototype = memoryManager->alloc<FunctionPrototype>(functionProtoClass, objectPrototype.asObject());
- functionClass = InternalClass::create(this, FunctionObject::staticVTable());
- functionClass = functionClass->addMember(id_prototype, Attr_NotEnumerable|Attr_NotConfigurable, &index);
+ functionClass = emptyClass->addMember(id_prototype, Attr_NotEnumerable|Attr_NotConfigurable, &index);
Q_ASSERT(index == Heap::FunctionObject::Index_Prototype);
- protoClass = objectClass->addMember(id_constructor, Attr_NotEnumerable, &index);
+ protoClass = emptyClass->addMember(id_constructor, Attr_NotEnumerable, &index);
Q_ASSERT(index == Heap::FunctionObject::Index_ProtoConstructor);
regExpPrototype = memoryManager->alloc<RegExpPrototype>(this);
- regExpClass = InternalClass::create(this, RegExpObject::staticVTable());
regExpExecArrayClass = arrayClass->addMember(id_index, Attr_Data, &index);
Q_ASSERT(index == RegExpObject::Index_ArrayIndex);
regExpExecArrayClass = regExpExecArrayClass->addMember(id_input, Attr_Data, &index);
Q_ASSERT(index == RegExpObject::Index_ArrayInput);
- errorPrototype = memoryManager->alloc<ErrorPrototype>(InternalClass::create(this, ErrorObject::staticVTable()), objectPrototype.asObject());
- errorClass = InternalClass::create(this, ErrorObject::staticVTable());
- evalErrorPrototype = memoryManager->alloc<EvalErrorPrototype>(errorClass, errorPrototype.asObject());
- evalErrorClass = InternalClass::create(this, EvalErrorObject::staticVTable());
- rangeErrorPrototype = memoryManager->alloc<RangeErrorPrototype>(errorClass, errorPrototype.asObject());
- rangeErrorClass = InternalClass::create(this, RangeErrorObject::staticVTable());
- referenceErrorPrototype = memoryManager->alloc<ReferenceErrorPrototype>(errorClass, errorPrototype.asObject());
- referenceErrorClass = InternalClass::create(this, ReferenceErrorObject::staticVTable());
- syntaxErrorPrototype = memoryManager->alloc<SyntaxErrorPrototype>(errorClass, errorPrototype.asObject());
- syntaxErrorClass = InternalClass::create(this, SyntaxErrorObject::staticVTable());
- typeErrorPrototype = memoryManager->alloc<TypeErrorPrototype>(errorClass, errorPrototype.asObject());
- typeErrorClass = InternalClass::create(this, TypeErrorObject::staticVTable());
- uRIErrorPrototype = memoryManager->alloc<URIErrorPrototype>(errorClass, errorPrototype.asObject());
- uriErrorClass = InternalClass::create(this, URIErrorObject::staticVTable());
-
- variantPrototype = memoryManager->alloc<VariantPrototype>(InternalClass::create(this, VariantPrototype::staticVTable()), objectPrototype.asObject());
- variantClass = InternalClass::create(this, VariantObject::staticVTable());
+ errorPrototype = memoryManager->alloc<ErrorPrototype>(emptyClass, objectPrototype.asObject());
+ evalErrorPrototype = memoryManager->alloc<EvalErrorPrototype>(emptyClass, errorPrototype.asObject());
+ rangeErrorPrototype = memoryManager->alloc<RangeErrorPrototype>(emptyClass, errorPrototype.asObject());
+ referenceErrorPrototype = memoryManager->alloc<ReferenceErrorPrototype>(emptyClass, errorPrototype.asObject());
+ syntaxErrorPrototype = memoryManager->alloc<SyntaxErrorPrototype>(emptyClass, errorPrototype.asObject());
+ typeErrorPrototype = memoryManager->alloc<TypeErrorPrototype>(emptyClass, errorPrototype.asObject());
+ uRIErrorPrototype = memoryManager->alloc<URIErrorPrototype>(emptyClass, errorPrototype.asObject());
+
+ variantPrototype = memoryManager->alloc<VariantPrototype>(emptyClass, objectPrototype.asObject());
Q_ASSERT(variantPrototype.asObject()->prototype() == objectPrototype.asObject()->d());
sequencePrototype = ScopedValue(scope, memoryManager->alloc<SequencePrototype>(arrayClass, arrayPrototype.asObject()));
@@ -400,20 +369,17 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
// typed arrays
arrayBufferCtor = memoryManager->alloc<ArrayBufferCtor>(global);
- arrayBufferPrototype = memoryManager->alloc<ArrayBufferPrototype>(objectClass, objectPrototype.asObject());
+ arrayBufferPrototype = memoryManager->alloc<ArrayBufferPrototype>(emptyClass, objectPrototype.asObject());
static_cast<ArrayBufferPrototype *>(arrayBufferPrototype.asObject())->init(this, arrayBufferCtor.asObject());
- arrayBufferClass = InternalClass::create(this, ArrayBuffer::staticVTable());
dataViewCtor = memoryManager->alloc<DataViewCtor>(global);
- dataViewPrototype = memoryManager->alloc<DataViewPrototype>(objectClass, objectPrototype.asObject());
+ dataViewPrototype = memoryManager->alloc<DataViewPrototype>(emptyClass, objectPrototype.asObject());
static_cast<DataViewPrototype *>(dataViewPrototype.asObject())->init(this, dataViewCtor.asObject());
- dataViewClass = InternalClass::create(this, DataView::staticVTable());
for (int i = 0; i < Heap::TypedArray::NTypes; ++i) {
typedArrayCtors[i] = memoryManager->alloc<TypedArrayCtor>(global, Heap::TypedArray::Type(i));
typedArrayPrototype[i] = memoryManager->alloc<TypedArrayPrototype>(this, Heap::TypedArray::Type(i));
typedArrayPrototype[i].as<TypedArrayPrototype>()->init(this, static_cast<TypedArrayCtor *>(typedArrayCtors[i].asObject()));
- typedArrayClasses[i] = InternalClass::create(this, TypedArray::staticVTable());
}
//
@@ -662,7 +628,7 @@ Heap::RegExpObject *ExecutionEngine::newRegExpObject(const QRegExp &re)
Heap::Object *ExecutionEngine::newErrorObject(const ValueRef value)
{
Scope scope(this);
- ScopedObject object(scope, memoryManager->alloc<ErrorObject>(errorClass, errorPrototype.asObject(), value));
+ ScopedObject object(scope, memoryManager->alloc<ErrorObject>(emptyClass, errorPrototype.asObject(), value));
return object->d();
}
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index 8b813ea598..081124f495 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -165,41 +165,17 @@ public:
InternalClassPool *classPool;
InternalClass *emptyClass;
- InternalClass *executionContextClass;
- InternalClass *stringClass;
- InternalClass *objectClass;
InternalClass *arrayClass;
- InternalClass *simpleArrayDataClass;
- InternalClass *stringObjectClass;
- InternalClass *booleanClass;
- InternalClass *numberClass;
- InternalClass *dateClass;
InternalClass *functionClass;
InternalClass *protoClass;
- InternalClass *regExpClass;
InternalClass *regExpExecArrayClass;
- InternalClass *regExpValueClass;
-
- InternalClass *errorClass;
- InternalClass *evalErrorClass;
- InternalClass *rangeErrorClass;
- InternalClass *referenceErrorClass;
- InternalClass *syntaxErrorClass;
- InternalClass *typeErrorClass;
- InternalClass *uriErrorClass;
+
InternalClass *argumentsObjectClass;
InternalClass *strictArgumentsObjectClass;
- InternalClass *variantClass;
- InternalClass *memberDataClass;
-
- InternalClass *arrayBufferClass;
- InternalClass *dataViewClass;
- InternalClass *typedArrayClasses[NTypedArrayTypes]; // TypedArray::NValues, avoid including the header here
-
Heap::EvalFunction *evalFunction;
Heap::FunctionObject *thrower;
@@ -382,7 +358,7 @@ inline Heap::ExecutionContext *ExecutionEngine::popContext()
inline
Heap::ExecutionContext::ExecutionContext(ExecutionEngine *engine, ContextType t)
- : Heap::Base(engine->executionContextClass)
+ : Heap::Base(engine->emptyClass)
, type(t)
, strictMode(false)
, engine(engine)
diff --git a/src/qml/jsruntime/qv4errorobject.cpp b/src/qml/jsruntime/qv4errorobject.cpp
index eda371433a..2eceab91d6 100644
--- a/src/qml/jsruntime/qv4errorobject.cpp
+++ b/src/qml/jsruntime/qv4errorobject.cpp
@@ -183,57 +183,57 @@ DEFINE_OBJECT_VTABLE(ErrorObject);
DEFINE_OBJECT_VTABLE(SyntaxErrorObject);
Heap::SyntaxErrorObject::SyntaxErrorObject(ExecutionEngine *engine, const ValueRef msg)
- : Heap::ErrorObject(engine->syntaxErrorClass, engine->syntaxErrorPrototype.asObject(), msg, SyntaxError)
+ : Heap::ErrorObject(engine->emptyClass, engine->syntaxErrorPrototype.asObject(), msg, SyntaxError)
{
}
Heap::SyntaxErrorObject::SyntaxErrorObject(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber)
- : Heap::ErrorObject(engine->syntaxErrorClass, engine->syntaxErrorPrototype.asObject(), msg, fileName, lineNumber, columnNumber, SyntaxError)
+ : Heap::ErrorObject(engine->emptyClass, engine->syntaxErrorPrototype.asObject(), msg, fileName, lineNumber, columnNumber, SyntaxError)
{
}
Heap::EvalErrorObject::EvalErrorObject(ExecutionEngine *engine, const ValueRef message)
- : Heap::ErrorObject(engine->evalErrorClass, engine->evalErrorPrototype.asObject(), message, EvalError)
+ : Heap::ErrorObject(engine->emptyClass, engine->evalErrorPrototype.asObject(), message, EvalError)
{
}
Heap::RangeErrorObject::RangeErrorObject(ExecutionEngine *engine, const ValueRef message)
- : Heap::ErrorObject(engine->rangeErrorClass, engine->rangeErrorPrototype.asObject(), message, RangeError)
+ : Heap::ErrorObject(engine->emptyClass, engine->rangeErrorPrototype.asObject(), message, RangeError)
{
}
Heap::RangeErrorObject::RangeErrorObject(ExecutionEngine *engine, const QString &message)
- : Heap::ErrorObject(engine->rangeErrorClass, engine->rangeErrorPrototype.asObject(), message, RangeError)
+ : Heap::ErrorObject(engine->emptyClass, engine->rangeErrorPrototype.asObject(), message, RangeError)
{
}
Heap::ReferenceErrorObject::ReferenceErrorObject(ExecutionEngine *engine, const ValueRef message)
- : Heap::ErrorObject(engine->referenceErrorClass, engine->referenceErrorPrototype.asObject(), message, ReferenceError)
+ : Heap::ErrorObject(engine->emptyClass, engine->referenceErrorPrototype.asObject(), message, ReferenceError)
{
}
Heap::ReferenceErrorObject::ReferenceErrorObject(ExecutionEngine *engine, const QString &message)
- : Heap::ErrorObject(engine->referenceErrorClass, engine->referenceErrorPrototype.asObject(), message, ReferenceError)
+ : Heap::ErrorObject(engine->emptyClass, engine->referenceErrorPrototype.asObject(), message, ReferenceError)
{
}
Heap::ReferenceErrorObject::ReferenceErrorObject(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber)
- : Heap::ErrorObject(engine->referenceErrorClass, engine->referenceErrorPrototype.asObject(), msg, fileName, lineNumber, columnNumber, ReferenceError)
+ : Heap::ErrorObject(engine->emptyClass, engine->referenceErrorPrototype.asObject(), msg, fileName, lineNumber, columnNumber, ReferenceError)
{
}
Heap::TypeErrorObject::TypeErrorObject(ExecutionEngine *engine, const ValueRef message)
- : Heap::ErrorObject(engine->typeErrorClass, engine->typeErrorPrototype.asObject(), message, TypeError)
+ : Heap::ErrorObject(engine->emptyClass, engine->typeErrorPrototype.asObject(), message, TypeError)
{
}
Heap::TypeErrorObject::TypeErrorObject(ExecutionEngine *engine, const QString &message)
- : Heap::ErrorObject(engine->typeErrorClass, engine->typeErrorPrototype.asObject(), message, TypeError)
+ : Heap::ErrorObject(engine->emptyClass, engine->typeErrorPrototype.asObject(), message, TypeError)
{
}
Heap::URIErrorObject::URIErrorObject(ExecutionEngine *engine, const ValueRef message)
- : Heap::ErrorObject(engine->uriErrorClass, engine->uRIErrorPrototype.asObject(), message, URIError)
+ : Heap::ErrorObject(engine->emptyClass, engine->uRIErrorPrototype.asObject(), message, URIError)
{
}
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index 3f06776dae..3f1f9e189c 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -403,7 +403,7 @@ ReturnedValue ScriptFunction::construct(Managed *that, CallData *callData)
Scope scope(v4);
Scoped<ScriptFunction> f(scope, static_cast<ScriptFunction *>(that));
- InternalClass *ic = scope.engine->objectClass;
+ InternalClass *ic = scope.engine->emptyClass;
ScopedObject proto(scope, f->protoForConstructor());
ScopedObject obj(scope, v4->newObject(ic, proto));
@@ -487,7 +487,7 @@ ReturnedValue SimpleScriptFunction::construct(Managed *that, CallData *callData)
Scope scope(v4);
Scoped<SimpleScriptFunction> f(scope, static_cast<SimpleScriptFunction *>(that));
- InternalClass *ic = scope.engine->objectClass;
+ InternalClass *ic = scope.engine->emptyClass;
ScopedObject proto(scope, f->protoForConstructor());
callData->thisObject = v4->newObject(ic, proto);
diff --git a/src/qml/jsruntime/qv4internalclass.cpp b/src/qml/jsruntime/qv4internalclass.cpp
index 82c71339a3..e1d574684d 100644
--- a/src/qml/jsruntime/qv4internalclass.cpp
+++ b/src/qml/jsruntime/qv4internalclass.cpp
@@ -112,7 +112,6 @@ uint PropertyHash::lookup(const Identifier *identifier) const
InternalClass::InternalClass(ExecutionEngine *engine)
: engine(engine)
- , vtable(&QV4::Managed::static_vtbl)
, m_sealed(0)
, m_frozen(0)
, size(0)
@@ -124,7 +123,6 @@ InternalClass::InternalClass(ExecutionEngine *engine)
InternalClass::InternalClass(const QV4::InternalClass &other)
: QQmlJS::Managed()
, engine(other.engine)
- , vtable(other.vtable)
, propertyTable(other.propertyTable)
, nameMap(other.nameMap)
, propertyData(other.propertyData)
@@ -176,13 +174,13 @@ InternalClass *InternalClass::changeMember(Identifier *identifier, PropertyAttri
if (data == propertyData.at(idx))
return this;
- Transition temp = { { identifier }, 0, (int)data.flags() };
+ Transition temp = { identifier, 0, (int)data.flags() };
Transition &t = lookupOrInsertTransition(temp);
if (t.lookup)
return t.lookup;
// create a new class and add it to the tree
- InternalClass *newClass = engine->emptyClass->changeVTable(vtable);
+ InternalClass *newClass = engine->emptyClass;
for (uint i = 0; i < size; ++i) {
if (i == idx) {
newClass = newClass->addMember(nameMap.at(i), data);
@@ -196,50 +194,12 @@ InternalClass *InternalClass::changeMember(Identifier *identifier, PropertyAttri
return newClass;
}
-InternalClass *InternalClass::create(ExecutionEngine *engine, const ManagedVTable *vtable)
-{
- return engine->emptyClass->changeVTable(vtable);
-}
-
-InternalClass *InternalClass::changeVTable(const ManagedVTable *vt)
-{
- if (vtable == vt)
- return this;
-
- Transition temp;
- temp.vtable = vt;
- temp.lookup = 0;
- temp.flags = Transition::VTableChange;
-
- Transition &t = lookupOrInsertTransition(temp);
- if (t.lookup)
- return t.lookup;
-
- // create a new class and add it to the tree
- InternalClass *newClass;
- if (this == engine->emptyClass) {
- newClass = engine->newClass(*this);
- newClass->vtable = vt;
- } else {
- newClass = engine->emptyClass->changeVTable(vt);
- for (uint i = 0; i < size; ++i) {
- if (!propertyData.at(i).isEmpty())
- newClass = newClass->addMember(nameMap.at(i), propertyData.at(i));
- }
- }
-
- t.lookup = newClass;
- Q_ASSERT(t.lookup);
- return newClass;
-}
-
InternalClass *InternalClass::nonExtensible()
{
if (!extensible)
return this;
Transition temp;
- temp.vtable = 0;
temp.lookup = 0;
temp.flags = Transition::NotExtensible;
@@ -290,7 +250,7 @@ InternalClass *InternalClass::addMember(Identifier *identifier, PropertyAttribut
InternalClass *InternalClass::addMemberImpl(Identifier *identifier, PropertyAttributes data, uint *index)
{
- Transition temp = { { identifier }, 0, (int)data.flags() };
+ Transition temp = { identifier, 0, (int)data.flags() };
Transition &t = lookupOrInsertTransition(temp);
if (index)
@@ -326,14 +286,14 @@ void InternalClass::removeMember(Object *object, Identifier *id)
uint propIdx = oldClass->propertyTable.lookup(id);
Q_ASSERT(propIdx < oldClass->size);
- Transition temp = { { id }, 0, -1 };
+ Transition temp = { id, 0, -1 };
Transition &t = object->internalClass()->lookupOrInsertTransition(temp);
if (t.lookup) {
object->setInternalClass(t.lookup);
} else {
// create a new class and add it to the tree
- InternalClass *newClass = oldClass->engine->emptyClass->changeVTable(oldClass->vtable);
+ InternalClass *newClass = oldClass->engine->emptyClass;
for (uint i = 0; i < oldClass->size; ++i) {
if (i == propIdx)
continue;
@@ -377,7 +337,6 @@ InternalClass *InternalClass::sealed()
return m_sealed;
m_sealed = engine->emptyClass;
- m_sealed = m_sealed->changeVTable(vtable);
for (uint i = 0; i < size; ++i) {
PropertyAttributes attrs = propertyData.at(i);
if (attrs.isEmpty())
@@ -397,7 +356,6 @@ InternalClass *InternalClass::frozen()
return m_frozen;
m_frozen = engine->emptyClass;
- m_frozen = m_frozen->changeVTable(vtable);
for (uint i = 0; i < size; ++i) {
PropertyAttributes attrs = propertyData.at(i);
if (attrs.isEmpty())
diff --git a/src/qml/jsruntime/qv4internalclass_p.h b/src/qml/jsruntime/qv4internalclass_p.h
index b92bee3fac..b3d3a669f6 100644
--- a/src/qml/jsruntime/qv4internalclass_p.h
+++ b/src/qml/jsruntime/qv4internalclass_p.h
@@ -189,16 +189,12 @@ private:
struct InternalClassTransition
{
- union {
- Identifier *id;
- const ManagedVTable *vtable;
- };
+ Identifier *id;
InternalClass *lookup;
int flags;
enum {
// range 0-0xff is reserved for attribute changes
- VTableChange = 0x100,
- NotExtensible = 0x200
+ NotExtensible = 0x100
};
bool operator==(const InternalClassTransition &other) const
@@ -210,7 +206,6 @@ struct InternalClassTransition
struct InternalClass : public QQmlJS::Managed {
ExecutionEngine *engine;
- const ManagedVTable *vtable;
PropertyHash propertyTable; // id to valueIndex
SharedInternalClassData<Identifier *> nameMap;
@@ -226,8 +221,6 @@ struct InternalClass : public QQmlJS::Managed {
uint size;
bool extensible;
- static InternalClass *create(ExecutionEngine *engine, const ManagedVTable *vtable);
- InternalClass *changeVTable(const ManagedVTable *vt);
InternalClass *nonExtensible();
static void addMember(Object *object, String *string, PropertyAttributes data, uint *index);
InternalClass *addMember(String *string, PropertyAttributes data, uint *index = 0);
diff --git a/src/qml/jsruntime/qv4jsonobject.cpp b/src/qml/jsruntime/qv4jsonobject.cpp
index 0de2aa7e3b..aa16b62716 100644
--- a/src/qml/jsruntime/qv4jsonobject.cpp
+++ b/src/qml/jsruntime/qv4jsonobject.cpp
@@ -880,7 +880,7 @@ QString Stringify::JA(ArrayObject *a)
Heap::JsonObject::JsonObject(ExecutionEngine *e)
- : Heap::Object(QV4::InternalClass::create(e, QV4::JsonObject::staticVTable()), e->objectPrototype.asObject())
+ : Heap::Object(e->emptyClass, e->objectPrototype.asObject())
{
Scope scope(e);
ScopedObject o(scope, this);
diff --git a/src/qml/jsruntime/qv4managed.cpp b/src/qml/jsruntime/qv4managed.cpp
index f784f4a781..9aaf73d02f 100644
--- a/src/qml/jsruntime/qv4managed.cpp
+++ b/src/qml/jsruntime/qv4managed.cpp
@@ -148,14 +148,12 @@ void Managed::setVTable(const ManagedVTable *vt)
{
d()->vtable = vt;
Q_ASSERT(internalClass());
- d()->internalClass = internalClass()->changeVTable(vt);
}
void Heap::Base::setVTable(const ManagedVTable *vt)
{
vtable = vt;
Q_ASSERT(internalClass);
- internalClass = internalClass->changeVTable(vt);
}
diff --git a/src/qml/jsruntime/qv4mathobject.cpp b/src/qml/jsruntime/qv4mathobject.cpp
index 222a6fd97c..b0b50499d5 100644
--- a/src/qml/jsruntime/qv4mathobject.cpp
+++ b/src/qml/jsruntime/qv4mathobject.cpp
@@ -48,7 +48,7 @@ DEFINE_OBJECT_VTABLE(MathObject);
static const double qt_PI = 2.0 * ::asin(1.0);
Heap::MathObject::MathObject(ExecutionEngine *e)
- : Heap::Object(QV4::InternalClass::create(e, QV4::MathObject::staticVTable()), e->objectPrototype.asObject())
+ : Heap::Object(e->emptyClass, e->objectPrototype.asObject())
{
Scope scope(e);
ScopedObject m(scope, this);
diff --git a/src/qml/jsruntime/qv4memberdata.cpp b/src/qml/jsruntime/qv4memberdata.cpp
index 2cdf901502..3f9584d38a 100644
--- a/src/qml/jsruntime/qv4memberdata.cpp
+++ b/src/qml/jsruntime/qv4memberdata.cpp
@@ -58,7 +58,7 @@ Heap::MemberData *MemberData::reallocate(ExecutionEngine *e, Heap::MemberData *o
if (old)
memcpy(newMemberData->d(), old, sizeof(Heap::MemberData) + s*sizeof(Value));
else
- new (newMemberData->d()) Heap::MemberData(e->memberDataClass);
+ new (newMemberData->d()) Heap::MemberData(e->emptyClass);
newMemberData->d()->size = newAlloc;
return newMemberData->d();
}
diff --git a/src/qml/jsruntime/qv4object_p.h b/src/qml/jsruntime/qv4object_p.h
index 939b14f4d2..3d100b5b57 100644
--- a/src/qml/jsruntime/qv4object_p.h
+++ b/src/qml/jsruntime/qv4object_p.h
@@ -45,7 +45,7 @@ namespace Heap {
struct Object : Base {
Object(ExecutionEngine *engine)
- : Base(engine->objectClass),
+ : Base(engine->emptyClass),
prototype(static_cast<Object *>(engine->objectPrototype.m))
{
}
@@ -275,7 +275,7 @@ struct BooleanObject : Object {
}
BooleanObject(ExecutionEngine *engine, const ValueRef val)
- : Object(engine->booleanClass, engine->booleanPrototype.asObject())
+ : Object(engine->emptyClass, engine->booleanPrototype.asObject())
{
value = val;
}
@@ -290,7 +290,7 @@ struct NumberObject : Object {
}
NumberObject(ExecutionEngine *engine, const ValueRef val)
- : Object(engine->numberClass, engine->numberPrototype.asObject())
+ : Object(engine->emptyClass, engine->numberPrototype.asObject())
{
value = val;
}
diff --git a/src/qml/jsruntime/qv4regexp.cpp b/src/qml/jsruntime/qv4regexp.cpp
index 2f1ede1b28..c9c220f74a 100644
--- a/src/qml/jsruntime/qv4regexp.cpp
+++ b/src/qml/jsruntime/qv4regexp.cpp
@@ -86,7 +86,7 @@ Heap::RegExp *RegExp::create(ExecutionEngine* engine, const QString& pattern, bo
}
Heap::RegExp::RegExp(ExecutionEngine* engine, const QString &pattern, bool ignoreCase, bool multiline)
- : Base(engine->regExpValueClass)
+ : Base(engine->emptyClass)
, pattern(pattern)
, ignoreCase(ignoreCase)
, multiLine(multiline)
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 4a843d8bdd..0081664e3b 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -78,7 +78,7 @@ Heap::RegExpObject::RegExpObject(InternalClass *ic, QV4::Object *prototype)
}
Heap::RegExpObject::RegExpObject(QV4::ExecutionEngine *engine, QV4::RegExp *value, bool global)
- : Heap::Object(engine->regExpClass, engine->regExpPrototype.asObject())
+ : Heap::Object(engine->emptyClass, engine->regExpPrototype.asObject())
, value(value->d())
, global(global)
{
@@ -93,7 +93,7 @@ Heap::RegExpObject::RegExpObject(QV4::ExecutionEngine *engine, QV4::RegExp *valu
// The conversion is not 100% exact since ECMA regexp and QRegExp
// have different semantics/flags, but we try to do our best.
Heap::RegExpObject::RegExpObject(QV4::ExecutionEngine *engine, const QRegExp &re)
- : Heap::Object(engine->regExpClass, engine->regExpPrototype.asObject())
+ : Heap::Object(engine->emptyClass, engine->regExpPrototype.asObject())
{
setVTable(QV4::RegExpObject::staticVTable());
diff --git a/src/qml/jsruntime/qv4regexpobject_p.h b/src/qml/jsruntime/qv4regexpobject_p.h
index 1320527fe1..0cdd6788a7 100644
--- a/src/qml/jsruntime/qv4regexpobject_p.h
+++ b/src/qml/jsruntime/qv4regexpobject_p.h
@@ -146,7 +146,7 @@ struct RegExpPrototype: RegExpObject
};
inline Heap::RegExpPrototype::RegExpPrototype(ExecutionEngine *e)
- : RegExpObject(InternalClass::create(e, QV4::RegExpPrototype::staticVTable()), e->objectPrototype.asObject())
+ : RegExpObject(e->emptyClass, e->objectPrototype.asObject())
{
}
diff --git a/src/qml/jsruntime/qv4sequenceobject.cpp b/src/qml/jsruntime/qv4sequenceobject.cpp
index 8c6d28305f..496a794b32 100644
--- a/src/qml/jsruntime/qv4sequenceobject.cpp
+++ b/src/qml/jsruntime/qv4sequenceobject.cpp
@@ -500,7 +500,7 @@ public:
template <typename Container>
Heap::QQmlSequence<Container>::QQmlSequence(QV4::ExecutionEngine *engine, const Container &container)
- : Heap::Object(InternalClass::create(engine, QV4::QQmlSequence<Container>::staticVTable()), engine->sequencePrototype.asObject())
+ : Heap::Object(engine->emptyClass, engine->sequencePrototype.asObject())
, container(container)
, propertyIndex(-1)
, isReference(false)
@@ -513,7 +513,7 @@ Heap::QQmlSequence<Container>::QQmlSequence(QV4::ExecutionEngine *engine, const
template <typename Container>
Heap::QQmlSequence<Container>::QQmlSequence(QV4::ExecutionEngine *engine, QObject *object, int propertyIndex)
- : Heap::Object(InternalClass::create(engine, QV4::QQmlSequence<Container>::staticVTable()), engine->sequencePrototype.asObject())
+ : Heap::Object(engine->emptyClass, engine->sequencePrototype.asObject())
, object(object)
, propertyIndex(propertyIndex)
, isReference(true)
diff --git a/src/qml/jsruntime/qv4string.cpp b/src/qml/jsruntime/qv4string.cpp
index 86624b23bf..ce47fc439e 100644
--- a/src/qml/jsruntime/qv4string.cpp
+++ b/src/qml/jsruntime/qv4string.cpp
@@ -118,7 +118,7 @@ bool String::isEqualTo(Managed *t, Managed *o)
Heap::String::String(ExecutionEngine *engine, const QString &t)
- : Heap::Base(engine->stringClass)
+ : Heap::Base(engine->emptyClass)
{
subtype = String::StringType_Unknown;
@@ -131,7 +131,7 @@ Heap::String::String(ExecutionEngine *engine, const QString &t)
}
Heap::String::String(ExecutionEngine *engine, String *l, String *r)
- : Heap::Base(engine->stringClass)
+ : Heap::Base(engine->emptyClass)
{
subtype = String::StringType_Unknown;
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index b5efdfa410..617670e326 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -83,7 +83,7 @@ Heap::StringObject::StringObject(InternalClass *ic, QV4::Object *prototype)
}
Heap::StringObject::StringObject(ExecutionEngine *engine, const ValueRef val)
- : Heap::Object(engine->stringObjectClass, engine->stringPrototype.asObject())
+ : Heap::Object(engine->emptyClass, engine->stringPrototype.asObject())
{
value = val;
Q_ASSERT(value.isString());
diff --git a/src/qml/jsruntime/qv4typedarray.cpp b/src/qml/jsruntime/qv4typedarray.cpp
index 74adc2e38b..7aff0b8d61 100644
--- a/src/qml/jsruntime/qv4typedarray.cpp
+++ b/src/qml/jsruntime/qv4typedarray.cpp
@@ -334,7 +334,7 @@ ReturnedValue TypedArrayCtor::call(Managed *that, CallData *callData)
}
Heap::TypedArray::TypedArray(ExecutionEngine *e, Type t)
- : Heap::Object(e->typedArrayClasses[t], e->typedArrayPrototype[t].asObject()),
+ : Heap::Object(e->emptyClass, e->typedArrayPrototype[t].asObject()),
type(operations + t)
{
}
diff --git a/src/qml/jsruntime/qv4variantobject.cpp b/src/qml/jsruntime/qv4variantobject.cpp
index 5397b96c73..a1339bb90a 100644
--- a/src/qml/jsruntime/qv4variantobject.cpp
+++ b/src/qml/jsruntime/qv4variantobject.cpp
@@ -44,7 +44,7 @@ using namespace QV4;
DEFINE_OBJECT_VTABLE(VariantObject);
Heap::VariantObject::VariantObject(QV4::ExecutionEngine *engine, const QVariant &value)
- : Heap::Object(engine->variantClass, engine->variantPrototype.asObject())
+ : Heap::Object(engine->emptyClass, engine->variantPrototype.asObject())
{
data = value;
if (isScarce())