summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-03-05 16:11:22 +0100
committerLars Knoll <lars.knoll@digia.com>2013-03-05 16:34:10 +0100
commitf09042c2ee210878ee0639e32cf490c012021847 (patch)
treed5dc72deea4259926a3938ad7fe14654f88daf24 /tools
parent471e0b0f7522c246f6f4f214a8483343eb237285 (diff)
Move function execution into a little ExecutionEngine::run helper function
This will allow for re-use from the v8 wrapper API. Change-Id: I2330432dad43d7fd7af6147e96a0cbbb340cd917 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/v4/main.cpp18
1 files changed, 5 insertions, 13 deletions
diff --git a/tools/v4/main.cpp b/tools/v4/main.cpp
index 89a25973..03ba8285 100644
--- a/tools/v4/main.cpp
+++ b/tools/v4/main.cpp
@@ -337,14 +337,14 @@ int main(int argc, char *argv[])
#endif // QMLJS_WITH_LLVM
case use_masm:
case use_moth: {
- QScopedPointer<QQmlJS::EvalISelFactory> iSelFactory;
+ QQmlJS::EvalISelFactory* iSelFactory = 0;
if (mode == use_moth) {
- iSelFactory.reset(new QQmlJS::Moth::ISelFactory);
+ iSelFactory = new QQmlJS::Moth::ISelFactory;
} else {
- iSelFactory.reset(new QQmlJS::MASM::ISelFactory);
+ iSelFactory = new QQmlJS::MASM::ISelFactory;
}
- QQmlJS::VM::ExecutionEngine vm(iSelFactory.data());
+ QQmlJS::VM::ExecutionEngine vm(iSelFactory);
QScopedPointer<QQmlJS::Debugging::Debugger> debugger;
if (enableDebugging)
@@ -375,15 +375,7 @@ int main(int argc, char *argv[])
/*strictMode =*/ false, /*inheritContext =*/ false);
if (!f)
continue;
- vm.globalCode = f;
-
- ctx->strictMode = f->isStrict;
- ctx->lookups = f->lookups;
- if (debugger)
- debugger->aboutToCall(0, ctx);
- QQmlJS::VM::Value result = f->code(ctx, f->codeData);
- if (debugger)
- debugger->justLeft(ctx);
+ QQmlJS::VM::Value result = vm.run(f);
if (!result.isUndefined()) {
if (! qgetenv("SHOW_EXIT_VALUE").isEmpty())
std::cout << "exit value: " << qPrintable(result.toString(ctx)->toQString()) << std::endl;