| 1 | // Copyright (C) 2023 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 | #include <private/qv4value_p.h> |
| 4 | #include <private/qv4mm_p.h> |
| 5 | |
| 6 | QT_BEGIN_NAMESPACE |
| 7 | |
| 8 | namespace { |
| 9 | void markHeapBase(QV4::MarkStack* markStack, QV4::Heap::Base *base){ |
| 10 | if (!base) |
| 11 | return; |
| 12 | base->mark(markStack); |
| 13 | } |
| 14 | } |
| 15 | namespace QV4 { |
| 16 | |
| 17 | void WriteBarrier::write_slowpath(EngineBase *engine, Heap::Base *base, ReturnedValue *slot, ReturnedValue value) |
| 18 | { |
| 19 | Q_UNUSED(base); |
| 20 | Q_UNUSED(slot); |
| 21 | MarkStack * markStack = engine->memoryManager->markStack(); |
| 22 | if constexpr (isInsertionBarrier) |
| 23 | markHeapBase(markStack, base: Value::fromReturnedValue(val: value).heapObject()); |
| 24 | } |
| 25 | |
| 26 | void WriteBarrier::write_slowpath(EngineBase *engine, Heap::Base *base, Heap::Base **slot, Heap::Base *value) |
| 27 | { |
| 28 | Q_UNUSED(base); |
| 29 | Q_UNUSED(slot); |
| 30 | MarkStack * markStack = engine->memoryManager->markStack(); |
| 31 | if constexpr (isInsertionBarrier) |
| 32 | markHeapBase(markStack, base: value); |
| 33 | } |
| 34 | |
| 35 | } |
| 36 | QT_END_NAMESPACE |
| 37 |
