Bug 1874684 - Part 10: Replace BigInt with Int128 in RoundNumberToIncrement. r=mgaudet
[gecko.git] / js / src / gc / Heap-inl.h
blob30937a7236540c2822636b632659c34a4e812975
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/. */
7 #ifndef gc_Heap_inl_h
8 #define gc_Heap_inl_h
10 #include "gc/Heap.h"
12 #include "gc/StoreBuffer.h"
13 #include "gc/Zone.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) {
19 #ifdef DEBUG
20 MOZ_MAKE_MEM_DEFINED(&zone, sizeof(zone));
21 MOZ_ASSERT((uintptr_t(zone) & 0xff) == JS_FREED_ARENA_PATTERN);
22 #endif
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);
33 zone = zoneArg;
34 allocKind = kind;
35 isNewlyCreated_ = 1;
36 onDelayedMarkingList_ = 0;
37 hasDelayedBlackMarking_ = 0;
38 hasDelayedGrayMarking_ = 0;
39 nextDelayedMarkingArena_ = 0;
40 if (zone->isAtomsZone()) {
41 zone->runtimeFromAnyThread()->gc.atomMarking.registerArena(this, lock);
42 } else {
43 bufferedCells() = &ArenaCellSet::Empty;
46 setAsFullyUnused();
48 #ifdef DEBUG
49 checkNoMarkedCells();
50 #endif
53 inline void js::gc::Arena::release(const AutoLockGC& lock) {
54 if (zone->isAtomsZone()) {
55 zone->runtimeFromAnyThread()->gc.atomMarking.unregisterArena(this, lock);
57 setAsNotAllocated();
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_;
70 #endif