From f09042c2ee210878ee0639e32cf490c012021847 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 5 Mar 2013 16:11:22 +0100 Subject: 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 --- tools/v4/main.cpp | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'tools') 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 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 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; -- cgit v1.2.3