diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-06-13 14:30:03 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-07-22 13:49:19 +0200 |
commit | b393c405b7568e80628bc99501a9c53bbd0e678d (patch) | |
tree | 51280658b1ec97947a66c6afc503b23ae48f0d8d /src/qml/jsruntime/qv4regexp.cpp | |
parent | 00a46fa07bf87c6ffa0d60b4a98b51685fdc1ef5 (diff) |
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 <lars.knoll@digia.com>
Diffstat (limited to 'src/qml/jsruntime/qv4regexp.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4regexp.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
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<RegExp>(engine, pattern, ignoreCase, multiline); if (!cache) cache = engine->regExpCache = new RegExpCache; - result->cache = cache; + result->d()->cache = cache; cache->insert(key, result); return result; |