aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4script.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <[email protected]>2013-08-20 16:54:29 +0200
committerSimon Hausmann <[email protected]>2013-08-20 16:54:29 +0200
commit461892e492e0bef399714557498380703b3e029b (patch)
treead82e1ae8286bbe650b2ee19ad393a4ab8996bb1 /src/qml/jsruntime/qv4script.cpp
parenta71e35a95c9f352db91fb82d8a564d01ba961341 (diff)
parent90aaff37be419ca1f1da40df64424c0d88bfaf19 (diff)
Merge branch 'wip/v4' of ssh://codereview.qt-project.org/qt/qtdeclarative into dev
Conflicts: src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4codegen_p.h src/qml/compiler/qv4isel_moth.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4functionobject.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4runtime_p.h src/qml/jsruntime/qv4script.cpp sync.profile Change-Id: I1d785e2134bffac9553a1c16eed12816cbd1ad2c
Diffstat (limited to 'src/qml/jsruntime/qv4script.cpp')
-rw-r--r--src/qml/jsruntime/qv4script.cpp37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index bec5f0bfe8..d2d21d4fd5 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -67,8 +67,8 @@ struct QmlBindingWrapper : FunctionObject
{
vtbl = &static_vtbl;
function = f;
- function->ref();
- usesArgumentsObject = function->usesArgumentsObject;
+ function->compilationUnit->ref();
+ usesArgumentsObject = function->usesArgumentsObject();
needsActivation = function->needsActivation();
defineReadonlyProperty(scope->engine->id_length, Value::fromInt32(1));
@@ -163,14 +163,13 @@ void Script::parse()
inheritedLocals.append(*i ? (*i)->toQString() : QString());
RuntimeCodegen cg(scope, strictMode);
- V4IR::Function *globalIRCode = cg(sourceFile, sourceCode, program, &module,
- parseAsBinding ? QQmlJS::Codegen::QmlBinding : QQmlJS::Codegen::EvalCode, inheritedLocals);
- QScopedPointer<EvalInstructionSelection> isel(v4->iselFactory->create(v4, &module));
+ cg(sourceFile, sourceCode, program, &module,
+ parseAsBinding ? QQmlJS::Codegen::QmlBinding : QQmlJS::Codegen::EvalCode, inheritedLocals);
+ QScopedPointer<EvalInstructionSelection> isel(v4->iselFactory->create(v4->executableAllocator, &module));
if (inheritContext)
isel->setUseFastLookups(false);
- if (globalIRCode) {
- vmFunction = isel->vmFunction(globalIRCode);
- }
+ QV4::CompiledData::CompilationUnit *compilationUnit = isel->compile();
+ vmFunction = compilationUnit->linkToEngine(v4);
}
if (!vmFunction)
@@ -191,20 +190,34 @@ Value Script::run()
TemporaryAssignment<Function*> savedGlobalCode(engine->globalCode, vmFunction);
bool strict = scope->strictMode;
- Lookup *lookups = scope->lookups;
+ Lookup *oldLookups = scope->lookups;
+ CompiledData::CompilationUnit * const oldCompilationUnit = scope->compilationUnit;
+ const CompiledData::Function * const oldCompiledFunction = scope->compiledFunction;
+ String ** const oldRuntimeStrings = scope->runtimeStrings;
- scope->strictMode = vmFunction->isStrict;
- scope->lookups = vmFunction->lookups;
+ scope->strictMode = vmFunction->isStrict();
+ scope->lookups = vmFunction->compilationUnit->runtimeLookups;
+ scope->compilationUnit = vmFunction->compilationUnit;
+ scope->compiledFunction = vmFunction->compiledFunction;
+ scope->runtimeStrings = vmFunction->compilationUnit->runtimeStrings;
QV4::Value result;
try {
result = vmFunction->code(scope, vmFunction->codeData);
} catch (Exception &e) {
scope->strictMode = strict;
- scope->lookups = lookups;
+ scope->lookups = oldLookups;
+ scope->compilationUnit = oldCompilationUnit;
+ scope->compiledFunction = oldCompiledFunction;
+ scope->runtimeStrings = oldRuntimeStrings;
throw;
}
+ scope->lookups = oldLookups;
+ scope->compilationUnit = oldCompilationUnit;
+ scope->compiledFunction = oldCompiledFunction;
+ scope->runtimeStrings = oldRuntimeStrings;
+
return result;
} else {