aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2014-11-07 05:46:20 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2014-11-12 12:13:03 +0100
commit19ae8cdffeaeb3fc6716b6f0a7ee8756ec9700c7 (patch)
tree91083b44b1f3db49c246ce74b20af83310d530f5 /src/qml/jsruntime/qv4context_p.h
parent7e61b8c09c647229e78bdedec9421f90063466af (diff)
Convert ExecutionContext::parent/outer to use a heap object
Change-Id: I1b8ee831cfcdd5b1904ce24a341f5a796dce41cf Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4context_p.h')
-rw-r--r--src/qml/jsruntime/qv4context_p.h48
1 files changed, 27 insertions, 21 deletions
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index 601af5a520..5b1abb5686 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -68,21 +68,7 @@ struct ExecutionContext : Base {
EvalCode *next;
};
- ExecutionContext(ExecutionEngine *engine, ContextType t)
- : Base(engine->executionContextClass)
- , type(t)
- , strictMode(false)
- , engine(engine)
- , parent(engine->currentContext())
- , outer(0)
- , lookups(0)
- , compilationUnit(0)
- , currentEvalCode(0)
- , lineNumber(-1)
- {
- // ### GC
- engine->current = reinterpret_cast<QV4::ExecutionContext *>(this);
- }
+ inline ExecutionContext(ExecutionEngine *engine, ContextType t);
ContextType type;
bool strictMode;
@@ -90,9 +76,8 @@ struct ExecutionContext : Base {
CallData *callData;
ExecutionEngine *engine;
- // ### GC
- QV4::ExecutionContext *parent;
- QV4::ExecutionContext *outer;
+ ExecutionContext *parent;
+ ExecutionContext *outer;
Lookup *lookups;
CompiledData::CompilationUnit *compilationUnit;
EvalCode *currentEvalCode;
@@ -151,7 +136,7 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
d()->type = t;
d()->strictMode = false;
d()->engine = engine;
- d()->parent = engine->currentContext();
+ d()->parent = engine->currentContext()->d();
d()->outer = 0;
d()->lookups = 0;
d()->compilationUnit = 0;
@@ -181,6 +166,24 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
static void markObjects(Heap::Base *m, ExecutionEngine *e);
};
+inline
+Heap::ExecutionContext::ExecutionContext(ExecutionEngine *engine, ContextType t)
+ : Heap::Base(engine->executionContextClass)
+ , type(t)
+ , strictMode(false)
+ , engine(engine)
+ , parent(engine->currentContext()->d())
+ , outer(0)
+ , lookups(0)
+ , compilationUnit(0)
+ , currentEvalCode(0)
+ , lineNumber(-1)
+{
+ // ### GC
+ engine->current = reinterpret_cast<QV4::ExecutionContext *>(this);
+}
+
+
struct CallContext : public ExecutionContext
{
V4_MANAGED(CallContext, ExecutionContext)
@@ -228,7 +231,8 @@ inline const CallContext *ExecutionContext::asCallContext() const
inline void ExecutionEngine::pushContext(CallContext *context)
{
- context->d()->parent = current;
+ Q_ASSERT(current && current->d() && context && context->d());
+ context->d()->parent = current->d();
current = context;
current->d()->currentEvalCode = 0;
}
@@ -236,7 +240,9 @@ inline void ExecutionEngine::pushContext(CallContext *context)
inline ExecutionContext *ExecutionEngine::popContext()
{
Q_ASSERT(current->d()->parent);
- current = current->d()->parent;
+ // ### GC
+ current = reinterpret_cast<ExecutionContext *>(current->d()->parent);
+ Q_ASSERT(current && current->d());
return current;
}