Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qv4identifierhashdata_p.h
Go to the documentation of this file.
1
// Copyright (C) 2020 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
// Qt-Security score:significant
4
#
ifndef
QV4IDENTIFIERHASHDATA_H
5
#
define
QV4IDENTIFIERHASHDATA_H
6
7
//
8
// W A R N I N G
9
// -------------
10
//
11
// This file is not part of the Qt API. It exists purely as an
12
// implementation detail. This header file may change from version to
13
// version without notice, or even be removed.
14
//
15
// We mean it.
16
//
17
18
#
include
<
private
/
qv4global_p
.
h
>
19
#
include
<
private
/
qv4propertykey_p
.
h
>
20
#
include
<
private
/
qv4identifiertable_p
.
h
>
21
#
include
<
QtCore
/
qatomic
.
h
>
22
23
QT_BEGIN_NAMESPACE
24
25
namespace
QV4
{
26
27
struct
IdentifierHashEntry
{
28
PropertyKey
identifier
;
29
int
value
;
30
};
31
32
struct
IdentifierHashData
33
{
34
IdentifierHashData
(IdentifierTable *table,
int
numBits)
35
:
size
(0)
36
,
numBits
(numBits)
37
,
identifierTable
(
table
)
38
{
39
refCount.storeRelaxed(1);
40
alloc
= qPrimeForNumBits(numBits);
41
entries
= (
IdentifierHashEntry
*)malloc(
alloc
*
sizeof
(
IdentifierHashEntry
));
42
memset(
entries
, 0,
alloc
*
sizeof
(
IdentifierHashEntry
));
43
identifierTable->addIdentifierHash(
this
);
44
}
45
46
explicit
IdentifierHashData
(
IdentifierHashData
*other)
47
:
size
(other
->
size
)
48
,
numBits
(other
->
numBits
)
49
,
identifierTable
(
other
->
identifierTable
)
50
{
51
refCount.storeRelaxed(1);
52
alloc
= other
->
alloc
;
53
entries
= (
IdentifierHashEntry
*)malloc(
alloc
*
sizeof
(
IdentifierHashEntry
));
54
memcpy(
entries
, other
->
entries
,
alloc
*
sizeof
(
IdentifierHashEntry
));
55
identifierTable->addIdentifierHash(
this
);
56
}
57
58
~
IdentifierHashData
() {
59
free(
entries
);
60
if
(identifierTable)
61
identifierTable->removeIdentifierHash(
this
);
62
}
63
64
void
markObjects
(MarkStack *markStack)
const
65
{
66
IdentifierHashEntry
*e =
entries
;
67
IdentifierHashEntry
*end = e +
alloc
;
68
while
(e < end) {
69
if
(Heap::Base *o = e->identifier.asStringOrSymbol())
70
o->mark(markStack);
71
++e;
72
}
73
}
74
75
QBasicAtomicInt
refCount
;
76
int
alloc
;
77
int
size
;
78
int
numBits
;
79
IdentifierTable
*
identifierTable
;
80
IdentifierHashEntry
*
entries
;
81
};
82
83
}
// namespace QV4
84
85
QT_END_NAMESPACE
86
87
#
endif
// QV4IDENTIFIERHASHDATA_P_H
QV4
Definition
qjsvalue.h:23
QV4::IdentifierHashData
Definition
qv4identifierhashdata_p.h:33
QV4::IdentifierHashData::refCount
QBasicAtomicInt refCount
Definition
qv4identifierhashdata_p.h:75
QV4::IdentifierHashData::markObjects
void markObjects(MarkStack *markStack) const
Definition
qv4identifierhashdata_p.h:64
QV4::IdentifierHashData::IdentifierHashData
IdentifierHashData(IdentifierHashData *other)
Definition
qv4identifierhashdata_p.h:46
QV4::IdentifierHashData::IdentifierHashData
IdentifierHashData(IdentifierTable *table, int numBits)
Definition
qv4identifierhashdata_p.h:34
QV4::IdentifierHashData::size
int size
Definition
qv4identifierhashdata_p.h:77
QV4::IdentifierHashData::entries
IdentifierHashEntry * entries
Definition
qv4identifierhashdata_p.h:80
QV4::IdentifierHashData::identifierTable
IdentifierTable * identifierTable
Definition
qv4identifierhashdata_p.h:79
QV4::IdentifierHashData::~IdentifierHashData
~IdentifierHashData()
Definition
qv4identifierhashdata_p.h:58
QV4::IdentifierHashData::alloc
int alloc
Definition
qv4identifierhashdata_p.h:76
QV4::IdentifierHashData::numBits
int numBits
Definition
qv4identifierhashdata_p.h:78
QV4::IdentifierHashEntry
Definition
qv4identifierhashdata_p.h:27
QV4::IdentifierHashEntry::value
int value
Definition
qv4identifierhashdata_p.h:29
QV4::IdentifierHashEntry::identifier
PropertyKey identifier
Definition
qv4identifierhashdata_p.h:28
qtdeclarative
src
qml
jsruntime
qv4identifierhashdata_p.h
Generated on
for Qt by
1.14.0