diff options
author | Erik Verbruggen <[email protected]> | 2016-09-09 10:43:08 +0200 |
---|---|---|
committer | Erik Verbruggen <[email protected]> | 2016-10-05 14:40:59 +0000 |
commit | 1b90dc4482d001512f09a5785d4cbd8030879d82 (patch) | |
tree | 6c2b0816b6e8bf1aa781c44bacd15ce11825a66a /src/qml/jsruntime/qv4regexp_p.h | |
parent | 64afa01c32fc1824b280452ceb1ade4f655487f2 (diff) |
QML: Make Heap::RegExp and Heap::String trivial
Change-Id: Ia8eda67c9d59069d3a64363699720a79ba1348a1
Reviewed-by: Simon Hausmann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4regexp_p.h')
-rw-r--r-- | src/qml/jsruntime/qv4regexp_p.h | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/qml/jsruntime/qv4regexp_p.h b/src/qml/jsruntime/qv4regexp_p.h index 33ed1d1117..b3bdeada94 100644 --- a/src/qml/jsruntime/qv4regexp_p.h +++ b/src/qml/jsruntime/qv4regexp_p.h @@ -76,11 +76,11 @@ struct RegExpCacheKey; namespace Heap { struct RegExp : Base { - RegExp(ExecutionEngine* engine, const QString& pattern, bool ignoreCase, bool multiline); + void init(ExecutionEngine* engine, const QString& pattern, bool ignoreCase, bool multiline); void destroy(); - QString pattern; - OwnPtr<JSC::Yarr::BytecodePattern> byteCode; + QString *pattern; + JSC::Yarr::BytecodePattern *byteCode; #if ENABLE(YARR_JIT) JSC::Yarr::YarrCodeBlock *jitCode; #endif @@ -91,6 +91,7 @@ struct RegExp : Base { int captureCount() const { return subPatternCount + 1; } }; +Q_STATIC_ASSERT(std::is_trivial<RegExp>::value); } @@ -100,8 +101,8 @@ struct RegExp : public Managed Q_MANAGED_TYPE(RegExp) V4_NEEDS_DESTROY - QString pattern() const { return d()->pattern; } - OwnPtr<JSC::Yarr::BytecodePattern> &byteCode() { return d()->byteCode; } + QString pattern() const { return *d()->pattern; } + JSC::Yarr::BytecodePattern *byteCode() { return d()->byteCode; } #if ENABLE(YARR_JIT) JSC::Yarr::YarrCodeBlock *jitCode() const { return d()->jitCode; } #endif @@ -112,7 +113,7 @@ struct RegExp : public Managed static Heap::RegExp *create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase = false, bool multiline = false); - bool isValid() const { return d()->byteCode.get(); } + bool isValid() const { return d()->byteCode; } uint match(const QString& string, int start, uint *matchOffsets); @@ -143,7 +144,7 @@ struct RegExpCacheKey }; inline RegExpCacheKey::RegExpCacheKey(const RegExp::Data *re) - : pattern(re->pattern) + : pattern(*re->pattern) , ignoreCase(re->ignoreCase) , multiLine(re->multiLine) {} |