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 jit_ICStubSpace_h
8 #define jit_ICStubSpace_h
10 #include "ds/LifoAlloc.h"
15 // ICStubSpace is an abstraction for allocation policy and storage for CacheIR
16 // stub data. Each JitZone has a single ICStubSpace.
18 static constexpr size_t DefaultChunkSize
= 4096;
19 LifoAlloc allocator_
{DefaultChunkSize
};
22 inline void* alloc(size_t size
) { return allocator_
.alloc(size
); }
24 JS_DECLARE_NEW_METHODS(allocate
, alloc
, inline)
26 void freeAllAfterMinorGC(JS::Zone
* zone
);
28 void transferFrom(ICStubSpace
& other
) {
29 allocator_
.transferFrom(&other
.allocator_
);
32 size_t sizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf
) const {
33 return allocator_
.sizeOfExcludingThis(mallocSizeOf
);
40 #endif /* jit_ICStubSpace_h */