/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: set ts=8 sts=2 et sw=2 tw=80: * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
class JSDependentString; class JSExternalString; class JSFatInlineString; class JSLinearString; class JSRope; class JSThinInlineString;
namespace js {
class CompactPropMap; class FatInlineAtom; class ThinInlineAtom; class NormalAtom; class NormalPropMap; class DictionaryPropMap; class DictionaryShape; class SharedShape; class ProxyShape; class WasmGCShape;
namespace gc {
// The GC allocation kinds. // // These are defined by macros which enumerate the different allocation kinds // and supply the following information: // // - the corresponding AllocKind // - their JS::TraceKind // - their C++ base type // - a C++ type of the correct size // - whether they can be finalized on the background thread // - whether they can be allocated in the nursery (this is true for foreground // finalized objects but these will can only actually be allocated in the // nursery if JSCLASS_SKIP_NURSERY_FINALIZE is set) // - whether they can be compacted
FIRST = 0,
OBJECT_FIRST = FUNCTION, // Hardcoded to first object kind.
BUFFER_FIRST = BUFFER16 // clang-format on
}; #undef DEFINE_ALLOC_KIND
static_assert(int(AllocKind::FIRST) == 0, "Various places depend on AllocKind starting at 0");
static_assert(int(AllocKind::OBJECT_FIRST) == 0, "OBJECT_FIRST must be defined as the first object kind");
/* * A flag specifying either the tenured heap or a default heap (which may be * either the nursery or the tenured heap). * * This allows an allocation site to request a heap based upon the estimated * lifetime or lifetime requirements of objects allocated from that site. * * Order is important as these are numerically compared.
*/ enumclass Heap : uint8_t { Default = 0, Tenured = 1 };
// Returns a sequence for use in a range-based for loop, // to iterate over all alloc kinds.
constexpr auto AllAllocKinds() { return mozilla::MakeEnumeratedRange(AllocKind::FIRST, AllocKind::LIMIT);
}
// Returns a sequence for use in a range-based for loop, // to iterate over all object alloc kinds.
constexpr auto ObjectAllocKinds() { return mozilla::MakeEnumeratedRange(AllocKind::OBJECT_FIRST,
AllocKind::OBJECT_LIMIT);
}
// Returns a sequence for use in a range-based for loop, // to iterate over alloc kinds from |first| to |limit|, exclusive.
constexpr auto SomeAllocKinds(AllocKind first = AllocKind::FIRST,
AllocKind limit = AllocKind::LIMIT) {
MOZ_ASSERT(IsAllocKind(first), "|first| is not a valid AllocKind!");
MOZ_ASSERT(IsAllocKind(limit), "|limit| is not a valid AllocKind!"); return mozilla::MakeEnumeratedRange(first, limit);
}
// AllAllocKindArray<ValueType> gives an enumerated array of ValueTypes, // with each index corresponding to a particular alloc kind. template <typename ValueType> using AllAllocKindArray =
mozilla::EnumeratedArray<AllocKind, ValueType, size_t(AllocKind::LIMIT)>;
// ObjectAllocKindArray<ValueType> gives an enumerated array of ValueTypes, // with each index corresponding to a particular object alloc kind. template <typename ValueType> using ObjectAllocKindArray =
mozilla::EnumeratedArray<AllocKind, ValueType,
size_t(AllocKind::OBJECT_LIMIT)>;
/* * Map from C++ type to alloc kind for non-object types. JSObject does not have * a 1:1 mapping, so must use Arena::thingSize. * * The AllocKind is available as MapTypeToAllocKind<SomeType>::kind. * * There are specializations for strings and shapes since more than one derived * type shares the same alloc kind.
*/ template <typename T> struct MapTypeToAllocKind {}; #define EXPAND_MAPTYPETOALLOCKIND(allocKind, traceKind, type, sizedType, \
bgFinal, nursery, compact) \ template <> \ struct MapTypeToAllocKind<type> { \ staticconst AllocKind kind = AllocKind::allocKind; \
};
FOR_EACH_NONOBJECT_NONBUFFER_ALLOCKIND(EXPAND_MAPTYPETOALLOCKIND) #undef EXPAND_MAPTYPETOALLOCKIND
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.