QQmlSqlDatabaseWrapper(QV8Engine *e)
: Object(QV8Engine::getV4(e)), type(Database), inTransaction(false), readonly(false), forwardOnly(false)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
~QQmlSqlDatabaseWrapper() {
QV4ParticleData(QV4::ExecutionEngine *engine, QQuickParticleData *datum)
: Object(engine)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
this->datum = datum;
}
QJsonArray scopes;
// Only type and index are used by Qt Creator, so we keep it easy:
- QVector<QV4::ExecutionContext::Type> scopeTypes = debugger->getScopeTypes(frameNr);
+ QVector<QV4::ExecutionContext::ContextType> scopeTypes = debugger->getScopeTypes(frameNr);
for (int i = 0, ei = scopeTypes.count(); i != ei; ++i) {
int type = encodeScopeType(scopeTypes[i]);
if (type == -1)
return frame;
}
- int encodeScopeType(QV4::ExecutionContext::Type scopeType)
+ int encodeScopeType(QV4::ExecutionContext::ContextType scopeType)
{
switch (scopeType) {
case QV4::ExecutionContext::Type_GlobalContext:
QJsonObject anonymous;
anonymous[QLatin1String("properties")] = properties;
- QVector<QV4::ExecutionContext::Type> scopeTypes = debugger->getScopeTypes(frameNr);
+ QVector<QV4::ExecutionContext::ContextType> scopeTypes = debugger->getScopeTypes(frameNr);
scope[QLatin1String("type")] = encodeScopeType(scopeTypes[scopeNr]);
scope[QLatin1String("index")] = scopeNr;
scope[QLatin1String("frameIndex")] = frameNr;
DEFINE_MANAGED_VTABLE(ArgumentsObject);
ArgumentsObject::ArgumentsObject(CallContext *context)
- : Object(context->engine), context(context), fullyCreated(false)
+ : Object(context->strictMode ? context->engine->strictArgumentsObjectClass : context->engine->argumentsObjectClass)
+ , context(context)
+ , fullyCreated(false)
{
- vtbl = &static_vtbl;
type = Type_ArgumentsObject;
flags &= ~SimpleArray;
ScopedObject protectThis(scope, this);
if (context->strictMode) {
- internalClass = v4->strictArgumentsObjectClass;
-
Property pd = Property::fromAccessor(v4->thrower, v4->thrower);
Q_ASSERT(CalleePropertyIndex == internalClass->find(context->engine->id_callee));
Q_ASSERT(CallerPropertyIndex == internalClass->find(context->engine->id_caller));
arrayDataLen = context->callData->argc;
fullyCreated = true;
} else {
- internalClass = engine()->argumentsObjectClass;
Q_ASSERT(CalleePropertyIndex == internalClass->find(context->engine->id_callee));
memberData[CalleePropertyIndex].value = context->function->asReturnedValue();
isNonStrictArgumentsObject = true;
Q_ASSERT(LengthPropertyIndex == internalClass->find(context->engine->id_length));
Property *lp = memberData + ArrayObject::LengthPropertyIndex;
lp->value = Primitive::fromInt32(context->realArgumentCount);
+
+ setVTable(&static_vtbl);
}
void ArgumentsObject::destroy(Managed *that)
uint index;
ArgumentsGetterFunction(ExecutionContext *scope, uint index)
- : FunctionObject(scope), index(index) { vtbl = &static_vtbl; }
+ : FunctionObject(scope), index(index) {
+ setVTable(&static_vtbl);
+ }
static ReturnedValue call(Managed *that, CallData *d);
};
uint index;
ArgumentsSetterFunction(ExecutionContext *scope, uint index)
- : FunctionObject(scope), index(index) { vtbl = &static_vtbl; }
+ : FunctionObject(scope), index(index) {
+ setVTable(&static_vtbl);
+ }
static ReturnedValue call(Managed *that, CallData *callData);
};
ArrayCtor::ArrayCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Array"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue ArrayCtor::construct(Managed *m, CallData *callData)
BooleanCtor::BooleanCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Boolean"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue BooleanCtor::construct(Managed *m, CallData *callData)
CallContext *ExecutionContext::newCallContext(FunctionObject *function, CallData *callData)
{
CallContext *c = static_cast<CallContext *>(engine->memoryManager->allocManaged(requiredMemoryForExecutionContect(function, callData->argc)));
- c->init();
+ new (c) CallContext(engine, this, Type_CallContext);
engine->current = c;
- c->initBaseContext(Type_CallContext, engine, this);
-
c->function = function;
c->realArgumentCount = callData->argc;
WithContext *ExecutionContext::newWithContext(ObjectRef with)
{
- WithContext *w = new (engine->memoryManager) WithContext;
+ WithContext *w = new (engine->memoryManager) WithContext(this, with);
engine->current = w;
- w->initWithContext(this, with);
return w;
}
CatchContext *ExecutionContext::newCatchContext(const StringRef exceptionVarName, const ValueRef exceptionValue)
{
- CatchContext *c = new (engine->memoryManager) CatchContext;
+ CatchContext *c = new (engine->memoryManager) CatchContext(this, exceptionVarName, exceptionValue);
engine->current = c;
- c->initCatchContext(this, exceptionVarName, exceptionValue);
return c;
}
CallContext *ExecutionContext::newQmlContext(FunctionObject *f, ObjectRef qml)
{
CallContext *c = static_cast<CallContext *>(engine->memoryManager->allocManaged(requiredMemoryForExecutionContect(f, 0)));
- c->init();
-
- engine->current = c;
- c->initQmlContext(this, qml, f);
-
+ new (c) CallContext(this, qml, f);
return c;
}
}
-void GlobalContext::initGlobalContext(ExecutionEngine *eng)
+GlobalContext::GlobalContext(ExecutionEngine *eng, ExecutionContext *parent)
+ : ExecutionContext(eng, Type_GlobalContext, parent)
{
- initBaseContext(Type_GlobalContext, eng, /*parentContext*/0);
- callData = reinterpret_cast<CallData *>(this + 1);
- callData->tag = QV4::Value::_Integer_Type;
- callData->argc = 0;
- callData->thisObject = eng->globalObject;
- callData->args[0] = Encode::undefined();
+ if (!parent) {
+ callData = reinterpret_cast<CallData *>(this + 1);
+ callData->tag = QV4::Value::_Integer_Type;
+ callData->argc = 0;
+ callData->thisObject = eng->globalObject;
+ callData->args[0] = Encode::undefined();
+ }
global = 0;
}
-void WithContext::initWithContext(ExecutionContext *p, ObjectRef with)
+WithContext::WithContext(ExecutionContext *p, ObjectRef with)
+ : ExecutionContext(p->engine, Type_WithContext, p)
{
- initBaseContext(Type_WithContext, p->engine, p);
callData = p->callData;
outer = p;
lookups = p->lookups;
withObject = with.getPointer();
}
-void CatchContext::initCatchContext(ExecutionContext *p, const StringRef exceptionVarName, const ValueRef exceptionValue)
+CatchContext::CatchContext(ExecutionContext *p, const StringRef exceptionVarName, const ValueRef exceptionValue)
+ : ExecutionContext(p->engine, Type_CatchContext, p)
{
- initBaseContext(Type_CatchContext, p->engine, p);
strictMode = p->strictMode;
callData = p->callData;
outer = p;
this->exceptionValue = exceptionValue;
}
-void CallContext::initQmlContext(ExecutionContext *parentContext, ObjectRef qml, FunctionObject *function)
+CallContext::CallContext(ExecutionContext *parentContext, ObjectRef qml, FunctionObject *function)
+ : ExecutionContext(parentContext->engine, Type_QmlContext, parentContext)
{
- initBaseContext(Type_QmlContext, parentContext->engine, parentContext);
-
this->function = function;
- this->callData = reinterpret_cast<CallData *>(this + 1);
- this->callData->tag = QV4::Value::_Integer_Type;
- this->callData->argc = 0;
- this->callData->thisObject = Primitive::undefinedValue();
+ callData = reinterpret_cast<CallData *>(this + 1);
+ callData->tag = QV4::Value::_Integer_Type;
+ callData->argc = 0;
+ callData->thisObject = Primitive::undefinedValue();
strictMode = true;
- this->outer = function->scope;
+ outer = function->scope;
#ifndef QT_NO_DEBUG
assert(outer->next != (ExecutionContext *)0x1);
#endif
#include "qv4global_p.h"
#include "qv4value_def_p.h"
#include "qv4managed_p.h"
+#include "qv4engine_p.h"
QT_BEGIN_NAMESPACE
struct Q_QML_EXPORT ExecutionContext : public Managed
{
Q_MANAGED
- ExecutionContext()
- : Managed(0) {
- vtbl = &static_vtbl;
- }
- void init() {
- _data = 0;
- internalClass = 0;
- inUse = 1;
- extensible = 1;
- vtbl = &static_vtbl;
- }
- enum Type {
+ enum ContextType {
Type_GlobalContext = 0x1,
Type_CatchContext = 0x2,
Type_WithContext = 0x3,
Type_QmlContext = 0x6
};
- Type type;
+ ExecutionContext(ExecutionEngine *engine, ContextType t, ExecutionContext *parent)
+ : Managed(engine->emptyClass)
+ {
+ setVTable(&static_vtbl);
+ this->type = t;
+ strictMode = false;
+ this->engine = engine;
+ this->parent = parent;
+ outer = 0;
+ lookups = 0;
+ compilationUnit = 0;
+ currentEvalCode = 0;
+ interpreterInstructionPointer = 0;
+ lineNumber = -1;
+ }
+
+ ContextType type;
bool strictMode;
CallData *callData;
const uchar **interpreterInstructionPointer;
int lineNumber;
- void initBaseContext(Type type, ExecutionEngine *engine, ExecutionContext *parentContext)
- {
- this->type = type;
- strictMode = false;
- this->engine = engine;
- parent = parentContext;
- outer = 0;
- lookups = 0;
- compilationUnit = 0;
- currentEvalCode = 0;
- interpreterInstructionPointer = 0;
- lineNumber = -1;
- }
-
CallContext *newCallContext(FunctionObject *f, CallData *callData);
WithContext *newWithContext(ObjectRef with);
CatchContext *newCatchContext(const StringRef exceptionVarName, const ValueRef exceptionValue);
struct CallContext : public ExecutionContext
{
+ CallContext(ExecutionEngine *engine, ExecutionContext *parent, ContextType t = Type_SimpleCallContext)
+ : ExecutionContext(engine, t, parent)
+ {
+ function = 0;
+ locals = 0;
+ activation = 0;
+ }
+ CallContext(ExecutionContext *parentContext, ObjectRef qml, QV4::FunctionObject *function);
+
FunctionObject *function;
int realArgumentCount;
SafeValue *locals;
Object *activation;
- void initSimpleCallContext(ExecutionEngine *engine, ExecutionContext *parent) {
- initBaseContext(Type_SimpleCallContext, engine, parent);
- function = 0;
- locals = 0;
- activation = 0;
- }
void initQmlContext(ExecutionContext *parentContext, ObjectRef qml, QV4::FunctionObject *function);
inline ReturnedValue argument(int i);
struct GlobalContext : public ExecutionContext
{
- void initGlobalContext(ExecutionEngine *e);
+ GlobalContext(ExecutionEngine *engine, ExecutionContext *parent = 0);
Object *global;
};
struct CatchContext : public ExecutionContext
{
- void initCatchContext(ExecutionContext *p, const StringRef exceptionVarName, const ValueRef exceptionValue);
+ CatchContext(ExecutionContext *p, const StringRef exceptionVarName, const ValueRef exceptionValue);
SafeString exceptionVarName;
SafeValue exceptionValue;
struct WithContext : public ExecutionContext
{
+ WithContext(ExecutionContext *p, ObjectRef with);
Object *withObject;
-
- void initWithContext(ExecutionContext *p, ObjectRef with);
};
inline CallContext *ExecutionContext::asCallContext()
return type >= Type_SimpleCallContext ? static_cast<const CallContext *>(this) : 0;
}
+
+inline void ExecutionEngine::pushContext(CallContext *context)
+{
+ context->parent = current;
+ current = context;
+ current->currentEvalCode = 0;
+}
+
+inline ExecutionContext *ExecutionEngine::popContext()
+{
+ current = current->parent;
+ return current;
+}
+
+struct ExecutionContextSaver
+{
+ ExecutionEngine *engine;
+ ExecutionContext *savedContext;
+
+ ExecutionContextSaver(ExecutionContext *context)
+ : engine(context->engine)
+ , savedContext(context)
+ {
+ }
+ ~ExecutionContextSaver()
+ {
+ engine->current = savedContext;
+ }
+};
+
/* Function *f, int argc */
#define requiredMemoryForExecutionContect(f, argc) \
sizeof(CallContext) + sizeof(Value) * (f->varCount + qMax((uint)argc, f->formalParameterCount)) + sizeof(CallData)
DateObject::DateObject(ExecutionEngine *engine, const QDateTime &date)
: Object(engine->dateClass)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
type = Type_DateObject;
value.setDouble(date.isValid() ? date.toMSecsSinceEpoch() : qSNaN());
}
DateCtor::DateCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Date"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue DateCtor::construct(Managed *m, CallData *callData)
Q_MANAGED
SafeValue value;
DateObject(ExecutionEngine *engine, const ValueRef date): Object(engine->dateClass) {
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
type = Type_DateObject;
value = date;
}
protected:
DateObject(InternalClass *ic): Object(ic) {
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
type = Type_DateObject;
value = Primitive::fromDouble(qSNaN());
}
collector->collect(o);
}
-QVector<ExecutionContext::Type> Debugger::getScopeTypes(int frame) const
+QVector<ExecutionContext::ContextType> Debugger::getScopeTypes(int frame) const
{
- QVector<ExecutionContext::Type> types;
+ QVector<ExecutionContext::ContextType> types;
if (state() != Paused)
return types;
bool collectThisInContext(Collector *collector, int frame = 0);
void collectThrownValue(Collector *collector);
void collectReturnedValue(Collector *collector) const;
- QVector<ExecutionContext::Type> getScopeTypes(int frame = 0) const;
+ QVector<ExecutionContext::ContextType> getScopeTypes(int frame = 0) const;
public: // compile-time interface
void maybeBreakAtInstruction(const uchar *code, bool breakPointHit);
**
****************************************************************************/
#include <qv4engine_p.h>
+#include <qv4context_p.h>
#include <qv4value_p.h>
#include <qv4object_p.h>
#include <qv4objectproto_p.h>
id_valueOf = newIdentifier(QStringLiteral("valueOf"));
ObjectPrototype *objectPrototype = new (memoryManager) ObjectPrototype(emptyClass);
- objectClass = emptyClass->changePrototype(objectPrototype);
+ objectClass = emptyClass->changeVTable(&Object::static_vtbl);
+ objectClass = objectClass->changePrototype(objectPrototype);
+ Q_ASSERT(objectClass->vtable == &Object::static_vtbl);
arrayClass = objectClass->addMember(id_length, Attr_NotConfigurable|Attr_NotEnumerable);
ArrayPrototype *arrayPrototype = new (memoryManager) ArrayPrototype(arrayClass);
arrayClass = arrayClass->changePrototype(arrayPrototype);
- InternalClass *argsClass = objectClass->addMember(id_length, Attr_NotEnumerable);
+ InternalClass *argsClass = objectClass->changeVTable(&ArgumentsObject::static_vtbl);
+ argsClass = argsClass->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::static_vtbl);
+ Q_ASSERT(strictArgumentsObjectClass->vtable == &ArgumentsObject::static_vtbl);
+
initRootContext();
StringPrototype *stringPrototype = new (memoryManager) StringPrototype(objectClass);
void ExecutionEngine::initRootContext()
{
rootContext = static_cast<GlobalContext *>(memoryManager->allocManaged(sizeof(GlobalContext) + sizeof(CallData)));
- rootContext->init();
+ new (rootContext) GlobalContext(this);
current = rootContext;
current->parent = 0;
- rootContext->initGlobalContext(this);
}
InternalClass *ExecutionEngine::newClass(const InternalClass &other)
ExecutionContext *ExecutionEngine::pushGlobalContext()
{
- GlobalContext *g = new (memoryManager) GlobalContext;
+ GlobalContext *g = new (memoryManager) GlobalContext(this, current);
ExecutionContext *oldNext = g->next;
memcpy(g, rootContext, sizeof(GlobalContext));
g->next = oldNext;
- g->parent = current;
current = g;
return current;
#include "qv4global_p.h"
#include "private/qv4isel_p.h"
#include "qv4util_p.h"
-#include "qv4context_p.h"
#include "qv4property_p.h"
#include <private/qintrusivelist_p.h>
QmlExtensions *m_qmlExtensions;
};
-inline void ExecutionEngine::pushContext(CallContext *context)
-{
- context->parent = current;
- current = context;
- current->currentEvalCode = 0;
-}
-
-inline ExecutionContext *ExecutionEngine::popContext()
-{
- current = current->parent;
- return current;
-}
-
-struct ExecutionContextSaver
-{
- ExecutionEngine *engine;
- ExecutionContext *savedContext;
-
- ExecutionContextSaver(ExecutionContext *context)
- : engine(context->engine)
- , savedContext(context)
- {
- }
- ~ExecutionContextSaver()
- {
- engine->current = savedContext;
- }
-};
-
inline
void Managed::mark(QV4::ExecutionEngine *engine)
{
, stack(0)
{
type = Type_ErrorObject;
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
Scope scope(engine());
ScopedValue protectThis(scope, this);
, stack(0)
{
type = Type_ErrorObject;
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
subtype = t;
Scope scope(engine());
, stack(0)
{
type = Type_ErrorObject;
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
subtype = t;
Scope scope(engine());
, stack(0)
{
type = Type_ErrorObject;
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
subtype = t;
Scope scope(engine());
SyntaxErrorObject::SyntaxErrorObject(ExecutionEngine *engine, const ValueRef msg)
: ErrorObject(engine->syntaxErrorClass, msg, SyntaxError)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
SyntaxErrorObject::SyntaxErrorObject(ExecutionEngine *engine, const QString &msg, const QString &fileName, int lineNumber, int columnNumber)
: ErrorObject(engine->syntaxErrorClass, msg, fileName, lineNumber, columnNumber, SyntaxError)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
EvalErrorObject::EvalErrorObject(ExecutionEngine *engine, const ValueRef message)
ErrorCtor::ErrorCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Error"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ErrorCtor::ErrorCtor(ExecutionContext *scope, const QString &name)
: FunctionObject(scope, name)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue ErrorCtor::construct(Managed *m, CallData *callData)
EvalErrorCtor::EvalErrorCtor(ExecutionContext *scope)
: ErrorCtor(scope, QStringLiteral("EvalError"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue EvalErrorCtor::construct(Managed *m, CallData *callData)
RangeErrorCtor::RangeErrorCtor(ExecutionContext *scope)
: ErrorCtor(scope, QStringLiteral("RangeError"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue RangeErrorCtor::construct(Managed *m, CallData *callData)
ReferenceErrorCtor::ReferenceErrorCtor(ExecutionContext *scope)
: ErrorCtor(scope, QStringLiteral("ReferenceError"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue ReferenceErrorCtor::construct(Managed *m, CallData *callData)
SyntaxErrorCtor::SyntaxErrorCtor(ExecutionContext *scope)
: ErrorCtor(scope, QStringLiteral("SyntaxError"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue SyntaxErrorCtor::construct(Managed *m, CallData *callData)
TypeErrorCtor::TypeErrorCtor(ExecutionContext *scope)
: ErrorCtor(scope, QStringLiteral("TypeError"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue TypeErrorCtor::construct(Managed *m, CallData *callData)
URIErrorCtor::URIErrorCtor(ExecutionContext *scope)
: ErrorCtor(scope, QStringLiteral("URIError"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue URIErrorCtor::construct(Managed *m, CallData *callData)
struct EvalErrorPrototype: ErrorObject
{
- EvalErrorPrototype(InternalClass *ic): ErrorObject(ic) { vtbl = &static_vtbl; }
+ EvalErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(&static_vtbl); }
void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); }
};
struct RangeErrorPrototype: ErrorObject
{
- RangeErrorPrototype(InternalClass *ic): ErrorObject(ic) { vtbl = &static_vtbl; }
+ RangeErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(&static_vtbl); }
void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); }
};
struct ReferenceErrorPrototype: ErrorObject
{
- ReferenceErrorPrototype(InternalClass *ic): ErrorObject(ic) { vtbl = &static_vtbl; }
+ ReferenceErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(&static_vtbl); }
void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); }
};
struct SyntaxErrorPrototype: ErrorObject
{
- SyntaxErrorPrototype(InternalClass *ic): ErrorObject(ic) { vtbl = &static_vtbl; }
+ SyntaxErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(&static_vtbl); }
void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); }
};
struct TypeErrorPrototype: ErrorObject
{
- TypeErrorPrototype(InternalClass *ic): ErrorObject(ic) { vtbl = &static_vtbl; }
+ TypeErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(&static_vtbl); }
void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); }
};
struct URIErrorPrototype: ErrorObject
{
- URIErrorPrototype(InternalClass *ic): ErrorObject(ic) { vtbl = &static_vtbl; }
+ URIErrorPrototype(InternalClass *ic): ErrorObject(ic) { setVTable(&static_vtbl); }
void init(ExecutionEngine *engine, ObjectRef ctor) { ErrorPrototype::init(engine, ctor, this); }
};
, varCount(0)
, function(0)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
name = ic->engine->id_undefined;
type = Type_FunctionObject;
void FunctionObject::init(const StringRef n, bool createProto)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
name = n;
Scope s(internalClass->engine);
FunctionCtor::FunctionCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Function"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
// 15.3.2
ScriptFunction::ScriptFunction(ExecutionContext *scope, Function *function)
: FunctionObject(scope, function->name, true)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
Scope s(scope);
ScopedValue protectThis(s, this);
SimpleScriptFunction::SimpleScriptFunction(ExecutionContext *scope, Function *function)
: FunctionObject(scope, function->name, true)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
Scope s(scope);
ScopedValue protectThis(s, this);
ExecutionContext *context = v4->current;
- CallContext ctx;
- ctx.initSimpleCallContext(v4, context);
+ CallContext ctx(v4, context);
ctx.strictMode = f->strictMode;
ctx.callData = callData;
ctx.function = f.getPointer();
Scope scope(v4);
ExecutionContext *context = v4->current;
- CallContext ctx;
- ctx.initSimpleCallContext(v4, context);
+ CallContext ctx(v4, context);
ctx.strictMode = f->strictMode;
ctx.callData = callData;
ctx.function = f;
: FunctionObject(scope, name)
, code(code)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue BuiltinFunction::construct(Managed *f, CallData *)
ExecutionContext *context = v4->current;
- CallContext ctx;
- ctx.initSimpleCallContext(v4, context);
+ CallContext ctx(v4, context);
ctx.strictMode = f->scope->strictMode; // ### needed? scope or parent context?
ctx.callData = callData;
v4->pushContext(&ctx);
CHECK_STACK_LIMITS(v4);
ExecutionContext *context = v4->current;
- Scope scope(v4);
- CallContext ctx;
- ctx.initSimpleCallContext(v4, context);
+ CallContext ctx(v4, context);
ctx.strictMode = f->scope->strictMode; // ### needed? scope or parent context?
ctx.callData = callData;
v4->pushContext(&ctx);
, target(target)
, boundArgs(boundArgs)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
subtype = FunctionObject::BoundFunction;
this->boundThis = boundThis;
static ReturnedValue construct(Managed *that, CallData *);
static ReturnedValue call(Managed *that, CallData *d);
inline ReturnedValue construct(CallData *callData) {
- return vtbl->construct(this, callData);
+ return internalClass->vtable->construct(this, callData);
}
inline ReturnedValue call(CallData *callData) {
- return vtbl->call(this, callData);
+ return internalClass->vtable->call(this, callData);
}
static FunctionObject *cast(const Value &v) {
, code(code)
, index(index)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
static ReturnedValue construct(Managed *m, CallData *)
struct ObjectPrototype;
struct ObjectIterator;
struct ExecutionContext;
+struct GlobalContext;
+struct CallContext;
struct ScriptFunction;
struct InternalClass;
struct Property;
EvalFunction::EvalFunction(ExecutionContext *scope)
: FunctionObject(scope, scope->engine->id_eval)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
defineReadonlyProperty(scope->engine->id_length, Primitive::fromInt32(1));
}
}
}
+InternalClass::InternalClass(ExecutionEngine *engine)
+ : engine(engine)
+ , prototype(0)
+ , vtable(&Managed::static_vtbl)
+ , m_sealed(0)
+ , m_frozen(0)
+ , size(0)
+{
+}
+
InternalClass::InternalClass(const QV4::InternalClass &other)
: engine(other.engine)
, prototype(other.prototype)
+ , vtable(other.vtable)
, propertyTable(other.propertyTable)
, nameMap(other.nameMap)
, propertyData(other.propertyData)
// create a new class and add it to the tree
InternalClass *newClass;
- if (this == engine->emptyClass) {
+ if (!size) {
newClass = engine->newClass(*this);
newClass->prototype = proto;
} else {
- newClass = engine->emptyClass->changePrototype(proto);
+ newClass = engine->emptyClass->changeVTable(vtable);
+ newClass = newClass->changePrototype(proto);
+ for (uint i = 0; i < size; ++i)
+ newClass = newClass->addMember(nameMap.at(i), propertyData.at(i));
+ }
+
+ transitions.insert(t, newClass);
+ return newClass;
+}
+
+InternalClass *InternalClass::changeVTable(const ManagedVTable *vt)
+{
+ if (vtable == vt)
+ return this;
+
+ Transition t;
+ t.vtable = vt;
+ t.flags = Transition::VTableChange;
+
+ QHash<Transition, InternalClass *>::const_iterator tit = transitions.constFind(t);
+ if (tit != transitions.constEnd())
+ return tit.value();
+
+ // 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);
+ newClass = newClass->changePrototype(prototype);
for (uint i = 0; i < size; ++i)
newClass = newClass->addMember(nameMap.at(i), propertyData.at(i));
}
for (QHash<Transition, InternalClass *>::ConstIterator it = transitions.begin(), end = transitions.end();
it != end; ++it) {
- if (it.key().flags == Transition::ProtoChange) {
+ if (it.key().flags == Transition::VTableChange) {
+ it.value()->markObjects();
+ } else if (it.key().flags == Transition::ProtoChange) {
Q_ASSERT(it.value()->prototype);
it.value()->prototype->mark(engine);
}
struct ExecutionEngine;
struct Object;
struct Identifier;
+struct ManagedVTable;
struct PropertyHashData;
struct PropertyHash
union {
Identifier *id;
Object *prototype;
+ const ManagedVTable *vtable;
};
int flags;
- enum { ProtoChange = 0x100 };
+ enum {
+ // range 0-0xff is reserved for attribute changes
+ ProtoChange = 0x100,
+ VTableChange = 0x200
+ };
bool operator==(const InternalClassTransition &other) const
{ return id == other.id && flags == other.flags; }
struct InternalClass {
ExecutionEngine *engine;
Object *prototype;
+ const ManagedVTable *vtable;
+
PropertyHash propertyTable; // id to valueIndex
SharedInternalClassData<String *> nameMap;
SharedInternalClassData<PropertyAttributes> propertyData;
uint size;
InternalClass *changePrototype(Object *proto);
+ InternalClass *changeVTable(const ManagedVTable *vt);
InternalClass *addMember(StringRef string, PropertyAttributes data, uint *index = 0);
InternalClass *addMember(String *string, PropertyAttributes data, uint *index = 0);
InternalClass *changeMember(String *string, PropertyAttributes data, uint *index = 0);
private:
friend struct ExecutionEngine;
- InternalClass(ExecutionEngine *engine) : engine(engine), prototype(0), m_sealed(0), m_frozen(0), size(0) {}
+ InternalClass(ExecutionEngine *engine);
InternalClass(const InternalClass &other);
};
return;
Managed *m = static_cast<Managed *>(ptr);
- m->vtbl = 0;
m->_data = 0;
m->markBit = 0;
m->~Managed();
return QString::fromLatin1(s);
}
+void Managed::setVTable(const ManagedVTable *vt)
+{
+ Q_ASSERT(internalClass);
+ internalClass = internalClass->changeVTable(vt);
+}
+
ReturnedValue Managed::construct(Managed *m, CallData *)
{
return m->engine()->current->throwTypeError();
ReturnedValue Managed::get(const StringRef name, bool *hasProperty)
{
- return vtbl->get(this, name, hasProperty);
+ return internalClass->vtable->get(this, name, hasProperty);
}
ReturnedValue Managed::getIndexed(uint index, bool *hasProperty)
{
- return vtbl->getIndexed(this, index, hasProperty);
+ return internalClass->vtable->getIndexed(this, index, hasProperty);
}
void Managed::put(const StringRef name, const ValueRef value)
{
- vtbl->put(this, name, value);
+ internalClass->vtable->put(this, name, value);
}
void Managed::setLookup(Lookup *l, const ValueRef v)
{
- vtbl->setLookup(this, l, v);
+ internalClass->vtable->setLookup(this, l, v);
}
void Managed::putIndexed(uint index, const ValueRef value)
{
- vtbl->putIndexed(this, index, value);
+ internalClass->vtable->putIndexed(this, index, value);
}
PropertyAttributes Managed::query(StringRef name) const
{
- return vtbl->query(this, name);
+ return internalClass->vtable->query(this, name);
}
bool Managed::deleteProperty(const StringRef name)
{
- return vtbl->deleteProperty(this, name);
+ return internalClass->vtable->deleteProperty(this, name);
}
Property *Managed::advanceIterator(ObjectIterator *it, StringRef name, uint *index, PropertyAttributes *attributes)
{
- return vtbl->advanceIterator(this, it, name, index, attributes);
+ return internalClass->vtable->advanceIterator(this, it, name, index, attributes);
}
#include <QtCore/QDebug>
#include "qv4global_p.h"
#include "qv4value_def_p.h"
+#include "qv4internalclass_p.h"
QT_BEGIN_NAMESPACE
protected:
Managed(InternalClass *internal)
- : _data(0), vtbl(&static_vtbl), internalClass(internal)
+ : _data(0), internalClass(internal)
{ inUse = 1; extensible = 1; }
public:
void *operator new(size_t size, MemoryManager *mm);
+ void *operator new(size_t, Managed *m) { return m; }
void operator delete(void *ptr);
void operator delete(void *ptr, MemoryManager *mm);
template <typename T>
T *as() {
// ### FIXME:
- if (!this)
+ if (!this || !internalClass)
return 0;
#if !defined(QT_NO_QOBJECT_CHECK)
reinterpret_cast<T *>(this)->qt_check_for_QMANAGED_macro(*reinterpret_cast<T *>(this));
#endif
- return vtbl == &T::static_vtbl ? static_cast<T *>(this) : 0;
+ return internalClass->vtable == &T::static_vtbl ? static_cast<T *>(this) : 0;
}
template <typename T>
const T *as() const {
#if !defined(QT_NO_QOBJECT_CHECK)
reinterpret_cast<T *>(this)->qt_check_for_QMANAGED_macro(*reinterpret_cast<T *>(const_cast<Managed *>(this)));
#endif
- return vtbl == &T::static_vtbl ? static_cast<const T *>(this) : 0;
+ return internalClass->vtable == &T::static_vtbl ? static_cast<const T *>(this) : 0;
}
String *asString() { return type == Type_String ? reinterpret_cast<String *>(this) : 0; }
*reinterpret_cast<Managed **>(this) = m;
}
+ void setVTable(const ManagedVTable *vt);
+
ReturnedValue construct(CallData *d);
ReturnedValue call(CallData *d);
ReturnedValue get(const StringRef name, bool *hasProperty = 0);
void putIndexed(uint index, const ValueRef value);
PropertyAttributes query(StringRef name) const;
PropertyAttributes queryIndexed(uint index) const
- { return vtbl->queryIndexed(this, index); }
+ { return internalClass->vtable->queryIndexed(this, index); }
bool deleteProperty(const StringRef name);
bool deleteIndexedProperty(uint index)
- { return vtbl->deleteIndexedProperty(this, index); }
+ { return internalClass->vtable->deleteIndexedProperty(this, index); }
ReturnedValue getLookup(Lookup *l)
- { return vtbl->getLookup(this, l); }
+ { return internalClass->vtable->getLookup(this, l); }
void setLookup(Lookup *l, const ValueRef v);
bool isEqualTo(Managed *other)
- { return vtbl->isEqualTo(this, other); }
+ { return internalClass->vtable->isEqualTo(this, other); }
Property *advanceIterator(ObjectIterator *it, StringRef name, uint *index, PropertyAttributes *attributes);
static void destroy(Managed *that) { that->_data = 0; }
};
};
-protected:
- const ManagedVTable *vtbl;
public:
InternalClass *internalClass;
inline ReturnedValue Managed::construct(CallData *d) {
- return vtbl->construct(this, d);
+ return internalClass->vtable->construct(this, d);
}
inline ReturnedValue Managed::call(CallData *d) {
- return vtbl->call(this, d);
+ return internalClass->vtable->call(this, d);
}
}
// now that we marked all roots, start marking recursively and popping from the mark stack
while (m_d->engine->jsStackTop > markBase) {
Managed *m = m_d->engine->popForGC();
- Q_ASSERT (m->vtbl->markObjects);
- m->vtbl->markObjects(m, m_d->engine);
+ Q_ASSERT (m->internalClass->vtable->markObjects);
+ m->internalClass->vtable->markObjects(m, m_d->engine);
}
}
#ifdef V4_USE_VALGRIND
VALGRIND_ENABLE_ERROR_REPORTING;
#endif
- if (m->vtbl->collectDeletables)
- m->vtbl->collectDeletables(m, deletable);
- m->vtbl->destroy(m);
+ if (m->internalClass->vtable->collectDeletables)
+ m->internalClass->vtable->collectDeletables(m, deletable);
+ m->internalClass->vtable->destroy(m);
m->setNextFree(*f);
#ifdef V4_USE_VALGRIND
NumberCtor::NumberCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Number"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue NumberCtor::construct(Managed *m, CallData *callData)
, memberDataAlloc(InlinePropertySize), memberData(inlineProperties)
, arrayOffset(0), arrayDataLen(0), arrayAlloc(0), arrayAttributes(0), arrayData(0), sparseArray(0)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
+
type = Type_Object;
flags = SimpleArray;
memset(memberData, 0, sizeof(Property)*memberDataAlloc);
}
-Object::Object(InternalClass *internalClass)
- : Managed(internalClass)
+Object::Object(InternalClass *ic)
+ : Managed(ic)
, memberDataAlloc(InlinePropertySize), memberData(inlineProperties)
, arrayOffset(0), arrayDataLen(0), arrayAlloc(0), arrayAttributes(0), arrayData(0), sparseArray(0)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
+
type = Type_Object;
flags = SimpleArray;
void ensureMemberIndex(uint idx);
inline ReturnedValue get(const StringRef name, bool *hasProperty = 0)
- { return vtbl->get(this, name, hasProperty); }
+ { return internalClass->vtable->get(this, name, hasProperty); }
inline ReturnedValue getIndexed(uint idx, bool *hasProperty = 0)
- { return vtbl->getIndexed(this, idx, hasProperty); }
+ { return internalClass->vtable->getIndexed(this, idx, hasProperty); }
inline void put(const StringRef name, const ValueRef v)
- { vtbl->put(this, name, v); }
+ { internalClass->vtable->put(this, name, v); }
inline void putIndexed(uint idx, const ValueRef v)
- { vtbl->putIndexed(this, idx, v); }
+ { internalClass->vtable->putIndexed(this, idx, v); }
using Managed::get;
using Managed::getIndexed;
using Managed::put;
SafeValue value;
BooleanObject(ExecutionEngine *engine, const ValueRef val)
: Object(engine->booleanClass) {
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
type = Type_BooleanObject;
value = val;
}
protected:
BooleanObject(InternalClass *ic)
: Object(ic) {
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
type = Type_BooleanObject;
value = Encode(false);
}
SafeValue value;
NumberObject(ExecutionEngine *engine, const ValueRef val)
: Object(engine->numberClass) {
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
type = Type_NumberObject;
value = val;
}
protected:
NumberObject(InternalClass *ic)
: Object(ic) {
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
type = Type_NumberObject;
value = Encode((int)0);
}
ObjectIterator it;
ForEachIteratorObject(ExecutionContext *ctx, const ObjectRef o)
: Object(ctx->engine), it(workArea, workArea + 1, o, ObjectIterator::EnumerableOnly|ObjectIterator::WithProtoChain) {
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
type = Type_ForeachIteratorObject;
}
ObjectCtor::ObjectCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("Object"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue ObjectCtor::construct(Managed *that, CallData *callData)
: Object(engine)
, m_object(object)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
Scope scope(engine);
ScopedObject protectThis(scope, this);
, m_object(object)
, m_index(index)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
subtype = WrappedQtMethod;
m_qmlGlobal = qmlGlobal;
}
, m_object(object)
, m_signalIndex(signalIndex)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
DEFINE_MANAGED_VTABLE(QmlSignalHandler);
, m_ignoreCase(ignoreCase)
, m_multiLine(multiline)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
type = Type_RegExpObject;
if (!engine)
void RegExpObject::init(ExecutionEngine *engine)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
type = Type_RegExpObject;
Scope scope(engine);
RegExpCtor::RegExpCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("RegExp"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue RegExpCtor::construct(Managed *m, CallData *callData)
#ifndef QV4SCOPEDVALUE_P_H
#define QV4SCOPEDVALUE_P_H
-#include "qv4engine_p.h"
+#include "qv4context_p.h"
#include "qv4value_def_p.h"
QT_BEGIN_NAMESPACE
{
Q_ASSERT(scope->inUse);
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
function = f;
function->compilationUnit->ref();
needsActivation = function->needsActivation();
{
Q_ASSERT(scope->inUse);
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
function = 0;
needsActivation = false;
, unit(unit)
{
unit->ref();
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
~CompilationUnitHolder()
{
, m_isReference(false)
{
type = Type_QmlSequence;
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
flags &= ~SimpleArray;
QV4::Scope scope(engine);
QV4::ScopedObject protectThis(scope, this);
, m_isReference(true)
{
type = Type_QmlSequence;
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
flags &= ~SimpleArray;
QV4::Scope scope(engine);
QV4::ScopedObject protectThis(scope, this);
{
_text->ref.ref();
len = _text->size;
- vtbl = &static_vtbl;
+ if (engine)
+ setVTable(&static_vtbl);
type = Type_String;
subtype = StringType_Unknown;
}
, stringHash(UINT_MAX), largestSubLength(qMax(l->largestSubLength, r->largestSubLength))
, len(l->len + r->len)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
type = Type_String;
subtype = StringType_Unknown;
String()
: Managed(0), _text(QStringData::sharedNull()), identifier(0)
, stringHash(UINT_MAX), largestSubLength(0), len(0)
- { vtbl = &static_vtbl; type = Type_String; subtype = StringType_Unknown; }
+ { setVTable(&static_vtbl); type = Type_String; subtype = StringType_Unknown; }
String(ExecutionEngine *engine, const QString &text);
String(ExecutionEngine *engine, String *l, String *n);
~String() {
StringObject::StringObject(InternalClass *ic)
: Object(ic)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
type = Type_StringObject;
Scope scope(engine());
StringObject::StringObject(ExecutionEngine *engine, const ValueRef val)
: Object(engine->stringClass)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
type = Type_StringObject;
Scope scope(engine);
StringCtor::StringCtor(ExecutionContext *scope)
: FunctionObject(scope, QStringLiteral("String"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue StringCtor::construct(Managed *m, CallData *callData)
, ExecutionEngine::ScarceResourceData(QVariant())
, m_vmePropertyReferenceCount(0)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
VariantObject::VariantObject(ExecutionEngine *engine, const QVariant &value)
, ExecutionEngine::ScarceResourceData(value)
, m_vmePropertyReferenceCount(0)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
if (isScarce())
engine->scarceResources.insert(this);
}
{
incubator.reset(new QQmlComponentIncubator(this, m));
v8 = engine;
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
valuemap = QV4::Primitive::undefinedValue();
qmlGlobal = QV4::Primitive::undefinedValue();
v8(engine), readOnly(true), ownsContext(ownsContext), isNullWrapper(false),
context(context), scopeObject(scopeObject), idObjectsWrapper(0)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
QmlContextWrapper::~QmlContextWrapper()
: Object(engine)
, contextWrapper(contextWrapper)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
ReturnedValue QQmlIdObjectsArray::getIndexed(Managed *m, uint index, bool *hasProperty)
: Object(QV8Engine::getV4(engine)),
v8(engine)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
flags &= ~SimpleArray;
}
QQmlLocaleData(QV4::ExecutionEngine *engine)
: QV4::Object(engine)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
type = Type_Object;
}
: Object(QV8Engine::getV4(engine)),
v8(engine), mode(IncludeEnums), type(0), typeNamespace(0), importNamespace(0)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
QmlTypeWrapper::~QmlTypeWrapper()
: Object(QV8Engine::getV4(engine)), objectType(objectType)
{
v8 = engine;
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
QmlValueTypeWrapper::~QmlValueTypeWrapper()
, list(list)
, d(data)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
if (d)
d->addref();
: Object(engine)
, d(data)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
if (d)
d->addref();
NodePrototype(ExecutionEngine *engine)
: Object(engine)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
Scope scope(engine);
ScopedObject protectThis(scope, this);
: Object(engine)
, d(data)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
if (d)
d->addref();
: Object(engine)
, request(request)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
~QQmlXMLHttpRequestWrapper() {
delete request;
QQmlXMLHttpRequestCtor(ExecutionEngine *engine)
: FunctionObject(engine->rootContext, QStringLiteral("XMLHttpRequest"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
Scope scope(engine);
ScopedValue protectThis(scope, this);
, m_platform(0)
, m_application(0)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
Scope scope(v4);
ScopedObject protectThis(scope, this);
: QV4::FunctionObject(originalFunction->scope, originalFunction->name)
, originalFunction(originalFunction)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
bindingKeyFlag = true;
}
, code(code)
, flag(flag)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
static QV4::ReturnedValue construct(QV4::Managed *m, QV4::CallData *)
QQmlDelegateModelGroupChange(QV4::ExecutionEngine *engine)
: Object(engine)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
static QV4::ReturnedValue method_get_index(QV4::CallContext *ctx) {
QQmlDelegateModelGroupChangeArray(QV4::ExecutionEngine *engine)
: Object(engine)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
flags &= ~SimpleArray;
}
virtual ~QQmlDelegateModelGroupChangeArray() {}
QQmlDelegateModelItemObject(QV4::ExecutionEngine *engine, QQmlDelegateModelItem *item)
: Object(engine)
, item(item)
- { vtbl = &static_vtbl; }
+ { setVTable(&static_vtbl); }
~QQmlDelegateModelItemObject();
static void destroy(Managed *that);
QQuickJSContext2D(QV4::ExecutionEngine *engine)
: QV4::Object(engine)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
QQuickContext2D* context;
, patternRepeatX(false)
, patternRepeatY(false)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
QBrush brush;
bool patternRepeatX:1;
QQuickJSContext2DPixelData(QV4::ExecutionEngine *engine)
: QV4::Object(engine)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
flags &= ~SimpleArray;
}
QQuickJSContext2DImageData(QV4::ExecutionEngine *engine)
: QV4::Object(engine)
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
pixelData = QV4::Primitive::undefinedValue();
QV4::Scope scope(engine);
struct Print: FunctionObject
{
Print(ExecutionContext *scope): FunctionObject(scope, QStringLiteral("print")) {
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
static ReturnedValue call(Managed *, CallData *callData)
GC(ExecutionContext* scope)
: FunctionObject(scope, QStringLiteral("gc"))
{
- vtbl = &static_vtbl;
+ setVTable(&static_vtbl);
}
static ReturnedValue call(Managed *m, CallData *)
{