aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/jsruntime/qv4script.cpp')
-rw-r--r--src/qml/jsruntime/qv4script.cpp83
1 files changed, 36 insertions, 47 deletions
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index 1834e28be6..ad83a52d8f 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -60,39 +60,44 @@
using namespace QV4;
-struct QmlBindingWrapper : FunctionObject
+QmlBindingWrapper::QmlBindingWrapper(ExecutionContext *scope, Function *f, Object *qml)
+ : FunctionObject(scope, scope->engine->id_eval)
+ , qml(qml)
{
- Q_MANAGED
+ vtbl = &static_vtbl;
+ function = f;
+ function->compilationUnit->ref();
+ usesArgumentsObject = function->usesArgumentsObject();
+ needsActivation = function->needsActivation();
+ defineReadonlyProperty(scope->engine->id_length, Value::fromInt32(1));
+
+ qmlContext = scope->engine->current->newQmlContext(this, qml);
+ scope->engine->popContext();
+}
- QmlBindingWrapper(ExecutionContext *scope, Function *f, Object *qml)
- : FunctionObject(scope, scope->engine->id_eval)
- , qml(qml)
- {
- vtbl = &static_vtbl;
- function = f;
- function->compilationUnit->ref();
- usesArgumentsObject = function->usesArgumentsObject();
- needsActivation = function->needsActivation();
- defineReadonlyProperty(scope->engine->id_length, Value::fromInt32(1));
-
- qmlContext = scope->engine->current->newQmlContext(this, qml);
- scope->engine->popContext();
- }
+ReturnedValue QmlBindingWrapper::call(Managed *that, CallData *)
+{
+ ExecutionEngine *engine = that->engine();
+ Scope scope(engine);
+ QmlBindingWrapper *This = static_cast<QmlBindingWrapper *>(that);
- static ReturnedValue call(Managed *that, CallData *);
- static void markObjects(Managed *m)
- {
- QmlBindingWrapper *wrapper = static_cast<QmlBindingWrapper*>(m);
- if (wrapper->qml)
- wrapper->qml->mark();
- FunctionObject::markObjects(m);
- wrapper->qmlContext->mark();
- }
+ CallContext *ctx = This->qmlContext;
+ std::fill(ctx->locals, ctx->locals + ctx->function->varCount, Value::undefinedValue());
+ engine->pushContext(ctx);
+ ScopedValue result(scope, This->function->code(ctx, This->function->codeData));
+ engine->popContext();
-private:
- Object *qml;
- CallContext *qmlContext;
-};
+ return result.asReturnedValue();
+}
+
+void QmlBindingWrapper::markObjects(Managed *m)
+{
+ QmlBindingWrapper *wrapper = static_cast<QmlBindingWrapper*>(m);
+ if (wrapper->qml)
+ wrapper->qml->mark();
+ FunctionObject::markObjects(m);
+ wrapper->qmlContext->mark();
+}
DEFINE_MANAGED_VTABLE(QmlBindingWrapper);
@@ -122,23 +127,6 @@ struct CompilationUnitHolder : public QV4::Object
DEFINE_MANAGED_VTABLE(CompilationUnitHolder);
-ReturnedValue QmlBindingWrapper::call(Managed *that, CallData *)
-{
- ExecutionEngine *engine = that->engine();
- Scope scope(engine);
- QmlBindingWrapper *This = static_cast<QmlBindingWrapper *>(that);
-
- CallContext *ctx = This->qmlContext;
- std::fill(ctx->locals, ctx->locals + ctx->function->varCount, Value::undefinedValue());
- engine->pushContext(ctx);
- ScopedValue result(scope, This->function->code(ctx, This->function->codeData));
- engine->popContext();
-
- return result.asReturnedValue();
-
-}
-
-
Script::~Script()
{
}
@@ -192,7 +180,8 @@ void Script::parse()
RuntimeCodegen cg(scope, strictMode);
cg.generateFromProgram(sourceFile, sourceCode, program, &module,
parseAsBinding ? QQmlJS::Codegen::QmlBinding : QQmlJS::Codegen::EvalCode, inheritedLocals);
- QScopedPointer<EvalInstructionSelection> isel(v4->iselFactory->create(v4->executableAllocator, &module));
+ QV4::Compiler::JSUnitGenerator jsGenerator(&module);
+ QScopedPointer<EvalInstructionSelection> isel(v4->iselFactory->create(v4->executableAllocator, &module, &jsGenerator));
if (inheritContext)
isel->setUseFastLookups(false);
QV4::CompiledData::CompilationUnit *compilationUnit = isel->compile();