From b393c405b7568e80628bc99501a9c53bbd0e678d Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 13 Jun 2014 14:30:03 +0200 Subject: Change the object allocation scheme Instead of allocating the data directly, centralize the object and its ::Data allocation in one place in the memory manager. This is in preparation for additional pointer indirection later. Change-Id: I7880e1e7354b3258b6a8965be378cd09c9467d25 Reviewed-by: Lars Knoll --- src/qml/jsruntime/qv4regexp.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/qml/jsruntime/qv4regexp.cpp') diff --git a/src/qml/jsruntime/qv4regexp.cpp b/src/qml/jsruntime/qv4regexp.cpp index 08025e07cf..e2de584e31 100644 --- a/src/qml/jsruntime/qv4regexp.cpp +++ b/src/qml/jsruntime/qv4regexp.cpp @@ -42,6 +42,7 @@ #include "qv4regexp_p.h" #include "qv4engine_p.h" #include "qv4scopedvalue_p.h" +#include "qv4mm_p.h" using namespace QV4; @@ -49,7 +50,7 @@ RegExpCache::~RegExpCache() { for (RegExpCache::Iterator it = begin(), e = end(); it != e; ++it) - it.value()->cache = 0; + it.value()->d()->cache = 0; clear(); } @@ -70,22 +71,22 @@ uint RegExp::match(const QString &string, int start, uint *matchOffsets) return JSC::Yarr::interpret(byteCode().get(), s.characters16(), string.length(), start, matchOffsets); } -RegExp::Data* RegExp::create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase, bool multiline) +RegExp* RegExp::create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase, bool multiline) { RegExpCacheKey key(pattern, ignoreCase, multiline); RegExpCache *cache = engine->regExpCache; if (cache) { - if (RegExp::Data *result = cache->value(key)) + if (RegExp *result = cache->value(key)) return result; } - RegExp::Data *result = new (engine) RegExp::Data(engine, pattern, ignoreCase, multiline); + RegExp *result = engine->memoryManager->alloc(engine, pattern, ignoreCase, multiline); if (!cache) cache = engine->regExpCache = new RegExpCache; - result->cache = cache; + result->d()->cache = cache; cache->insert(key, result); return result; -- cgit v1.2.3