aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2014-02-05 16:12:16 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-05 18:29:02 +0100
commitd89e2698669db83f0b3591ac43f054aacc8bfc85 (patch)
treee3739bc79f8b1b4dfb10c3587b8b3c69f20bc142 /src/qml/jsruntime
parenta83444c1370a75733c47bd4f87a5a1248ab983c6 (diff)
Smaller performance fixes
Move commonly used variables in the ExecutionEngine to the beginning of the struct to increase cache locality. Keep the engine pointer in a register in the interpreter to save one memory load per instruction. Change-Id: If2540c66b62685701511f410aff495c0a20ca694 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime')
-rw-r--r--src/qml/jsruntime/qv4engine.cpp4
-rw-r--r--src/qml/jsruntime/qv4engine_p.h15
-rw-r--r--src/qml/jsruntime/qv4vme_moth.cpp7
3 files changed, 14 insertions, 12 deletions
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 6768de27f1..4c1d3fceb2 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -157,10 +157,10 @@ quintptr getStackLimit()
ExecutionEngine::ExecutionEngine(QQmlJS::EvalISelFactory *factory)
- : memoryManager(new QV4::MemoryManager)
+ : current(0)
+ , memoryManager(new QV4::MemoryManager)
, executableAllocator(new QV4::ExecutableAllocator)
, regExpAllocator(new QV4::ExecutableAllocator)
- , current(0)
, bumperPointerAllocator(new WTF::BumpPointerAllocator)
, jsStack(new WTF::PageAllocation)
, debugger(0)
diff --git a/src/qml/jsruntime/qv4engine_p.h b/src/qml/jsruntime/qv4engine_p.h
index 8a7cd75a7b..6974835e8b 100644
--- a/src/qml/jsruntime/qv4engine_p.h
+++ b/src/qml/jsruntime/qv4engine_p.h
@@ -121,11 +121,6 @@ struct ExecutionContextSaver;
struct Q_QML_EXPORT ExecutionEngine
{
- MemoryManager *memoryManager;
- ExecutableAllocator *executableAllocator;
- ExecutableAllocator *regExpAllocator;
- QScopedPointer<QQmlJS::EvalISelFactory> iselFactory;
-
private:
friend struct ExecutionContextSaver;
friend struct ExecutionContext;
@@ -133,9 +128,16 @@ private:
public:
ExecutionContext *currentContext() const { return current; }
+ Value *jsStackTop;
+ quint32 hasException;
GlobalContext *rootContext;
- Value *jsStackTop;
+ MemoryManager *memoryManager;
+ ExecutableAllocator *executableAllocator;
+ ExecutableAllocator *regExpAllocator;
+ QScopedPointer<QQmlJS::EvalISelFactory> iselFactory;
+
+
Value *jsStackLimit;
quintptr cStackLimit;
@@ -353,7 +355,6 @@ public:
// Exception handling
Value exceptionValue;
- quint32 hasException;
StackTrace exceptionStackTrace;
ReturnedValue throwException(const ValueRef value);
diff --git a/src/qml/jsruntime/qv4vme_moth.cpp b/src/qml/jsruntime/qv4vme_moth.cpp
index 22fe4968a2..5f079a7d05 100644
--- a/src/qml/jsruntime/qv4vme_moth.cpp
+++ b/src/qml/jsruntime/qv4vme_moth.cpp
@@ -150,12 +150,12 @@ Param traceParam(const Param &param)
#define STOREVALUE(param, value) { \
QV4::ReturnedValue tmp = (value); \
- if (context->engine->hasException) \
+ if (engine->hasException) \
goto catchException; \
VALUE(param) = tmp; \
}
#define CHECK_EXCEPTION \
- if (context->engine->hasException) \
+ if (engine->hasException) \
goto catchException
QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code,
@@ -183,7 +183,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code,
const uchar *exceptionHandler = 0;
- QV4::Debugging::Debugger *debugger = context->engine->debugger;
+ QV4::ExecutionEngine *engine = context->engine;
#ifdef DO_TRACE_INSTR
qDebug("Starting VME with context=%p and code=%p", context, code);
@@ -658,6 +658,7 @@ QV4::ReturnedValue VME::run(QV4::ExecutionContext *context, const uchar *code,
MOTH_END_INSTR(Ret)
MOTH_BEGIN_INSTR(Debug)
+ QV4::Debugging::Debugger *debugger = context->engine->debugger;
if (debugger && (instr.breakPoint || debugger->pauseAtNextOpportunity()))
debugger->maybeBreakAtInstruction(code, instr.breakPoint);
MOTH_END_INSTR(Debug)