Move more Data members over to the Heap namespace
Change-Id: I74347da3f0f47220bb1f8cf13b872b547fd18a4d Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
This commit is contained in:
parent
ef8ad8234b
commit
5117c8e79c
|
@ -67,17 +67,17 @@ private:
|
|||
ObjectIterator(Value *scratch1, Value *scratch2, uint flags); // Constructor that requires calling init()
|
||||
};
|
||||
|
||||
namespace Heap {
|
||||
struct ForEachIteratorObject : Object {
|
||||
ForEachIteratorObject(QV4::ExecutionEngine *engine, QV4::Object *o);
|
||||
ObjectIterator it;
|
||||
Value workArea[2];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
struct ForEachIteratorObject: Object {
|
||||
struct Data : Heap::Object {
|
||||
Data(ExecutionEngine *engine, QV4::Object *o)
|
||||
: Heap::Object(engine)
|
||||
, it(workArea, workArea + 1, o, ObjectIterator::EnumerableOnly|ObjectIterator::WithProtoChain) {
|
||||
setVTable(staticVTable());
|
||||
}
|
||||
ObjectIterator it;
|
||||
Value workArea[2];
|
||||
};
|
||||
V4_OBJECT(Object)
|
||||
V4_OBJECT2(ForEachIteratorObject, Object)
|
||||
Q_MANAGED_TYPE(ForeachIteratorObject)
|
||||
|
||||
ReturnedValue nextPropertyName() { return d()->it.nextPropertyNameAsString(); }
|
||||
|
@ -86,6 +86,14 @@ protected:
|
|||
static void markObjects(Heap::Base *that, ExecutionEngine *e);
|
||||
};
|
||||
|
||||
inline
|
||||
Heap::ForEachIteratorObject::ForEachIteratorObject(QV4::ExecutionEngine *engine, QV4::Object *o)
|
||||
: Heap::Object(engine)
|
||||
, it(workArea, workArea + 1, o, ObjectIterator::EnumerableOnly|ObjectIterator::WithProtoChain)
|
||||
{
|
||||
setVTable(QV4::ForEachIteratorObject::staticVTable());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -49,10 +49,10 @@ using namespace QV4;
|
|||
|
||||
DEFINE_OBJECT_VTABLE(ObjectCtor);
|
||||
|
||||
ObjectCtor::Data::Data(ExecutionContext *scope)
|
||||
Heap::ObjectCtor::ObjectCtor(QV4::ExecutionContext *scope)
|
||||
: Heap::FunctionObject(scope, QStringLiteral("Object"))
|
||||
{
|
||||
setVTable(staticVTable());
|
||||
setVTable(QV4::ObjectCtor::staticVTable());
|
||||
}
|
||||
|
||||
ReturnedValue ObjectCtor::construct(Managed *that, CallData *callData)
|
||||
|
|
|
@ -41,12 +41,17 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
namespace QV4 {
|
||||
|
||||
namespace Heap {
|
||||
|
||||
struct ObjectCtor : FunctionObject {
|
||||
ObjectCtor(QV4::ExecutionContext *scope);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
struct ObjectCtor: FunctionObject
|
||||
{
|
||||
struct Data : Heap::FunctionObject {
|
||||
Data(ExecutionContext *scope);
|
||||
};
|
||||
V4_OBJECT(FunctionObject)
|
||||
V4_OBJECT2(ObjectCtor, FunctionObject)
|
||||
|
||||
static ReturnedValue construct(Managed *that, CallData *callData);
|
||||
static ReturnedValue call(Managed *that, CallData *callData);
|
||||
|
|
|
@ -233,11 +233,11 @@ static QV4::ReturnedValue LoadProperty(QV8Engine *engine, QObject *object,
|
|||
}
|
||||
}
|
||||
|
||||
QObjectWrapper::Data::Data(ExecutionEngine *engine, QObject *object)
|
||||
Heap::QObjectWrapper::QObjectWrapper(ExecutionEngine *engine, QObject *object)
|
||||
: Heap::Object(engine)
|
||||
, object(object)
|
||||
{
|
||||
setVTable(staticVTable());
|
||||
setVTable(QV4::QObjectWrapper::staticVTable());
|
||||
}
|
||||
|
||||
void QObjectWrapper::initializeBindings(ExecutionEngine *engine)
|
||||
|
|
|
@ -67,13 +67,18 @@ class QQmlPropertyData;
|
|||
namespace QV4 {
|
||||
struct QObjectSlotDispatcher;
|
||||
|
||||
struct Q_QML_EXPORT QObjectWrapper : public QV4::Object
|
||||
namespace Heap {
|
||||
|
||||
struct QObjectWrapper : Object {
|
||||
QObjectWrapper(QV4::ExecutionEngine *engine, QObject *object);
|
||||
QPointer<QObject> object;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
struct Q_QML_EXPORT QObjectWrapper : public Object
|
||||
{
|
||||
struct Data : QV4::Heap::Object {
|
||||
Data(ExecutionEngine *engine, QObject *object);
|
||||
QPointer<QObject> object;
|
||||
};
|
||||
V4_OBJECT(QV4::Object)
|
||||
V4_OBJECT2(QObjectWrapper, Object)
|
||||
|
||||
enum RevisionMode { IgnoreRevision, CheckRevision };
|
||||
|
||||
|
|
|
@ -64,37 +64,37 @@ using namespace QV4;
|
|||
DEFINE_OBJECT_VTABLE(RegExpObject);
|
||||
DEFINE_OBJECT_VTABLE(RegExpPrototype);
|
||||
|
||||
RegExpObject::Data::Data(InternalClass *ic)
|
||||
Heap::RegExpObject::RegExpObject(InternalClass *ic)
|
||||
: Heap::Object(ic)
|
||||
{
|
||||
setVTable(staticVTable());
|
||||
setVTable(QV4::RegExpObject::staticVTable());
|
||||
|
||||
Scope scope(ic->engine);
|
||||
Scoped<RegExpObject> o(scope, this);
|
||||
o->d()->value = RegExp::create(ic->engine, QString(), false, false)->getPointer();
|
||||
Scoped<QV4::RegExpObject> o(scope, this);
|
||||
o->d()->value = QV4::RegExp::create(ic->engine, QString(), false, false)->getPointer();
|
||||
o->d()->global = false;
|
||||
o->init(ic->engine);
|
||||
}
|
||||
|
||||
RegExpObject::Data::Data(ExecutionEngine *engine, RegExp *value, bool global)
|
||||
Heap::RegExpObject::RegExpObject(QV4::ExecutionEngine *engine, QV4::RegExp *value, bool global)
|
||||
: Heap::Object(engine->regExpClass)
|
||||
, value(value)
|
||||
, global(global)
|
||||
{
|
||||
setVTable(staticVTable());
|
||||
setVTable(QV4::RegExpObject::staticVTable());
|
||||
|
||||
Scope scope(engine);
|
||||
Scoped<RegExpObject> o(scope, this);
|
||||
Scoped<QV4::RegExpObject> o(scope, this);
|
||||
o->init(engine);
|
||||
}
|
||||
|
||||
// Converts a QRegExp to a JS RegExp.
|
||||
// The conversion is not 100% exact since ECMA regexp and QRegExp
|
||||
// have different semantics/flags, but we try to do our best.
|
||||
RegExpObject::Data::Data(ExecutionEngine *engine, const QRegExp &re)
|
||||
Heap::RegExpObject::RegExpObject(QV4::ExecutionEngine *engine, const QRegExp &re)
|
||||
: Heap::Object(engine->regExpClass)
|
||||
{
|
||||
setVTable(staticVTable());
|
||||
setVTable(QV4::RegExpObject::staticVTable());
|
||||
|
||||
value = 0;
|
||||
global = false;
|
||||
|
@ -137,9 +137,9 @@ RegExpObject::Data::Data(ExecutionEngine *engine, const QRegExp &re)
|
|||
}
|
||||
|
||||
Scope scope(engine);
|
||||
Scoped<RegExpObject> o(scope, this);
|
||||
Scoped<QV4::RegExpObject> o(scope, this);
|
||||
|
||||
o->d()->value = RegExp::create(engine, pattern, re.caseSensitivity() == Qt::CaseInsensitive, false)->getPointer();
|
||||
o->d()->value = QV4::RegExp::create(engine, pattern, re.caseSensitivity() == Qt::CaseInsensitive, false)->getPointer();
|
||||
|
||||
o->init(engine);
|
||||
}
|
||||
|
@ -229,14 +229,14 @@ uint RegExpObject::flags() const
|
|||
|
||||
DEFINE_OBJECT_VTABLE(RegExpCtor);
|
||||
|
||||
RegExpCtor::Data::Data(ExecutionContext *scope)
|
||||
Heap::RegExpCtor::RegExpCtor(QV4::ExecutionContext *scope)
|
||||
: Heap::FunctionObject(scope, QStringLiteral("RegExp"))
|
||||
{
|
||||
setVTable(staticVTable());
|
||||
setVTable(QV4::RegExpCtor::staticVTable());
|
||||
clearLastMatch();
|
||||
}
|
||||
|
||||
void RegExpCtor::Data::clearLastMatch()
|
||||
void Heap::RegExpCtor::clearLastMatch()
|
||||
{
|
||||
lastMatch = Primitive::nullValue();
|
||||
lastInput = internalClass->engine->id_empty;
|
||||
|
|
|
@ -55,16 +55,35 @@ QT_BEGIN_NAMESPACE
|
|||
|
||||
namespace QV4 {
|
||||
|
||||
struct RegExpObject: Object {
|
||||
struct Data : Heap::Object {
|
||||
Data(ExecutionEngine *engine, RegExp *value, bool global);
|
||||
Data(ExecutionEngine *engine, const QRegExp &re);
|
||||
Data(InternalClass *ic);
|
||||
namespace Heap {
|
||||
|
||||
RegExp *value;
|
||||
bool global;
|
||||
};
|
||||
V4_OBJECT(Object)
|
||||
struct RegExpObject : Object {
|
||||
RegExpObject(QV4::ExecutionEngine *engine, QV4::RegExp *value, bool global);
|
||||
RegExpObject(QV4::ExecutionEngine *engine, const QRegExp &re);
|
||||
RegExpObject(InternalClass *ic);
|
||||
|
||||
QV4::RegExp *value;
|
||||
bool global;
|
||||
};
|
||||
|
||||
struct RegExpCtor : FunctionObject {
|
||||
RegExpCtor(QV4::ExecutionContext *scope);
|
||||
Value lastMatch;
|
||||
StringValue lastInput;
|
||||
int lastMatchStart;
|
||||
int lastMatchEnd;
|
||||
void clearLastMatch();
|
||||
};
|
||||
|
||||
struct RegExpPrototype : RegExpObject
|
||||
{
|
||||
inline RegExpPrototype(InternalClass *ic);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
struct RegExpObject: Object {
|
||||
V4_OBJECT2(RegExpObject, Object)
|
||||
Q_MANAGED_TYPE(RegExpObject)
|
||||
|
||||
// needs to be compatible with the flags in qv4jsir_p.h
|
||||
|
@ -96,15 +115,7 @@ protected:
|
|||
|
||||
struct RegExpCtor: FunctionObject
|
||||
{
|
||||
struct Data : Heap::FunctionObject {
|
||||
Data(ExecutionContext *scope);
|
||||
Value lastMatch;
|
||||
StringValue lastInput;
|
||||
int lastMatchStart;
|
||||
int lastMatchEnd;
|
||||
void clearLastMatch();
|
||||
};
|
||||
V4_OBJECT(FunctionObject)
|
||||
V4_OBJECT2(RegExpCtor, FunctionObject)
|
||||
|
||||
Value lastMatch() { return d()->lastMatch; }
|
||||
StringValue lastInput() { return d()->lastInput; }
|
||||
|
@ -118,14 +129,7 @@ struct RegExpCtor: FunctionObject
|
|||
|
||||
struct RegExpPrototype: RegExpObject
|
||||
{
|
||||
struct Data : RegExpObject::Data
|
||||
{
|
||||
Data(InternalClass *ic): RegExpObject::Data(ic)
|
||||
{
|
||||
setVTable(staticVTable());
|
||||
}
|
||||
};
|
||||
V4_OBJECT(RegExpObject)
|
||||
V4_OBJECT2(RegExpPrototype, RegExpObject)
|
||||
|
||||
void init(ExecutionEngine *engine, Object *ctor);
|
||||
|
||||
|
@ -142,6 +146,12 @@ struct RegExpPrototype: RegExpObject
|
|||
static ReturnedValue method_get_rightContext(CallContext *ctx);
|
||||
};
|
||||
|
||||
inline Heap::RegExpPrototype::RegExpPrototype(InternalClass *ic)
|
||||
: RegExpObject(ic)
|
||||
{
|
||||
setVTable(QV4::RegExpPrototype::staticVTable());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
|
|
@ -53,20 +53,20 @@
|
|||
|
||||
using namespace QV4;
|
||||
|
||||
QmlBindingWrapper::Data::Data(ExecutionContext *scope, Function *f, QV4::Object *qml)
|
||||
Heap::QmlBindingWrapper::QmlBindingWrapper(QV4::ExecutionContext *scope, Function *f, QV4::Object *qml)
|
||||
: Heap::FunctionObject(scope, scope->d()->engine->id_eval, /*createProto = */ false)
|
||||
, qml(qml)
|
||||
{
|
||||
Q_ASSERT(scope->inUse());
|
||||
|
||||
setVTable(staticVTable());
|
||||
setVTable(QV4::QmlBindingWrapper::staticVTable());
|
||||
function = f;
|
||||
if (function)
|
||||
function->compilationUnit->addref();
|
||||
needsActivation = function ? function->needsActivation() : false;
|
||||
|
||||
Scope s(scope);
|
||||
Scoped<QmlBindingWrapper> o(s, this);
|
||||
Scoped<QV4::QmlBindingWrapper> o(s, this);
|
||||
|
||||
o->defineReadonlyProperty(scope->d()->engine->id_length, Primitive::fromInt32(1));
|
||||
|
||||
|
@ -74,17 +74,17 @@ QmlBindingWrapper::Data::Data(ExecutionContext *scope, Function *f, QV4::Object
|
|||
s.engine->popContext();
|
||||
}
|
||||
|
||||
QmlBindingWrapper::Data::Data(ExecutionContext *scope, QV4::Object *qml)
|
||||
Heap::QmlBindingWrapper::QmlBindingWrapper(QV4::ExecutionContext *scope, QV4::Object *qml)
|
||||
: Heap::FunctionObject(scope, scope->d()->engine->id_eval, /*createProto = */ false)
|
||||
, qml(qml)
|
||||
{
|
||||
Q_ASSERT(scope->inUse());
|
||||
|
||||
setVTable(staticVTable());
|
||||
setVTable(QV4::QmlBindingWrapper::staticVTable());
|
||||
needsActivation = false;
|
||||
|
||||
Scope s(scope);
|
||||
Scoped<QmlBindingWrapper> o(s, this);
|
||||
Scoped<QV4::QmlBindingWrapper> o(s, this);
|
||||
|
||||
o->defineReadonlyProperty(scope->d()->engine->id_length, Primitive::fromInt32(1));
|
||||
|
||||
|
|
|
@ -71,15 +71,19 @@ struct ContextStateSaver {
|
|||
}
|
||||
};
|
||||
|
||||
namespace Heap {
|
||||
struct QmlBindingWrapper : Heap::FunctionObject {
|
||||
QmlBindingWrapper(QV4::ExecutionContext *scope, Function *f, QV4::Object *qml);
|
||||
// Constructor for QML functions and signal handlers, resulting binding wrapper is not callable!
|
||||
QmlBindingWrapper(QV4::ExecutionContext *scope, QV4::Object *qml);
|
||||
QV4::Object *qml;
|
||||
QV4::CallContext *qmlContext;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
struct Q_QML_EXPORT QmlBindingWrapper : FunctionObject {
|
||||
struct Data : Heap::FunctionObject {
|
||||
Data(ExecutionContext *scope, Function *f, QV4::Object *qml);
|
||||
// Constructor for QML functions and signal handlers, resulting binding wrapper is not callable!
|
||||
Data(ExecutionContext *scope, QV4::Object *qml);
|
||||
QV4::Object *qml;
|
||||
CallContext *qmlContext;
|
||||
};
|
||||
V4_OBJECT(FunctionObject)
|
||||
V4_OBJECT2(QmlBindingWrapper, FunctionObject)
|
||||
|
||||
static ReturnedValue call(Managed *that, CallData *);
|
||||
static void markObjects(Heap::Base *m, ExecutionEngine *e);
|
||||
|
|
Loading…
Reference in New Issue