Bug 1890750 - Part 1: Include NATIVE_JIT_ENTRY in FunctionFlags::HasJitEntryFlags...
[gecko.git] / js / src / jit / ICStubSpace.h
blob09dde6da4eb26e24e56626e469856620e11fc877
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"
12 namespace js {
13 namespace jit {
15 // ICStubSpace is an abstraction for allocation policy and storage for CacheIR
16 // stub data. Each JitZone has a single ICStubSpace.
17 class ICStubSpace {
18 static constexpr size_t DefaultChunkSize = 4096;
19 LifoAlloc allocator_{DefaultChunkSize};
21 public:
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);
37 } // namespace jit
38 } // namespace js
40 #endif /* jit_ICStubSpace_h */