| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4regexp_p.h |
| Source code | Switch to Preprocessed file |
| Line | Source | Count |
|---|---|---|
| 1 | /**************************************************************************** | - |
| 2 | ** | - |
| 3 | ** Copyright (C) 2016 The Qt Company Ltd. | - |
| 4 | ** Contact: https://www.qt.io/licensing/ | - |
| 5 | ** | - |
| 6 | ** This file is part of the QtQml module of the Qt Toolkit. | - |
| 7 | ** | - |
| 8 | ** $QT_BEGIN_LICENSE:LGPL$ | - |
| 9 | ** Commercial License Usage | - |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in | - |
| 11 | ** accordance with the commercial license agreement provided with the | - |
| 12 | ** Software or, alternatively, in accordance with the terms contained in | - |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms | - |
| 14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - |
| 15 | ** information use the contact form at https://www.qt.io/contact-us. | - |
| 16 | ** | - |
| 17 | ** GNU Lesser General Public License Usage | - |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser | - |
| 19 | ** General Public License version 3 as published by the Free Software | - |
| 20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - |
| 21 | ** packaging of this file. Please review the following information to | - |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements | - |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - |
| 24 | ** | - |
| 25 | ** GNU General Public License Usage | - |
| 26 | ** Alternatively, this file may be used under the terms of the GNU | - |
| 27 | ** General Public License version 2.0 or (at your option) the GNU General | - |
| 28 | ** Public license version 3 or any later version approved by the KDE Free | - |
| 29 | ** Qt Foundation. The licenses are as published by the Free Software | - |
| 30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - |
| 31 | ** included in the packaging of this file. Please review the following | - |
| 32 | ** information to ensure the GNU General Public License requirements will | - |
| 33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - |
| 34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - |
| 35 | ** | - |
| 36 | ** $QT_END_LICENSE$ | - |
| 37 | ** | - |
| 38 | ****************************************************************************/ | - |
| 39 | #ifndef QV4REGEXP_H | - |
| 40 | #define QV4REGEXP_H | - |
| 41 | - | |
| 42 | // | - |
| 43 | // W A R N I N G | - |
| 44 | // ------------- | - |
| 45 | // | - |
| 46 | // This file is not part of the Qt API. It exists purely as an | - |
| 47 | // implementation detail. This header file may change from version to | - |
| 48 | // version without notice, or even be removed. | - |
| 49 | // | - |
| 50 | // We mean it. | - |
| 51 | // | - |
| 52 | - | |
| 53 | #include <QString> | - |
| 54 | #include <QVector> | - |
| 55 | - | |
| 56 | #include <wtf/RefPtr.h> | - |
| 57 | #include <wtf/FastAllocBase.h> | - |
| 58 | #include <wtf/BumpPointerAllocator.h> | - |
| 59 | - | |
| 60 | #include <limits.h> | - |
| 61 | - | |
| 62 | #include <yarr/Yarr.h> | - |
| 63 | #include <yarr/YarrInterpreter.h> | - |
| 64 | #include <yarr/YarrJIT.h> | - |
| 65 | - | |
| 66 | #include "qv4managed_p.h" | - |
| 67 | #include "qv4engine_p.h" | - |
| 68 | - | |
| 69 | QT_BEGIN_NAMESPACE | - |
| 70 | - | |
| 71 | namespace QV4 { | - |
| 72 | - | |
| 73 | struct ExecutionEngine; | - |
| 74 | struct RegExpCacheKey; | - |
| 75 | - | |
| 76 | namespace Heap { | - |
| 77 | - | |
| 78 | struct RegExp : Base { | - |
| 79 | void init(ExecutionEngine *engine, const QString& pattern, bool ignoreCase, bool multiline, bool global); | - |
| 80 | void destroy(); | - |
| 81 | - | |
| 82 | QString *pattern; | - |
| 83 | JSC::Yarr::BytecodePattern *byteCode; | - |
| 84 | #if ENABLE(YARR_JIT) | - |
| 85 | JSC::Yarr::YarrCodeBlock *jitCode; | - |
| 86 | #endif | - |
| 87 | bool hasValidJITCode() const { | - |
| 88 | #if ENABLE(YARR_JIT) | - |
| 89 | return jitCode && !jitCode->isFallBack() && jitCode->has16BitCode(); executed 1162972 times by 153 tests: return jitCode && !jitCode->isFallBack() && jitCode->has16BitCode();Executed by:
| 1162972 |
| 90 | #else | - |
| 91 | return false; | - |
| 92 | #endif | - |
| 93 | } | - |
| 94 | RegExpCache *cache; | - |
| 95 | int subPatternCount; | - |
| 96 | bool ignoreCase; | - |
| 97 | bool multiLine; | - |
| 98 | bool global; | - |
| 99 | bool valid; | - |
| 100 | - | |
| 101 | int captureCount() const { return subPatternCount + 1; } executed 19109 times by 3 tests: return subPatternCount + 1;Executed by:
| 19109 |
| 102 | }; | - |
| 103 | Q_STATIC_ASSERT(std::is_trivial< RegExp >::value); | - |
| 104 | - | |
| 105 | } | - |
| 106 | - | |
| 107 | struct RegExp : public Managed | - |
| 108 | { | - |
| 109 | V4_MANAGED(RegExp, Managed) executed 1056256 times by 8 tests: end of blockExecuted by:
never executed: end of blockexecuted 2306443 times by 153 tests: return &static_vtbl;Executed by:
executed 5704431 times by 153 tests: return static_cast<QV4::Heap::RegExp *>(m());Executed by:
executed 4553872 times by 153 tests: return dptr;Executed by:
| 0-5704431 |
| 110 | Q_MANAGED_TYPE(RegExp) | - |
| 111 | V4_NEEDS_DESTROY executed 1151794 times by 153 tests: end of blockExecuted by:
| 1151794 |
| 112 | V4_INTERNALCLASS(RegExp) executed 1151153 times by 153 tests: return e->internalClasses(QV4::EngineBase::Class_RegExp);Executed by:
| 1151153 |
| 113 | - | |
| 114 | QString pattern() const { return *d()->pattern; } never executed: return *d()->pattern; | 0 |
| 115 | JSC::Yarr::BytecodePattern *byteCode() { return d()->byteCode; } executed 216 times by 1 test: return d()->byteCode;Executed by:
| 216 |
| 116 | #if ENABLE(YARR_JIT) | - |
| 117 | JSC::Yarr::YarrCodeBlock *jitCode() const { return d()->jitCode; } executed 11231 times by 3 tests: return d()->jitCode;Executed by:
| 11231 |
| 118 | #endif | - |
| 119 | RegExpCache *cache() const { return d()->cache; } never executed: return d()->cache; | 0 |
| 120 | int subPatternCount() const { return d()->subPatternCount; } executed 3730 times by 3 tests: return d()->subPatternCount;Executed by:
| 3730 |
| 121 | bool ignoreCase() const { return d()->ignoreCase; } never executed: return d()->ignoreCase; | 0 |
| 122 | bool multiLine() const { return d()->multiLine; } never executed: return d()->multiLine; | 0 |
| 123 | bool global() const { return d()->global; } never executed: return d()->global; | 0 |
| 124 | - | |
| 125 | static Heap::RegExp *create(ExecutionEngine* engine, const QString& pattern, bool ignoreCase = false, bool multiline = false, bool global = false); | - |
| 126 | - | |
| 127 | bool isValid() const { return d()->valid; } executed 13612 times by 4 tests: return d()->valid;Executed by:
| 13612 |
| 128 | - | |
| 129 | uint match(const QString& string, int start, uint *matchOffsets); | - |
| 130 | - | |
| 131 | int captureCount() const { return subPatternCount() + 1; } executed 3730 times by 3 tests: return subPatternCount() + 1;Executed by:
| 3730 |
| 132 | - | |
| 133 | friend class RegExpCache; | - |
| 134 | }; | - |
| 135 | - | |
| 136 | struct RegExpCacheKey | - |
| 137 | { | - |
| 138 | RegExpCacheKey(const QString &pattern, bool ignoreCase, bool multiLine, bool global) | - |
| 139 | : pattern(pattern) | - |
| 140 | , ignoreCase(ignoreCase) | - |
| 141 | , multiLine(multiLine) | - |
| 142 | , global(global) | - |
| 143 | { } executed 1152555 times by 153 tests: end of blockExecuted by:
| 1152555 |
| 144 | explicit inline RegExpCacheKey(const RegExp::Data *re); | - |
| 145 | - | |
| 146 | bool operator==(const RegExpCacheKey &other) const | - |
| 147 | { return pattern == other.pattern && ignoreCase == other.ignoreCase && multiLine == other.multiLine && global == other.global; } executed 1417368 times by 153 tests: return pattern == other.pattern && ignoreCase == other.ignoreCase && multiLine == other.multiLine && global == other.global;Executed by:
| 1417368 |
| 148 | bool operator!=(const RegExpCacheKey &other) const | - |
| 149 | { return !operator==(other); } never executed: return !operator==(other); | 0 |
| 150 | - | |
| 151 | QString pattern; | - |
| 152 | uint ignoreCase : 1; | - |
| 153 | uint multiLine : 1; | - |
| 154 | uint global : 1; | - |
| 155 | }; | - |
| 156 | - | |
| 157 | inline RegExpCacheKey::RegExpCacheKey(const RegExp::Data *re) | - |
| 158 | : pattern(*re->pattern) | - |
| 159 | , ignoreCase(re->ignoreCase) | - |
| 160 | , multiLine(re->multiLine) | - |
| 161 | , global(re->global) | - |
| 162 | {} executed 1151208 times by 153 tests: end of blockExecuted by:
| 1151208 |
| 163 | - | |
| 164 | inline uint qHash(const RegExpCacheKey& key, uint seed = 0) Q_DECL_NOTHROW | - |
| 165 | { executed 2304563 times by 153 tests: return qHash(key.pattern, seed); }return qHash(key.pattern, seed);Executed by:
executed 2304563 times by 153 tests: return qHash(key.pattern, seed);Executed by:
| 2304563 |
| 166 | - | |
| 167 | class RegExpCache : public QHash<RegExpCacheKey, WeakValue> | - |
| 168 | { | - |
| 169 | public: | - |
| 170 | ~RegExpCache(); | - |
| 171 | }; | - |
| 172 | - | |
| 173 | - | |
| 174 | - | |
| 175 | } | - |
| 176 | - | |
| 177 | QT_END_NAMESPACE | - |
| 178 | - | |
| 179 | #endif // QV4REGEXP_H | - |
| Source code | Switch to Preprocessed file |