Cleanup RegExp
Move it's Data into the Heap namespace. Change-Id: I4ed6ea481376ae1d0c1fb08b56feee4764083231 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
This commit is contained in:
parent
84aae25c0b
commit
da2396478f
|
@ -115,7 +115,7 @@ struct SparseArrayData : public ArrayData {
|
|||
struct Q_QML_EXPORT ArrayData : public Managed
|
||||
{
|
||||
typedef Heap::ArrayData::Type Type;
|
||||
V4_MANAGED2(ArrayData, Managed)
|
||||
V4_MANAGED(ArrayData, Managed)
|
||||
|
||||
uint alloc() const { return d()->alloc; }
|
||||
uint &alloc() { return d()->alloc; }
|
||||
|
|
|
@ -142,7 +142,7 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
|
|||
IsExecutionContext = true
|
||||
};
|
||||
|
||||
V4_MANAGED2(ExecutionContext, Managed)
|
||||
V4_MANAGED(ExecutionContext, Managed)
|
||||
Q_MANAGED_TYPE(ExecutionContext)
|
||||
|
||||
ExecutionContext(ExecutionEngine *engine, Heap::ExecutionContext::ContextType t)
|
||||
|
@ -183,7 +183,7 @@ struct Q_QML_EXPORT ExecutionContext : public Managed
|
|||
|
||||
struct CallContext : public ExecutionContext
|
||||
{
|
||||
V4_MANAGED2(CallContext, ExecutionContext)
|
||||
V4_MANAGED(CallContext, ExecutionContext)
|
||||
|
||||
// formals are in reverse order
|
||||
String * const *formals() const;
|
||||
|
@ -201,18 +201,18 @@ inline ReturnedValue CallContext::argument(int i) {
|
|||
|
||||
struct GlobalContext : public ExecutionContext
|
||||
{
|
||||
V4_MANAGED2(GlobalContext, ExecutionContext)
|
||||
V4_MANAGED(GlobalContext, ExecutionContext)
|
||||
|
||||
};
|
||||
|
||||
struct CatchContext : public ExecutionContext
|
||||
{
|
||||
V4_MANAGED2(CatchContext, ExecutionContext)
|
||||
V4_MANAGED(CatchContext, ExecutionContext)
|
||||
};
|
||||
|
||||
struct WithContext : public ExecutionContext
|
||||
{
|
||||
V4_MANAGED2(WithContext, ExecutionContext)
|
||||
V4_MANAGED(WithContext, ExecutionContext)
|
||||
};
|
||||
|
||||
inline CallContext *ExecutionContext::asCallContext()
|
||||
|
|
|
@ -57,19 +57,7 @@ inline void qYouForgotTheQ_MANAGED_Macro(T1, T2) {}
|
|||
#define V4_MANAGED_SIZE_TEST
|
||||
#endif
|
||||
|
||||
#define V4_MANAGED(superClass) \
|
||||
public: \
|
||||
Q_MANAGED_CHECK \
|
||||
typedef superClass SuperClass; \
|
||||
static const QV4::ManagedVTable static_vtbl; \
|
||||
static inline const QV4::ManagedVTable *staticVTable() { return &static_vtbl; } \
|
||||
template <typename _T> \
|
||||
QV4::Returned<_T> *asReturned() { return QV4::Returned<_T>::create(this); } \
|
||||
V4_MANAGED_SIZE_TEST \
|
||||
const Data *d() const { return &static_cast<const Data &>(Managed::data); } \
|
||||
Data *d() { return &static_cast<Data &>(Managed::data); }
|
||||
|
||||
#define V4_MANAGED2(DataClass, superClass) \
|
||||
#define V4_MANAGED(DataClass, superClass) \
|
||||
public: \
|
||||
Q_MANAGED_CHECK \
|
||||
typedef QV4::Heap::DataClass Data; \
|
||||
|
@ -190,7 +178,7 @@ const QV4::ObjectVTable classname::static_vtbl = \
|
|||
struct Q_QML_PRIVATE_EXPORT Managed
|
||||
{
|
||||
Heap::Base data;
|
||||
V4_MANAGED2(Base, Managed)
|
||||
V4_MANAGED(Base, Managed)
|
||||
enum {
|
||||
IsExecutionContext = false,
|
||||
IsString = false,
|
||||
|
|
|
@ -54,7 +54,7 @@ struct MemberData : Base {
|
|||
|
||||
struct MemberData : Managed
|
||||
{
|
||||
V4_MANAGED2(MemberData, Managed)
|
||||
V4_MANAGED(MemberData, Managed)
|
||||
|
||||
MemberData(QV4::InternalClass *ic) : Managed(ic) {}
|
||||
Value &operator[] (uint idx) { return d()->data[idx]; }
|
||||
|
|
|
@ -85,13 +85,13 @@ Returned<RegExp> *RegExp::create(ExecutionEngine* engine, const QString& pattern
|
|||
return result.asReturned();
|
||||
}
|
||||
|
||||
RegExp::Data::Data(ExecutionEngine* engine, const QString &pattern, bool ignoreCase, bool multiline)
|
||||
: Heap::Base(engine->regExpValueClass)
|
||||
Heap::RegExp::RegExp(ExecutionEngine* engine, const QString &pattern, bool ignoreCase, bool multiline)
|
||||
: Base(engine->regExpValueClass)
|
||||
, pattern(pattern)
|
||||
, ignoreCase(ignoreCase)
|
||||
, multiLine(multiline)
|
||||
{
|
||||
setVTable(staticVTable());
|
||||
setVTable(QV4::RegExp::staticVTable());
|
||||
const char* error = 0;
|
||||
JSC::Yarr::YarrPattern yarrPattern(WTF::String(pattern), ignoreCase, multiline, &error);
|
||||
if (error)
|
||||
|
@ -106,7 +106,7 @@ RegExp::Data::Data(ExecutionEngine* engine, const QString &pattern, bool ignoreC
|
|||
#endif
|
||||
}
|
||||
|
||||
RegExp::Data::~Data()
|
||||
Heap::RegExp::~RegExp()
|
||||
{
|
||||
if (cache) {
|
||||
RegExpCacheKey key(this);
|
||||
|
|
|
@ -56,25 +56,29 @@ namespace QV4 {
|
|||
struct ExecutionEngine;
|
||||
struct RegExpCacheKey;
|
||||
|
||||
namespace Heap {
|
||||
|
||||
struct RegExp : Base {
|
||||
RegExp(ExecutionEngine* engine, const QString& pattern, bool ignoreCase, bool multiline);
|
||||
~RegExp();
|
||||
QString pattern;
|
||||
OwnPtr<JSC::Yarr::BytecodePattern> byteCode;
|
||||
#if ENABLE(YARR_JIT)
|
||||
JSC::Yarr::YarrCodeBlock jitCode;
|
||||
#endif
|
||||
RegExpCache *cache;
|
||||
int subPatternCount;
|
||||
bool ignoreCase;
|
||||
bool multiLine;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
struct RegExp : public Managed
|
||||
{
|
||||
struct Data : Heap::Base {
|
||||
Data(ExecutionEngine* engine, const QString& pattern, bool ignoreCase, bool multiline);
|
||||
~Data();
|
||||
QString pattern;
|
||||
OwnPtr<JSC::Yarr::BytecodePattern> byteCode;
|
||||
#if ENABLE(YARR_JIT)
|
||||
JSC::Yarr::YarrCodeBlock jitCode;
|
||||
#endif
|
||||
RegExpCache *cache;
|
||||
int subPatternCount;
|
||||
bool ignoreCase;
|
||||
bool multiLine;
|
||||
};
|
||||
V4_MANAGED(Managed)
|
||||
V4_MANAGED(RegExp, Managed)
|
||||
Q_MANAGED_TYPE(RegExp)
|
||||
|
||||
|
||||
QString pattern() const { return d()->pattern; }
|
||||
OwnPtr<JSC::Yarr::BytecodePattern> &byteCode() { return d()->byteCode; }
|
||||
#if ENABLE(YARR_JIT)
|
||||
|
|
Loading…
Reference in New Issue