From 920339c210778ca987aa161b1102df4a0d00149f Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 3 Aug 2017 12:20:06 +0200 Subject: No need to pass the Engine pointer to VME::exec() Change-Id: I1e43305e26833a6d9b714e89f59ccead6bd12605 Reviewed-by: Erik Verbruggen --- src/qml/jsruntime/qv4function.cpp | 2 +- src/qml/jsruntime/qv4function_p.h | 4 ++-- src/qml/jsruntime/qv4profiling_p.h | 10 +++++----- src/qml/jsruntime/qv4vme_moth.cpp | 4 +++- src/qml/jsruntime/qv4vme_moth_p.h | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp index 713ed589b7..d21afa3b87 100644 --- a/src/qml/jsruntime/qv4function.cpp +++ b/src/qml/jsruntime/qv4function.cpp @@ -50,7 +50,7 @@ QT_BEGIN_NAMESPACE using namespace QV4; Function::Function(ExecutionEngine *engine, CompiledData::CompilationUnit *unit, const CompiledData::Function *function, - ReturnedValue (*codePtr)(Function *, ExecutionEngine *)) + ReturnedValue (*codePtr)(Function *)) : compiledFunction(function) , compilationUnit(unit) , code(codePtr) diff --git a/src/qml/jsruntime/qv4function_p.h b/src/qml/jsruntime/qv4function_p.h index 70561f28e8..9fc51e90af 100644 --- a/src/qml/jsruntime/qv4function_p.h +++ b/src/qml/jsruntime/qv4function_p.h @@ -63,7 +63,7 @@ struct Q_QML_EXPORT Function { const CompiledData::Function *compiledFunction; CompiledData::CompilationUnit *compilationUnit; - ReturnedValue (*code)(Function *, ExecutionEngine *); + ReturnedValue (*code)(Function *); const uchar *codeData; // first nArguments names in internalClass are the actual arguments @@ -73,7 +73,7 @@ struct Q_QML_EXPORT Function { bool canUseSimpleCall; Function(ExecutionEngine *engine, CompiledData::CompilationUnit *unit, const CompiledData::Function *function, - ReturnedValue (*codePtr)(Function *, ExecutionEngine *)); + ReturnedValue (*codePtr)(Function *)); ~Function(); // used when dynamically assigning signal handlers (QQmlConnection) diff --git a/src/qml/jsruntime/qv4profiling_p.h b/src/qml/jsruntime/qv4profiling_p.h index 71a6d34f9d..e7b6909690 100644 --- a/src/qml/jsruntime/qv4profiling_p.h +++ b/src/qml/jsruntime/qv4profiling_p.h @@ -61,7 +61,7 @@ #define Q_V4_PROFILE_ALLOC(engine, size, type) (!engine) #define Q_V4_PROFILE_DEALLOC(engine, size, type) (!engine) -#define Q_V4_PROFILE(engine, function) (function->code(engine, function->codeData)) +#define Q_V4_PROFILE(engine, function) (function->code(function)) QT_BEGIN_NAMESPACE @@ -88,8 +88,8 @@ QT_END_NAMESPACE #define Q_V4_PROFILE(engine, function)\ (Q_UNLIKELY(engine->profiler()) &&\ (engine->profiler()->featuresEnabled & (1 << Profiling::FeatureFunctionCall)) ?\ - Profiling::FunctionCallProfiler::profileCall(engine->profiler(), engine, function) :\ - function->code(function, engine)) + Profiling::FunctionCallProfiler::profileCall(engine->profiler(), function) :\ + function->code(function)) QT_BEGIN_NAMESPACE @@ -279,10 +279,10 @@ public: profiler->m_data.append(FunctionCall(function, startTime, profiler->m_timer.nsecsElapsed())); } - static ReturnedValue profileCall(Profiler *profiler, ExecutionEngine *engine, Function *function) + static ReturnedValue profileCall(Profiler *profiler, Function *function) { FunctionCallProfiler callProfiler(profiler, function); - return function->code(function, engine); + return function->code(function); } Profiler *profiler; diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp index 85def98492..d3a2533136 100644 --- a/src/qml/jsruntime/qv4vme_moth.cpp +++ b/src/qml/jsruntime/qv4vme_moth.cpp @@ -419,7 +419,7 @@ static inline const QV4::Value &constant(Function *function, int index) return function->compilationUnit->constants[index]; } -QV4::ReturnedValue VME::exec(Function *function, ExecutionEngine *engine) +QV4::ReturnedValue VME::exec(Function *function) { #ifdef DO_TRACE_INSTR qDebug("Starting VME with context=%p and code=%p", context, code); @@ -435,6 +435,8 @@ QV4::ReturnedValue VME::exec(Function *function, ExecutionEngine *engine) #undef MOTH_INSTR_ADDR #endif + ExecutionEngine *engine = function->internalClass->engine; + // Arguments/locals are used a *lot*, and pre-fetching them removes a whole bunch of triple // (or quadruple) indirect loads. QV4::Value *arguments = nullptr; diff --git a/src/qml/jsruntime/qv4vme_moth_p.h b/src/qml/jsruntime/qv4vme_moth_p.h index 4e42ca6fde..51ea5fbdac 100644 --- a/src/qml/jsruntime/qv4vme_moth_p.h +++ b/src/qml/jsruntime/qv4vme_moth_p.h @@ -65,7 +65,7 @@ namespace Moth { class VME { public: - static QV4::ReturnedValue exec(QV4::Function *, QV4::ExecutionEngine *); + static QV4::ReturnedValue exec(QV4::Function *); }; } // namespace Moth -- cgit v1.2.3