aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4context_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-05-19 15:50:22 +0200
committerLars Knoll <lars.knoll@qt.io>2017-05-19 18:54:54 +0000
commit8bc243f569e3feb1005fbca426bf24f59c38af2e (patch)
tree3e69253b161432e4a02c3daa2de4ffbd2d9293f4 /src/qml/jsruntime/qv4context_p.h
parent5bc38a50308665bdc185eb96dbcc9ba7948ab4e0 (diff)
Move the engine() accessor from Object to Managed
We can easily do this now that Managed has a pointer to an internal class (which always has a back pointer to the ExecutionEngine). Remove the extra engine pointer from ExecutionContext, and clean up tow methods in String. Change-Id: I98d750b1afbdeadf42e66ae0c92c48db1a7adc31 Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
Diffstat (limited to 'src/qml/jsruntime/qv4context_p.h')
-rw-r--r--src/qml/jsruntime/qv4context_p.h17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h
index 89ff6dc957..0b63922a4b 100644
--- a/src/qml/jsruntime/qv4context_p.h
+++ b/src/qml/jsruntime/qv4context_p.h
@@ -105,7 +105,6 @@ struct QmlContext;
// can use the Members macro
struct ExecutionContextData {
CallData *callData;
- ExecutionEngine *engine;
ExecutionContext *outer;
Lookup *lookups;
const QV4::Value *constantTable;
@@ -120,8 +119,7 @@ struct ExecutionContextData {
Q_STATIC_ASSERT(std::is_standard_layout<ExecutionContextData>::value);
Q_STATIC_ASSERT(offsetof(ExecutionContextData, callData) == 0);
-Q_STATIC_ASSERT(offsetof(ExecutionContextData, engine) == offsetof(ExecutionContextData, callData) + QT_POINTER_SIZE);
-Q_STATIC_ASSERT(offsetof(ExecutionContextData, outer) == offsetof(ExecutionContextData, engine) + QT_POINTER_SIZE);
+Q_STATIC_ASSERT(offsetof(ExecutionContextData, outer) == offsetof(ExecutionContextData, callData) + QT_POINTER_SIZE);
Q_STATIC_ASSERT(offsetof(ExecutionContextData, lookups) == offsetof(ExecutionContextData, outer) + QT_POINTER_SIZE);
Q_STATIC_ASSERT(offsetof(ExecutionContextData, constantTable) == offsetof(ExecutionContextData, lookups) + QT_POINTER_SIZE);
Q_STATIC_ASSERT(offsetof(ExecutionContextData, compilationUnit) == offsetof(ExecutionContextData, constantTable) + QT_POINTER_SIZE);
@@ -141,11 +139,10 @@ struct ExecutionContext : Base, public ExecutionContextData {
Type_CallContext = 0x6
};
- void init(ExecutionEngine *engine, ContextType t)
+ void init(ContextType t)
{
Base::init();
- this->engine = engine;
type = t;
lineNumber = -1;
}
@@ -172,12 +169,10 @@ struct CallContextSizeStruct : public ExecutionContext, public CallContextData {
struct CallContext : ExecutionContext, public CallContextData {
static Q_CONSTEXPR size_t baseOffset = sizeof(CallContextSizeStruct) - sizeof(CallContextData);
- static CallContext *createSimpleContext(ExecutionEngine *v4);
- void freeSimpleCallContext();
- void init(ExecutionEngine *engine, ContextType t = Type_SimpleCallContext)
+ void init(ContextType t = Type_SimpleCallContext)
{
- ExecutionContext::init(engine, t);
+ ExecutionContext::init(t);
}
inline unsigned int formalParameterCount() const;
@@ -204,7 +199,7 @@ V4_ASSERT_IS_TRIVIAL(CatchContext)
struct WithContext : ExecutionContext {
void init(ExecutionContext *outerContext, Object *with)
{
- Heap::ExecutionContext::init(outerContext->engine, Heap::ExecutionContext::Type_WithContext);
+ Heap::ExecutionContext::init(Heap::ExecutionContext::Type_WithContext);
outer = outerContext;
callData = outer->callData;
lookups = outer->lookups;
@@ -230,8 +225,6 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
Q_MANAGED_TYPE(ExecutionContext)
V4_INTERNALCLASS(ExecutionContext)
- ExecutionEngine *engine() const { return d()->engine; }
-
Heap::CallContext *newCallContext(Function *f, CallData *callData);
Heap::WithContext *newWithContext(Heap::Object *with);
Heap::CatchContext *newCatchContext(Heap::String *exceptionVarName, ReturnedValue exceptionValue);