1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 * vim: set ts=8 sts=2 et sw=2 tw=80:
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
12 #include "gc/StoreBuffer.h"
14 #include "util/Poison.h"
15 #include "vm/Runtime.h"
17 inline void js::gc::Arena::init(JS::Zone
* zoneArg
, AllocKind kind
,
18 const AutoLockGC
& lock
) {
20 MOZ_MAKE_MEM_DEFINED(&zone
, sizeof(zone
));
21 MOZ_ASSERT((uintptr_t(zone
) & 0xff) == JS_FREED_ARENA_PATTERN
);
24 MOZ_ASSERT(firstFreeSpan
.isEmpty());
25 MOZ_ASSERT(!allocated());
26 MOZ_ASSERT(!onDelayedMarkingList_
);
27 MOZ_ASSERT(!hasDelayedBlackMarking_
);
28 MOZ_ASSERT(!hasDelayedGrayMarking_
);
29 MOZ_ASSERT(!nextDelayedMarkingArena_
);
31 MOZ_MAKE_MEM_UNDEFINED(this, ArenaSize
);
36 onDelayedMarkingList_
= 0;
37 hasDelayedBlackMarking_
= 0;
38 hasDelayedGrayMarking_
= 0;
39 nextDelayedMarkingArena_
= 0;
40 if (zone
->isAtomsZone()) {
41 zone
->runtimeFromAnyThread()->gc
.atomMarking
.registerArena(this, lock
);
43 bufferedCells() = &ArenaCellSet::Empty
;
53 inline void js::gc::Arena::release(const AutoLockGC
& lock
) {
54 if (zone
->isAtomsZone()) {
55 zone
->runtimeFromAnyThread()->gc
.atomMarking
.unregisterArena(this, lock
);
60 inline js::gc::ArenaCellSet
*& js::gc::Arena::bufferedCells() {
61 MOZ_ASSERT(zone
&& !zone
->isAtomsZone());
62 return bufferedCells_
;
65 inline size_t& js::gc::Arena::atomBitmapStart() {
66 MOZ_ASSERT(zone
&& zone
->isAtomsZone());
67 return atomBitmapStart_
;