Cleanup header inclusion order

Change-Id: I6f7973370c4468e7d1686a147efca66bfbfdd5b1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
This commit is contained in:
Lars Knoll 2014-11-18 17:35:48 +01:00 committed by Simon Hausmann
parent 689caa14fc
commit 7cc351c2ca
3 changed files with 77 additions and 80 deletions

View File

@ -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)

View File

@ -36,6 +36,7 @@
#include "qv4global_p.h"
#include "private/qv4isel_p.h"
#include "qv4managed_p.h"
#include "qv4context_p.h"
#include <private/qintrusivelist_p.h>
namespace WTF {
@ -338,6 +339,55 @@ private:
QmlExtensions *m_qmlExtensions;
};
struct ExecutionContextSaver
{
ExecutionEngine *engine;
ExecutionContext *savedContext;
ExecutionContextSaver(ExecutionContext *context)
: engine(context->d()->engine)
, savedContext(context)
{
}
~ExecutionContextSaver()
{
engine->current = savedContext;
}
};
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;
}
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);
}
// ### Remove me
inline
void Managed::mark(QV4::ExecutionEngine *engine)

View File

@ -48,7 +48,15 @@ namespace QV4 {
struct ScopedValue;
struct Scope {
inline explicit Scope(ExecutionContext *ctx);
inline Scope(ExecutionContext *ctx)
: engine(ctx->d()->engine)
#ifndef QT_NO_DEBUG
, size(0)
#endif
{
mark = engine->jsStackTop;
}
explicit Scope(ExecutionEngine *e)
: engine(e)
#ifndef QT_NO_DEBUG
@ -353,24 +361,6 @@ struct Scoped
Value *ptr;
};
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];
};
struct ScopedCallData {
ScopedCallData(Scope &scope, int argc)
{