diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2014-11-18 17:35:48 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-12-11 08:40:18 +0100 |
commit | 7cc351c2ca6b0caad04cab411e91d8050cb284c8 (patch) | |
tree | 00fbd5fd22157ee1827cc6275ae2e9d10e694504 /src/qml/jsruntime/qv4context_p.h | |
parent | 689caa14fc527a7e3c85403c963bec7451c6c1db (diff) |
Cleanup header inclusion order
Change-Id: I6f7973370c4468e7d1686a147efca66bfbfdd5b1
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.h | 79 |
1 files changed, 18 insertions, 61 deletions
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<QV4::ExecutionContext *>(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<const CallContext *>(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<ExecutionContext *>(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) |