1// Copyright (C) 2016 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#ifndef QV4WRITEBARRIER_P_H
4#define QV4WRITEBARRIER_P_H
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the Qt API. It exists purely as an
11// implementation detail. This header file may change from version to
12// version without notice, or even be removed.
13//
14// We mean it.
15//
16
17#include <private/qv4global_p.h>
18
19QT_BEGIN_NAMESPACE
20
21#define WRITEBARRIER_none 1
22
23#define WRITEBARRIER(x) (1/WRITEBARRIER_##x == 1)
24
25namespace QV4 {
26struct EngineBase;
27
28namespace WriteBarrier {
29
30enum Type {
31 NoBarrier,
32 Barrier
33};
34
35enum NewValueType {
36 Primitive,
37 Object,
38 Unknown
39};
40
41// ### this needs to be filled with a real memory fence once marking is concurrent
42Q_ALWAYS_INLINE void fence() {}
43
44#if WRITEBARRIER(none)
45
46template <NewValueType type>
47static constexpr inline bool isRequired() {
48 return false;
49}
50
51inline void write(EngineBase *engine, Heap::Base *base, ReturnedValue *slot, ReturnedValue value)
52{
53 Q_UNUSED(engine);
54 Q_UNUSED(base);
55 *slot = value;
56}
57
58inline void write(EngineBase *engine, Heap::Base *base, Heap::Base **slot, Heap::Base *value)
59{
60 Q_UNUSED(engine);
61 Q_UNUSED(base);
62 *slot = value;
63}
64
65#endif
66
67}
68
69}
70
71QT_END_NAMESPACE
72
73#endif
74

source code of qtdeclarative/src/qml/memory/qv4writebarrier_p.h