From 7cc351c2ca6b0caad04cab411e91d8050cb284c8 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 18 Nov 2014 17:35:48 +0100 Subject: Cleanup header inclusion order Change-Id: I6f7973370c4468e7d1686a147efca66bfbfdd5b1 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4context_p.h | 79 +++++++++------------------------------- 1 file changed, 18 insertions(+), 61 deletions(-) (limited to 'src/qml/jsruntime/qv4context_p.h') diff --git a/src/qml/jsruntime/qv4context_p.h b/src/qml/jsruntime/qv4context_p.h index bb45bf4b7d..39456b202f 100644 --- a/src/qml/jsruntime/qv4context_p.h +++ b/src/qml/jsruntime/qv4context_p.h @@ -34,9 +34,7 @@ #define QMLJS_ENVIRONMENT_H #include "qv4global_p.h" -#include "qv4scopedvalue_p.h" #include "qv4managed_p.h" -#include "qv4engine_p.h" QT_BEGIN_NAMESPACE @@ -51,6 +49,24 @@ struct CallContext; struct CatchContext; struct WithContext; +struct CallData +{ + // below is to be compatible with Value. Initialize tag to 0 +#if Q_BYTE_ORDER != Q_LITTLE_ENDIAN + uint tag; +#endif + int argc; +#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN + uint tag; +#endif + inline ReturnedValue argument(int i) { + return i < argc ? args[i].asReturnedValue() : Primitive::undefinedValue().asReturnedValue(); + } + + Value thisObject; + Value args[1]; +}; + namespace Heap { struct ExecutionContext : Base { @@ -142,23 +158,6 @@ 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) - , lineNumber(-1) -{ - // ### GC - engine->current = reinterpret_cast(this); -} - - struct CallContext : public ExecutionContext { V4_MANAGED(CallContext, ExecutionContext) @@ -203,48 +202,6 @@ inline const CallContext *ExecutionContext::asCallContext() const return d()->type >= Heap::ExecutionContext::Type_SimpleCallContext ? static_cast(this) : 0; } - -inline void ExecutionEngine::pushContext(CallContext *context) -{ - Q_ASSERT(current && current->d() && context && context->d()); - context->d()->parent = current->d(); - current = context; -} - -inline ExecutionContext *ExecutionEngine::popContext() -{ - Q_ASSERT(current->d()->parent); - // ### GC - current = reinterpret_cast(current->d()->parent); - Q_ASSERT(current && current->d()); - return current; -} - -struct ExecutionContextSaver -{ - ExecutionEngine *engine; - ExecutionContext *savedContext; - - ExecutionContextSaver(ExecutionContext *context) - : engine(context->d()->engine) - , savedContext(context) - { - } - ~ExecutionContextSaver() - { - engine->current = savedContext; - } -}; - -inline Scope::Scope(ExecutionContext *ctx) - : engine(ctx->d()->engine) -#ifndef QT_NO_DEBUG - , size(0) -#endif -{ - mark = engine->jsStackTop; -} - /* Function *f, int argc */ #define requiredMemoryForExecutionContect(f, argc) \ ((sizeof(CallContext::Data) + 7) & ~7) + sizeof(Value) * (f->varCount() + qMax((uint)argc, f->formalParameterCount())) + sizeof(CallData) -- cgit v1.2.3