| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4identifier_p.h |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | namespace QV4 { | - | ||||||||||||
| 5 | - | |||||||||||||
| 6 | struct IdentifierHashEntry { | - | ||||||||||||
| 7 | PropertyKey identifier; | - | ||||||||||||
| 8 | int value; | - | ||||||||||||
| 9 | }; | - | ||||||||||||
| 10 | - | |||||||||||||
| 11 | struct IdentifierHashData | - | ||||||||||||
| 12 | { | - | ||||||||||||
| 13 | IdentifierHashData(IdentifierTable *table, int numBits); | - | ||||||||||||
| 14 | explicit IdentifierHashData(IdentifierHashData *other); | - | ||||||||||||
| 15 | ~IdentifierHashData(); | - | ||||||||||||
| 16 | void markObjects(MarkStack *markStack) const; | - | ||||||||||||
| 17 | - | |||||||||||||
| 18 | QBasicAtomicInt refCount; | - | ||||||||||||
| 19 | int alloc; | - | ||||||||||||
| 20 | int size; | - | ||||||||||||
| 21 | int numBits; | - | ||||||||||||
| 22 | IdentifierTable *identifierTable; | - | ||||||||||||
| 23 | IdentifierHashEntry *entries; | - | ||||||||||||
| 24 | }; | - | ||||||||||||
| 25 | - | |||||||||||||
| 26 | struct IdentifierHash | - | ||||||||||||
| 27 | { | - | ||||||||||||
| 28 | - | |||||||||||||
| 29 | IdentifierHashData *d = nullptr; | - | ||||||||||||
| 30 | - | |||||||||||||
| 31 | IdentifierHash() {} | - | ||||||||||||
| 32 | IdentifierHash(ExecutionEngine *engine); | - | ||||||||||||
| 33 | inline IdentifierHash(const IdentifierHash &other); | - | ||||||||||||
| 34 | inline ~IdentifierHash(); | - | ||||||||||||
| 35 | inline IdentifierHash &operator=(const IdentifierHash &other); | - | ||||||||||||
| 36 | - | |||||||||||||
| 37 | bool isEmpty() const { return executed 4802624 times by 85 tests: !d;return !d;Executed by:
executed 4802624 times by 85 tests: }return !d;Executed by:
| 4802624 | ||||||||||||
| 38 | - | |||||||||||||
| 39 | inline int count() const; | - | ||||||||||||
| 40 | - | |||||||||||||
| 41 | void detach(); | - | ||||||||||||
| 42 | - | |||||||||||||
| 43 | void add(const QString &str, int value); | - | ||||||||||||
| 44 | void add(Heap::String *str, int value); | - | ||||||||||||
| 45 | - | |||||||||||||
| 46 | inline int value(const QString &str) const; | - | ||||||||||||
| 47 | inline int value(String *str) const; | - | ||||||||||||
| 48 | QString findId(int value) const; | - | ||||||||||||
| 49 | - | |||||||||||||
| 50 | protected: | - | ||||||||||||
| 51 | IdentifierHashEntry *addEntry(PropertyKey i); | - | ||||||||||||
| 52 | const IdentifierHashEntry *lookup(PropertyKey identifier) const; | - | ||||||||||||
| 53 | const IdentifierHashEntry *lookup(const QString &str) const; | - | ||||||||||||
| 54 | const IdentifierHashEntry *lookup(String *str) const; | - | ||||||||||||
| 55 | const PropertyKey toIdentifier(const QString &str) const; | - | ||||||||||||
| 56 | const PropertyKey toIdentifier(Heap::String *str) const; | - | ||||||||||||
| 57 | }; | - | ||||||||||||
| 58 | - | |||||||||||||
| 59 | - | |||||||||||||
| 60 | inline IdentifierHash::IdentifierHash(const IdentifierHash &other) | - | ||||||||||||
| 61 | { | - | ||||||||||||
| 62 | d = other.d; | - | ||||||||||||
| 63 | if (d
| 0-181539 | ||||||||||||
| 64 | d->refCount.ref(); executed 181539 times by 85 tests: d->refCount.ref();Executed by:
| 181539 | ||||||||||||
| 65 | } executed 181539 times by 85 tests: end of blockExecuted by:
| 181539 | ||||||||||||
| 66 | - | |||||||||||||
| 67 | inline IdentifierHash::~IdentifierHash() | - | ||||||||||||
| 68 | { | - | ||||||||||||
| 69 | if (d
| 25818-458907 | ||||||||||||
| 70 | delete d; executed 93434 times by 85 tests: delete d;Executed by:
| 93434 | ||||||||||||
| 71 | } executed 484725 times by 149 tests: end of blockExecuted by:
| 484725 | ||||||||||||
| 72 | - | |||||||||||||
| 73 | IdentifierHash &IdentifierHash::operator=(const IdentifierHash &other) | - | ||||||||||||
| 74 | { | - | ||||||||||||
| 75 | if (other.d
| 0-225120 | ||||||||||||
| 76 | other.d->refCount.ref(); executed 225120 times by 85 tests: other.d->refCount.ref();Executed by:
| 225120 | ||||||||||||
| 77 | if (d
| 0-225120 | ||||||||||||
| 78 | delete d; never executed: delete d; | 0 | ||||||||||||
| 79 | d = other.d; | - | ||||||||||||
| 80 | return executed 225120 times by 85 tests: *this;return *this;Executed by:
executed 225120 times by 85 tests: return *this;Executed by:
| 225120 | ||||||||||||
| 81 | } | - | ||||||||||||
| 82 | - | |||||||||||||
| 83 | inline int IdentifierHash::count() const | - | ||||||||||||
| 84 | { | - | ||||||||||||
| 85 | return executed 4781422 times by 85 tests: d ? d->size : 0;return d ? d->size : 0;Executed by:
executed 4781422 times by 85 tests: return d ? d->size : 0;Executed by:
| 4781422 | ||||||||||||
| 86 | } | - | ||||||||||||
| 87 | - | |||||||||||||
| 88 | inline | - | ||||||||||||
| 89 | void IdentifierHash::add(const QString &str, int value) | - | ||||||||||||
| 90 | { | - | ||||||||||||
| 91 | IdentifierHashEntry *e = addEntry(toIdentifier(str)); | - | ||||||||||||
| 92 | e->value = value; | - | ||||||||||||
| 93 | } executed 5146 times by 34 tests: end of blockExecuted by:
| 5146 | ||||||||||||
| 94 | - | |||||||||||||
| 95 | inline | - | ||||||||||||
| 96 | void IdentifierHash::add(Heap::String *str, int value) | - | ||||||||||||
| 97 | { | - | ||||||||||||
| 98 | IdentifierHashEntry *e = addEntry(toIdentifier(str)); | - | ||||||||||||
| 99 | e->value = value; | - | ||||||||||||
| 100 | } executed 7550 times by 68 tests: end of blockExecuted by:
| 7550 | ||||||||||||
| 101 | - | |||||||||||||
| 102 | inline int IdentifierHash::value(const QString &str) const | - | ||||||||||||
| 103 | { | - | ||||||||||||
| 104 | const IdentifierHashEntry *e = lookup(str); | - | ||||||||||||
| 105 | return executed 19026 times by 34 tests: e ? e->value : -1;return e ? e->value : -1;Executed by:
executed 19026 times by 34 tests: return e ? e->value : -1;Executed by:
| 19026 | ||||||||||||
| 106 | } | - | ||||||||||||
| 107 | - | |||||||||||||
| 108 | inline int IdentifierHash::value(String *str) const | - | ||||||||||||
| 109 | { | - | ||||||||||||
| 110 | const IdentifierHashEntry *e = lookup(str); | - | ||||||||||||
| 111 | return executed 2618572 times by 71 tests: e ? e->value : -1;return e ? e->value : -1;Executed by:
executed 2618572 times by 71 tests: return e ? e->value : -1;Executed by:
| 2618572 | ||||||||||||
| 112 | } | - | ||||||||||||
| 113 | - | |||||||||||||
| 114 | } | - | ||||||||||||
| 115 | - | |||||||||||||
| 116 | - | |||||||||||||
| Switch to Source code | Preprocessed file |