diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2014-11-07 19:07:54 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-11-12 12:13:33 +0100 |
commit | f2532fd6112341d247bb2a35d28fa54293004ade (patch) | |
tree | 8c4b5585796ca3573093ca296ec951d532307fc3 | |
parent | 31084c37f60a54d0d1ab2e07a79e070268540498 (diff) |
Cleanups
Remove a few reinterpret_cast's
Change-Id: I800b8c41123eaa22cf879571c747b4de0375e8cb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r-- | src/qml/jsruntime/qv4engine.cpp | 3 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4functionobject.cpp | 10 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4functionobject_p.h | 1 | ||||
-rw-r--r-- | src/qml/jsruntime/qv4runtime.cpp | 5 |
4 files changed, 16 insertions, 3 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp index 2225acf398..3ae19bb42a 100644 --- a/src/qml/jsruntime/qv4engine.cpp +++ b/src/qml/jsruntime/qv4engine.cpp @@ -891,8 +891,7 @@ void ExecutionEngine::markObjects() Q_ASSERT(c->inUse); if (!c->markBit) { c->markBit = 1; - // ### GC - reinterpret_cast<ExecutionContext *>(c)->markObjects(c, this); + c->internalClass->vtable->markObjects(c, this); } c = c->parent; } diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp index 54853eea4a..cd860f4c2b 100644 --- a/src/qml/jsruntime/qv4functionobject.cpp +++ b/src/qml/jsruntime/qv4functionobject.cpp @@ -81,6 +81,16 @@ Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, const QString f->init(n.getPointer(), createProto); } +Heap::FunctionObject::FunctionObject(ExecutionContext *scope, const QString &name, bool createProto) + : Heap::Object(scope->engine->functionClass) + , scope(scope) +{ + Scope s(scope->engine); + ScopedFunctionObject f(s, this); + ScopedString n(s, s.engine->newString(name)); + f->init(n.getPointer(), createProto); +} + Heap::FunctionObject::FunctionObject(QV4::ExecutionContext *scope, const ReturnedValue name) : Heap::Object(scope->d()->engine->functionClass) , scope(scope->d()) diff --git a/src/qml/jsruntime/qv4functionobject_p.h b/src/qml/jsruntime/qv4functionobject_p.h index 7cbdccb8fd..2d8b31bc0b 100644 --- a/src/qml/jsruntime/qv4functionobject_p.h +++ b/src/qml/jsruntime/qv4functionobject_p.h @@ -59,6 +59,7 @@ struct Q_QML_PRIVATE_EXPORT FunctionObject : Object { FunctionObject(QV4::ExecutionContext *scope, QV4::String *name, bool createProto = false); FunctionObject(QV4::ExecutionContext *scope, const QString &name = QString(), bool createProto = false); + FunctionObject(ExecutionContext *scope, const QString &name = QString(), bool createProto = false); FunctionObject(QV4::ExecutionContext *scope, const ReturnedValue name); FunctionObject(ExecutionContext *scope, const ReturnedValue name); FunctionObject(InternalClass *ic); diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp index bb70203d46..abbb4911b2 100644 --- a/src/qml/jsruntime/qv4runtime.cpp +++ b/src/qml/jsruntime/qv4runtime.cpp @@ -1139,7 +1139,10 @@ ExecutionContext *Runtime::pushCatchScope(ExecutionContext *ctx, String *excepti ExecutionContext *Runtime::popScope(ExecutionContext *ctx) { - return ctx->engine()->popContext(); + Scope scope(ctx->engine()); + ScopedContext c(scope, ctx->engine()->popContext()); + // ### GC? + return c.getPointer(); } void Runtime::declareVar(ExecutionContext *ctx, bool deletable, String *name) |