[vm] Make Dart Zones more similar to V8 Zones.
This eases the porting of Irregexp. TEST=ci Bug: https://github.com/dart-lang/sdk/issues/56573 Change-Id: If31a0585ced3eabaf2dac6af04f83d387a8eab5d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/478080 Reviewed-by: Alexander Aprelev <aam@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
committed by
Commit Queue
parent
69a1a497f1
commit
737888b223
@@ -14,16 +14,16 @@ namespace dart {
|
||||
static void* Allocate(uword size, Zone* zone) {
|
||||
ASSERT(zone != nullptr);
|
||||
if (size > static_cast<uword>(kIntptrMax)) {
|
||||
FATAL("ZoneAllocated object has unexpectedly large size %" Pu "", size);
|
||||
FATAL("ZoneObject object has unexpectedly large size %" Pu "", size);
|
||||
}
|
||||
return reinterpret_cast<void*>(zone->AllocUnsafe(size));
|
||||
}
|
||||
|
||||
void* ZoneAllocated::operator new(uword size) {
|
||||
void* ZoneObject::operator new(uword size) {
|
||||
return Allocate(size, Thread::Current()->zone());
|
||||
}
|
||||
|
||||
void* ZoneAllocated::operator new(uword size, Zone* zone) {
|
||||
void* ZoneObject::operator new(uword size, Zone* zone) {
|
||||
return Allocate(size, zone);
|
||||
}
|
||||
|
||||
|
||||
@@ -50,10 +50,10 @@ class StackResource {
|
||||
// Zone allocated objects cannot be individually deallocated, but have
|
||||
// to rely on the destructor of Zone which is called when the Zone
|
||||
// goes out of scope to reclaim memory.
|
||||
class ZoneAllocated {
|
||||
class ZoneObject {
|
||||
public:
|
||||
ZoneAllocated() {}
|
||||
virtual ~ZoneAllocated() = default;
|
||||
ZoneObject() {}
|
||||
virtual ~ZoneObject() = default;
|
||||
|
||||
// Implicitly allocate the object in the current zone.
|
||||
void* operator new(size_t size);
|
||||
@@ -61,6 +61,9 @@ class ZoneAllocated {
|
||||
// Allocate the object in the given zone, which must be the current zone.
|
||||
void* operator new(size_t size, Zone* zone);
|
||||
|
||||
// Allow non-allocating placement new.
|
||||
void* operator new(size_t size, void* ptr) { return ptr; }
|
||||
|
||||
// Ideally, the delete operator should be protected instead of
|
||||
// public, but unfortunately the compiler sometimes synthesizes
|
||||
// (unused) destructors for classes derived from ZoneObject, which
|
||||
@@ -72,13 +75,13 @@ class ZoneAllocated {
|
||||
void operator delete(void* pointer) { UNREACHABLE(); }
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ZoneAllocated);
|
||||
DISALLOW_COPY_AND_ASSIGN(ZoneObject);
|
||||
};
|
||||
|
||||
} // namespace dart
|
||||
|
||||
// Prevent use of `new (zone) DoesNotExtendZoneAllocated()`, which places the
|
||||
// DoesNotExtendZoneAllocated on top of the Zone.
|
||||
// Prevent use of `new (zone) DoesNotExtendZoneObject()`, which places the
|
||||
// DoesNotExtendZoneObject on top of the Zone.
|
||||
void* operator new(size_t size, dart::Zone* zone) = delete;
|
||||
|
||||
#endif // RUNTIME_VM_ALLOCATION_H_
|
||||
|
||||
@@ -74,7 +74,7 @@ static constexpr intptr_t kDeltaEncodedTypedDataCid = kNativePointer;
|
||||
// StorageTrait for HashTable which allows to create hash tables backed by
|
||||
// zone memory. Used to compute cluster order for canonical clusters.
|
||||
struct GrowableArrayStorageTraits {
|
||||
class Array : public ZoneAllocated {
|
||||
class Array : public ZoneObject {
|
||||
public:
|
||||
Array(Zone* zone, intptr_t length)
|
||||
: length_(length), array_(zone->Alloc<ObjectPtr>(length)) {}
|
||||
@@ -92,7 +92,7 @@ struct GrowableArrayStorageTraits {
|
||||
};
|
||||
|
||||
using ArrayPtr = Array*;
|
||||
class ArrayHandle : public ZoneAllocated {
|
||||
class ArrayHandle : public ZoneObject {
|
||||
public:
|
||||
explicit ArrayHandle(ArrayPtr ptr) : ptr_(ptr) {}
|
||||
ArrayHandle() {}
|
||||
@@ -157,7 +157,7 @@ static void RelocateCodeObjects(
|
||||
|
||||
#endif // defined(DART_PRECOMPILER) && !defined(TARGET_ARCH_IA32)
|
||||
|
||||
class SerializationCluster : public ZoneAllocated {
|
||||
class SerializationCluster : public ZoneObject {
|
||||
public:
|
||||
static constexpr intptr_t kSizeVaries = -1;
|
||||
SerializationCluster(const char* name,
|
||||
@@ -216,7 +216,7 @@ class SerializationCluster : public ZoneAllocated {
|
||||
intptr_t target_memory_size_ = 0;
|
||||
};
|
||||
|
||||
class DeserializationCluster : public ZoneAllocated {
|
||||
class DeserializationCluster : public ZoneObject {
|
||||
public:
|
||||
explicit DeserializationCluster(const char* name,
|
||||
bool is_canonical = false,
|
||||
@@ -8311,7 +8311,7 @@ void Serializer::PrepareInstructions(
|
||||
// - followed by stack maps bytes;
|
||||
// - followed by canonical stack map entries.
|
||||
//
|
||||
struct StackMapInfo : public ZoneAllocated {
|
||||
struct StackMapInfo : public ZoneObject {
|
||||
CompressedStackMapsPtr map;
|
||||
intptr_t use_count;
|
||||
uint32_t offset;
|
||||
|
||||
@@ -39,7 +39,7 @@ class V8SnapshotProfileWriter;
|
||||
class ImageWriter;
|
||||
class Heap;
|
||||
|
||||
class LoadingUnitSerializationData : public ZoneAllocated {
|
||||
class LoadingUnitSerializationData : public ZoneObject {
|
||||
public:
|
||||
LoadingUnitSerializationData(intptr_t id,
|
||||
LoadingUnitSerializationData* parent)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace dart {
|
||||
|
||||
// Bit vector implementation.
|
||||
class BitVector : public ZoneAllocated {
|
||||
class BitVector : public ZoneObject {
|
||||
public:
|
||||
// Iterator for the elements of this BitVector.
|
||||
class Iterator : public ValueObject {
|
||||
|
||||
+2
-2
@@ -15,14 +15,14 @@ namespace dart {
|
||||
// BitmapBuilder is used to build a bitmap. The implementation is optimized
|
||||
// for a dense set of small bit maps without a fixed upper bound (e.g: a
|
||||
// pointer map description of a stack).
|
||||
class BitmapBuilder : public ZoneAllocated {
|
||||
class BitmapBuilder : public ZoneObject {
|
||||
public:
|
||||
BitmapBuilder() : length_(0), data_size_in_bytes_(kInlineCapacityInBytes) {
|
||||
memset(data_.inline_, 0, data_size_in_bytes_);
|
||||
}
|
||||
|
||||
BitmapBuilder(const BitmapBuilder& other)
|
||||
: ZoneAllocated(),
|
||||
: ZoneObject(),
|
||||
length_(other.length_),
|
||||
data_size_in_bytes_(other.data_size_in_bytes_) {
|
||||
if (data_size_in_bytes_ == kInlineCapacityInBytes) {
|
||||
|
||||
@@ -156,7 +156,7 @@ ExceptionHandlersPtr ExceptionHandlerList::FinalizeExceptionHandlers(
|
||||
}
|
||||
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
class CatchEntryMovesMapBuilder::TrieNode : public ZoneAllocated {
|
||||
class CatchEntryMovesMapBuilder::TrieNode : public ZoneObject {
|
||||
public:
|
||||
TrieNode() : move_(), entry_state_offset_(-1) {}
|
||||
TrieNode(CatchEntryMove move, intptr_t index)
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace dart {
|
||||
|
||||
static constexpr intptr_t kInvalidTryIndex = -1;
|
||||
|
||||
class DescriptorList : public ZoneAllocated {
|
||||
class DescriptorList : public ZoneObject {
|
||||
public:
|
||||
explicit DescriptorList(
|
||||
Zone* zone,
|
||||
@@ -47,7 +47,7 @@ class DescriptorList : public ZoneAllocated {
|
||||
DISALLOW_COPY_AND_ASSIGN(DescriptorList);
|
||||
};
|
||||
|
||||
class CompressedStackMapsBuilder : public ZoneAllocated {
|
||||
class CompressedStackMapsBuilder : public ZoneObject {
|
||||
public:
|
||||
explicit CompressedStackMapsBuilder(Zone* zone)
|
||||
: encoded_bytes_(zone, kInitialStreamSize) {}
|
||||
@@ -66,7 +66,7 @@ class CompressedStackMapsBuilder : public ZoneAllocated {
|
||||
DISALLOW_COPY_AND_ASSIGN(CompressedStackMapsBuilder);
|
||||
};
|
||||
|
||||
class ExceptionHandlerList : public ZoneAllocated {
|
||||
class ExceptionHandlerList : public ZoneObject {
|
||||
public:
|
||||
struct HandlerDesc {
|
||||
intptr_t outer_try_index; // Try block in which this try block is nested.
|
||||
@@ -147,7 +147,7 @@ class ExceptionHandlerList : public ZoneAllocated {
|
||||
|
||||
#if !defined(DART_PRECOMPILED_RUNTIME)
|
||||
// Used to construct CatchEntryMoves for the AOT mode of compilation.
|
||||
class CatchEntryMovesMapBuilder : public ZoneAllocated {
|
||||
class CatchEntryMovesMapBuilder : public ZoneObject {
|
||||
public:
|
||||
CatchEntryMovesMapBuilder();
|
||||
|
||||
@@ -229,7 +229,7 @@ struct CodeSourceMapOps : AllStatic {
|
||||
// us a peephole optimization that merges adjacent advance PC bytecodes. On AOT,
|
||||
// this allows to skip encoding our position until we reach a PC where we might
|
||||
// throw.
|
||||
class CodeSourceMapBuilder : public ZoneAllocated {
|
||||
class CodeSourceMapBuilder : public ZoneObject {
|
||||
public:
|
||||
CodeSourceMapBuilder(
|
||||
Zone* zone,
|
||||
|
||||
@@ -527,7 +527,7 @@ class Obfuscator : public ValueObject {
|
||||
return name.ptr();
|
||||
}
|
||||
|
||||
class ObfuscationState : public ZoneAllocated {
|
||||
class ObfuscationState : public ZoneObject {
|
||||
public:
|
||||
ObfuscationState(Thread* thread,
|
||||
const Array& saved_state,
|
||||
|
||||
@@ -23,7 +23,7 @@ class Precompiler;
|
||||
// information about all compiled functions and dependencies between them.
|
||||
// See pkg/vm_snapshot_analysis/README.md for the definition of the
|
||||
// format.
|
||||
class PrecompilerTracer : public ZoneAllocated {
|
||||
class PrecompilerTracer : public ZoneObject {
|
||||
public:
|
||||
static PrecompilerTracer* StartTracingIfRequested(Precompiler* precompiler);
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ class Address;
|
||||
class FieldAddress;
|
||||
|
||||
#if defined(TARGET_ARCH_RISCV32) || defined(TARGET_ARCH_RISCV64)
|
||||
class Label : public ZoneAllocated {
|
||||
class Label : public ZoneObject {
|
||||
public:
|
||||
Label() {}
|
||||
~Label() {
|
||||
@@ -273,7 +273,7 @@ class Label : public ZoneAllocated {
|
||||
DISALLOW_COPY_AND_ASSIGN(Label);
|
||||
};
|
||||
#else
|
||||
class Label : public ZoneAllocated {
|
||||
class Label : public ZoneObject {
|
||||
public:
|
||||
Label() : position_(0), unresolved_(0) {
|
||||
#ifdef DEBUG
|
||||
@@ -404,7 +404,7 @@ class ExternalLabel : public ValueObject {
|
||||
// Assembler fixups are positions in generated code that hold relocation
|
||||
// information that needs to be processed before finalizing the code
|
||||
// into executable memory.
|
||||
class AssemblerFixup : public ZoneAllocated {
|
||||
class AssemblerFixup : public ZoneObject {
|
||||
public:
|
||||
virtual void Process(const MemoryRegion& region, intptr_t position) = 0;
|
||||
|
||||
@@ -1225,7 +1225,7 @@ class AssemblerBase : public StackResource {
|
||||
return buffer_.pointer_offsets();
|
||||
}
|
||||
|
||||
class CodeComment : public ZoneAllocated {
|
||||
class CodeComment : public ZoneObject {
|
||||
public:
|
||||
CodeComment(intptr_t pc_offset, const String& comment)
|
||||
: pc_offset_(pc_offset), comment_(comment) {}
|
||||
|
||||
@@ -106,7 +106,7 @@ struct Edge {
|
||||
};
|
||||
|
||||
// A linked list node in a chain of blocks.
|
||||
struct Link : public ZoneAllocated {
|
||||
struct Link : public ZoneObject {
|
||||
Link(BlockEntryInstr* block, Link* next) : block(block), next(next) {}
|
||||
|
||||
BlockEntryInstr* block;
|
||||
@@ -115,7 +115,7 @@ struct Link : public ZoneAllocated {
|
||||
|
||||
// A chain of blocks with first and last pointers for fast concatenation and
|
||||
// a length to support adding a shorter chain's links to a longer chain.
|
||||
struct Chain : public ZoneAllocated {
|
||||
struct Chain : public ZoneObject {
|
||||
explicit Chain(BlockEntryInstr* block)
|
||||
: first(new Link(block, nullptr)), last(first), length(1) {}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ class GrowableArray;
|
||||
// Values of CompileType form a lattice with a None type as a bottom and a
|
||||
// nullable Dynamic type as a top element. Method Union provides a join
|
||||
// operation for the lattice.
|
||||
class CompileType : public ZoneAllocated {
|
||||
class CompileType : public ZoneObject {
|
||||
public:
|
||||
static constexpr bool kCanBeNull = true;
|
||||
static constexpr bool kCannotBeNull = false;
|
||||
@@ -66,7 +66,7 @@ class CompileType : public ZoneAllocated {
|
||||
}
|
||||
|
||||
CompileType(const CompileType& other)
|
||||
: ZoneAllocated(),
|
||||
: ZoneObject(),
|
||||
flags_(other.flags_),
|
||||
cid_(other.cid_),
|
||||
type_(other.type_) {}
|
||||
|
||||
@@ -141,7 +141,7 @@ struct InliningInfo {
|
||||
};
|
||||
|
||||
// Class to encapsulate the construction and manipulation of the flow graph.
|
||||
class FlowGraph : public ZoneAllocated {
|
||||
class FlowGraph : public ZoneObject {
|
||||
public:
|
||||
enum class CompilationMode {
|
||||
kUnoptimized,
|
||||
|
||||
@@ -66,7 +66,7 @@ class NoTemporaryAllocator : public TemporaryRegisterAllocator {
|
||||
|
||||
// Used for describing a deoptimization point after call (lazy deoptimization).
|
||||
// For deoptimization before instruction use class CompilerDeoptInfoWithStub.
|
||||
class CompilerDeoptInfo : public ZoneAllocated {
|
||||
class CompilerDeoptInfo : public ZoneObject {
|
||||
public:
|
||||
CompilerDeoptInfo(intptr_t deopt_id,
|
||||
ICData::DeoptReasonId reason,
|
||||
@@ -142,7 +142,7 @@ class CompilerDeoptInfoWithStub : public CompilerDeoptInfo {
|
||||
DISALLOW_COPY_AND_ASSIGN(CompilerDeoptInfoWithStub);
|
||||
};
|
||||
|
||||
class SlowPathCode : public ZoneAllocated {
|
||||
class SlowPathCode : public ZoneObject {
|
||||
public:
|
||||
explicit SlowPathCode(Instruction* instruction)
|
||||
: instruction_(instruction), entry_label_(), exit_label_() {}
|
||||
@@ -393,7 +393,7 @@ enum class TypeTestOutcome { kConclusive, kNotConclusive };
|
||||
|
||||
class FlowGraphCompiler : public ValueObject {
|
||||
private:
|
||||
class BlockInfo : public ZoneAllocated {
|
||||
class BlockInfo : public ZoneObject {
|
||||
public:
|
||||
BlockInfo()
|
||||
: block_label_(),
|
||||
@@ -1190,7 +1190,7 @@ class FlowGraphCompiler : public ValueObject {
|
||||
bool CanPcRelativeCall(const AbstractType& target) const;
|
||||
|
||||
// This struct contains either function or code, the other one being nullptr.
|
||||
class StaticCallsStruct : public ZoneAllocated {
|
||||
class StaticCallsStruct : public ZoneObject {
|
||||
public:
|
||||
Code::CallKind call_kind;
|
||||
Code::CallEntryPoint entry_point;
|
||||
|
||||
@@ -72,7 +72,7 @@ class BlockBuilder;
|
||||
struct TableSelector;
|
||||
} // namespace compiler
|
||||
|
||||
class Value : public ZoneAllocated {
|
||||
class Value : public ZoneObject {
|
||||
public:
|
||||
// A forward iterator that allows removing the current value from the
|
||||
// underlying use list during iteration.
|
||||
@@ -199,7 +199,7 @@ class Value : public ZoneAllocated {
|
||||
|
||||
// Represents a range of class-ids for use in class checks and polymorphic
|
||||
// dispatches. The range includes both ends, i.e. it is [cid_start, cid_end].
|
||||
struct CidRange : public ZoneAllocated {
|
||||
struct CidRange : public ZoneObject {
|
||||
CidRange(intptr_t cid_start_arg, intptr_t cid_end_arg)
|
||||
: cid_start(cid_start_arg), cid_end(cid_end_arg) {}
|
||||
CidRange() : cid_start(kIllegalCid), cid_end(kIllegalCid) {}
|
||||
@@ -739,7 +739,7 @@ struct TargetInfo : public CidRange {
|
||||
|
||||
// A set of class-ids, arranged in ranges. Used for the CheckClass
|
||||
// and PolymorphicInstanceCall instructions.
|
||||
class Cids : public ZoneAllocated {
|
||||
class Cids : public ZoneObject {
|
||||
public:
|
||||
explicit Cids(Zone* zone) : cid_ranges_(zone, 6) {}
|
||||
// Creates the off-heap Cids object that reflects the contents
|
||||
@@ -839,7 +839,7 @@ class CallTargets : public Cids {
|
||||
|
||||
// Represents type feedback for the binary operators, and a few recognized
|
||||
// static functions (see MethodRecognizer::NumArgsCheckedForStaticCall).
|
||||
class BinaryFeedback : public ZoneAllocated {
|
||||
class BinaryFeedback : public ZoneObject {
|
||||
public:
|
||||
explicit BinaryFeedback(Zone* zone) : feedback_(zone, 2) {}
|
||||
|
||||
@@ -965,7 +965,7 @@ class ValueListIterable {
|
||||
Value* value_;
|
||||
};
|
||||
|
||||
class Instruction : public ZoneAllocated {
|
||||
class Instruction : public ZoneObject {
|
||||
public:
|
||||
#define DECLARE_TAG(type, attrs) k##type,
|
||||
enum Tag { FOR_EACH_CONCRETE_INSTRUCTION(DECLARE_TAG) kNumInstructions };
|
||||
@@ -1526,11 +1526,11 @@ class TemplateInstruction
|
||||
virtual void RawSetInputAt(intptr_t i, Value* value) { inputs_[i] = value; }
|
||||
};
|
||||
|
||||
class MoveOperands : public ZoneAllocated {
|
||||
class MoveOperands : public ZoneObject {
|
||||
public:
|
||||
MoveOperands(Location dest, Location src) : dest_(dest), src_(src) {}
|
||||
MoveOperands(const MoveOperands& other)
|
||||
: ZoneAllocated(), dest_(other.dest_), src_(other.src_) {}
|
||||
: ZoneObject(), dest_(other.dest_), src_(other.src_) {}
|
||||
|
||||
MoveOperands& operator=(const MoveOperands& other) {
|
||||
dest_ = other.dest_;
|
||||
@@ -1643,7 +1643,7 @@ class ParallelMoveInstr : public TemplateInstruction<0, NoThrow> {
|
||||
DISALLOW_COPY_AND_ASSIGN(ParallelMoveInstr);
|
||||
};
|
||||
|
||||
class OsrEntryRelinkingInfo : public ZoneAllocated {
|
||||
class OsrEntryRelinkingInfo : public ZoneObject {
|
||||
public:
|
||||
OsrEntryRelinkingInfo(GraphEntryInstr* graph_entry,
|
||||
Instruction* instr,
|
||||
@@ -11523,7 +11523,7 @@ class SuspendInstr : public TemplateDefinition<2, Throws> {
|
||||
|
||||
#undef DECLARE_INSTRUCTION
|
||||
|
||||
class Environment : public ZoneAllocated {
|
||||
class Environment : public ZoneObject {
|
||||
public:
|
||||
// Iterate the non-null values in the innermost level of an environment.
|
||||
class ShallowIterator : public ValueObject {
|
||||
|
||||
@@ -58,7 +58,7 @@ static intptr_t ToInstructionEnd(intptr_t pos) {
|
||||
}
|
||||
|
||||
// Additional information on loops during register allocation.
|
||||
struct ExtraLoopInfo : public ZoneAllocated {
|
||||
struct ExtraLoopInfo : public ZoneObject {
|
||||
ExtraLoopInfo(intptr_t s, intptr_t e)
|
||||
: start(s), end(e), backedge_interference(nullptr) {}
|
||||
intptr_t start;
|
||||
|
||||
@@ -403,7 +403,7 @@ class FlowGraphAllocator : public ValueObject {
|
||||
// where instruction expects the value (if slot contains a fixed location) or
|
||||
// asks register allocator to allocate storage (register or spill slot) for
|
||||
// this use with certain properties (if slot contains an unallocated location).
|
||||
class UsePosition : public ZoneAllocated {
|
||||
class UsePosition : public ZoneObject {
|
||||
public:
|
||||
UsePosition(intptr_t pos, UsePosition* next, Location* location_slot)
|
||||
: pos_(pos), location_slot_(location_slot), hint_(nullptr), next_(next) {
|
||||
@@ -445,7 +445,7 @@ class UsePosition : public ZoneAllocated {
|
||||
// the end position. The interval can cover zero or more uses.
|
||||
// Note: currently all uses of the same SSA value are linked together into a
|
||||
// single list (and not split between UseIntervals).
|
||||
class UseInterval : public ZoneAllocated {
|
||||
class UseInterval : public ZoneObject {
|
||||
public:
|
||||
UseInterval(intptr_t start, intptr_t end, UseInterval* next)
|
||||
: start_(start), end_(end), next_(next) {}
|
||||
@@ -506,7 +506,7 @@ class AllocationFinger : public ValueObject {
|
||||
DISALLOW_COPY_AND_ASSIGN(AllocationFinger);
|
||||
};
|
||||
|
||||
class SafepointPosition : public ZoneAllocated {
|
||||
class SafepointPosition : public ZoneObject {
|
||||
public:
|
||||
SafepointPosition(intptr_t pos, LocationSummary* locs)
|
||||
: pos_(pos), locs_(locs), next_(nullptr) {}
|
||||
@@ -526,7 +526,7 @@ class SafepointPosition : public ZoneAllocated {
|
||||
};
|
||||
|
||||
// LiveRange represents a sequence of UseIntervals for a given SSA value.
|
||||
class LiveRange : public ZoneAllocated {
|
||||
class LiveRange : public ZoneObject {
|
||||
public:
|
||||
explicit LiveRange(intptr_t vreg, Representation rep)
|
||||
: vreg_(vreg),
|
||||
|
||||
@@ -615,7 +615,7 @@ Location LocationRemapForSlowPath(Location loc,
|
||||
// Return a memory operand for stack slot locations.
|
||||
compiler::Address LocationToStackSlotAddress(Location loc);
|
||||
|
||||
class PairLocation : public ZoneAllocated {
|
||||
class PairLocation : public ZoneObject {
|
||||
public:
|
||||
PairLocation() {
|
||||
for (intptr_t i = 0; i < kPairLength; i++) {
|
||||
@@ -855,7 +855,7 @@ class RegisterSet : public ValueObject {
|
||||
};
|
||||
|
||||
// Specification of locations for inputs and output.
|
||||
class LocationSummary : public ZoneAllocated {
|
||||
class LocationSummary : public ZoneObject {
|
||||
public:
|
||||
enum ContainsCall {
|
||||
// Used registers must be reserved as tmp.
|
||||
|
||||
@@ -65,7 +65,7 @@ static void FillSummary(LocationSummary* locs,
|
||||
}
|
||||
}
|
||||
|
||||
class MockInstruction : public ZoneAllocated {
|
||||
class MockInstruction : public ZoneObject {
|
||||
public:
|
||||
virtual ~MockInstruction() {}
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace dart {
|
||||
// Periodic:
|
||||
// alternate initial and next, for invariant initial and next
|
||||
//
|
||||
class InductionVar : public ZoneAllocated {
|
||||
class InductionVar : public ZoneObject {
|
||||
public:
|
||||
enum Kind {
|
||||
kInvariant,
|
||||
@@ -207,7 +207,7 @@ class InductionVar : public ZoneAllocated {
|
||||
};
|
||||
|
||||
// Information on a "natural loop" in the flow graph.
|
||||
class LoopInfo : public ZoneAllocated {
|
||||
class LoopInfo : public ZoneObject {
|
||||
public:
|
||||
LoopInfo(intptr_t id, BlockEntryInstr* header, BitVector* blocks);
|
||||
|
||||
@@ -271,7 +271,7 @@ class LoopInfo : public ZoneAllocated {
|
||||
typedef RawPointerKeyValueTrait<Definition, InductionVar*> InductionKV;
|
||||
|
||||
// Mapping from induction to mapping from instruction to induction pair.
|
||||
class MemoVal : public ZoneAllocated {
|
||||
class MemoVal : public ZoneObject {
|
||||
public:
|
||||
typedef RawPointerKeyValueTrait<Instruction,
|
||||
std::pair<InductionVar*, InductionVar*>>
|
||||
@@ -319,7 +319,7 @@ class LoopInfo : public ZoneAllocated {
|
||||
};
|
||||
|
||||
// Information on the loop hierarchy in the flow graph.
|
||||
class LoopHierarchy : public ZoneAllocated {
|
||||
class LoopHierarchy : public ZoneObject {
|
||||
public:
|
||||
LoopHierarchy(ZoneGrowableArray<BlockEntryInstr*>* headers,
|
||||
const GrowableArray<BlockEntryInstr*>& preorder,
|
||||
|
||||
@@ -218,7 +218,7 @@ class RangeBoundary : public ValueObject {
|
||||
int64_t offset_;
|
||||
};
|
||||
|
||||
class Range : public ZoneAllocated {
|
||||
class Range : public ZoneObject {
|
||||
public:
|
||||
Range() : min_(), max_() {}
|
||||
|
||||
@@ -227,7 +227,7 @@ class Range : public ZoneAllocated {
|
||||
}
|
||||
|
||||
Range(const Range& other)
|
||||
: ZoneAllocated(), min_(other.min_), max_(other.max_) {}
|
||||
: ZoneObject(), min_(other.min_), max_(other.max_) {}
|
||||
|
||||
Range& operator=(const Range& other) {
|
||||
min_ = other.min_;
|
||||
|
||||
@@ -693,7 +693,7 @@ class Place : public ValueObject {
|
||||
intptr_t id_;
|
||||
};
|
||||
|
||||
class ZonePlace : public ZoneAllocated {
|
||||
class ZonePlace : public ZoneObject {
|
||||
public:
|
||||
explicit ZonePlace(const Place& place) : place_(place) {}
|
||||
|
||||
@@ -711,7 +711,7 @@ Place* Place::Wrap(Zone* zone, const Place& place, intptr_t id) {
|
||||
|
||||
// Correspondence between places connected through outgoing phi moves on the
|
||||
// edge that targets join.
|
||||
class PhiPlaceMoves : public ZoneAllocated {
|
||||
class PhiPlaceMoves : public ZoneObject {
|
||||
public:
|
||||
// Record a move from the place with id |from| to the place with id |to| at
|
||||
// the given block.
|
||||
@@ -755,7 +755,7 @@ class PhiPlaceMoves : public ZoneAllocated {
|
||||
// A map from aliases to a set of places sharing the alias. Additionally
|
||||
// carries a set of places that can be aliased by side-effects, essentially
|
||||
// those that are affected by calls.
|
||||
class AliasedSet : public ZoneAllocated {
|
||||
class AliasedSet : public ZoneObject {
|
||||
public:
|
||||
AliasedSet(Zone* zone,
|
||||
FlowGraph* graph,
|
||||
@@ -4396,7 +4396,7 @@ class TryCatchAnalyzer : public ValueObject {
|
||||
return false;
|
||||
}
|
||||
|
||||
struct ParameterInfo : public ZoneAllocated {
|
||||
struct ParameterInfo : public ZoneObject {
|
||||
explicit ParameterInfo(ParameterInstr* instr) : instr(instr) {}
|
||||
|
||||
ParameterInstr* instr;
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace dart {
|
||||
|
||||
class CSEInstructionSet;
|
||||
|
||||
class AllocationSinking : public ZoneAllocated {
|
||||
class AllocationSinking : public ZoneObject {
|
||||
public:
|
||||
explicit AllocationSinking(FlowGraph* flow_graph)
|
||||
: flow_graph_(flow_graph), candidates_(5), materializations_(5) {}
|
||||
|
||||
@@ -24,7 +24,7 @@ enum NativeSlotsEnumeration {
|
||||
//
|
||||
// This cache is attached to the CompilerState to ensure that we preserve
|
||||
// identity of Slot objects during each individual compilation.
|
||||
class SlotCache : public ZoneAllocated {
|
||||
class SlotCache : public ZoneObject {
|
||||
public:
|
||||
// Returns an instance of SlotCache for the current compilation.
|
||||
static SlotCache& Instance(Thread* thread) {
|
||||
|
||||
@@ -432,7 +432,7 @@ class FieldGuardState {
|
||||
// compared by pointer. If two slots are different they must not alias.
|
||||
// If two slots can alias - they must be represented by identical
|
||||
// slot object.
|
||||
class Slot : public ZoneAllocated {
|
||||
class Slot : public ZoneObject {
|
||||
public:
|
||||
// clang-format off
|
||||
enum class Kind : uint8_t {
|
||||
|
||||
@@ -30,7 +30,7 @@ enum class CompilerTracing {
|
||||
kOff,
|
||||
};
|
||||
|
||||
struct FunctionPragmas : public ZoneAllocated {
|
||||
struct FunctionPragmas : public ZoneObject {
|
||||
explicit FunctionPragmas(const Function& function);
|
||||
|
||||
const Function& function;
|
||||
|
||||
@@ -39,7 +39,7 @@ const NativeFunctionType* NativeFunctionTypeFromFunctionType(
|
||||
//
|
||||
// This class is set up in a query-able way so that it's underlying logic can
|
||||
// be extended to support more native ABI features and calling conventions.
|
||||
class BaseMarshaller : public ZoneAllocated {
|
||||
class BaseMarshaller : public ZoneObject {
|
||||
public:
|
||||
intptr_t num_args() const {
|
||||
return native_calling_convention_.argument_locations().length();
|
||||
|
||||
@@ -26,7 +26,7 @@ using NativeLocations = ZoneGrowableArray<const NativeLocation*>;
|
||||
//
|
||||
// This class is meant to be embedded in a class that is aware of Dart calling
|
||||
// convention constraints.
|
||||
class NativeCallingConvention : public ZoneAllocated {
|
||||
class NativeCallingConvention : public ZoneObject {
|
||||
public:
|
||||
static const NativeCallingConvention& FromSignature(
|
||||
Zone* zone,
|
||||
|
||||
@@ -60,7 +60,7 @@ class BothNativeLocations;
|
||||
//
|
||||
// NativeLocation does not satisfy the invariant of Location: bitwise
|
||||
// inequality cannot be used to determine disjointness.
|
||||
class NativeLocation : public ZoneAllocated {
|
||||
class NativeLocation : public ZoneObject {
|
||||
public:
|
||||
#if !defined(FFI_UNIT_TESTS)
|
||||
static bool LocationCanBeExpressed(Location loc, Representation rep);
|
||||
|
||||
@@ -63,7 +63,7 @@ class NativeStructType;
|
||||
// * Compound types (https://en.cppreference.com/w/cpp/language/type):
|
||||
// * Struct
|
||||
// * Union
|
||||
class NativeType : public ZoneAllocated {
|
||||
class NativeType : public ZoneObject {
|
||||
public:
|
||||
#if !defined(FFI_UNIT_TESTS)
|
||||
static const NativeType* FromAbstractType(Zone* zone,
|
||||
@@ -455,7 +455,7 @@ class NativeUnionType : public NativeCompoundType {
|
||||
: NativeCompoundType(members, size, alignment_field, alignment_stack) {}
|
||||
};
|
||||
|
||||
class NativeFunctionType : public ZoneAllocated {
|
||||
class NativeFunctionType : public ZoneObject {
|
||||
public:
|
||||
NativeFunctionType(const NativeTypes& argument_types,
|
||||
const NativeType& return_type,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace dart {
|
||||
|
||||
void* ZoneAllocated::operator new(uintptr_t size, dart::Zone* zone) {
|
||||
void* ZoneObject::operator new(uintptr_t size, dart::Zone* zone) {
|
||||
return reinterpret_cast<void*>(zone->AllocUnsafe(size));
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace dart {
|
||||
|
||||
// A class to collect the exits from an inlined function during graph
|
||||
// construction so they can be plugged into the caller's flow graph.
|
||||
class InlineExitCollector : public ZoneAllocated {
|
||||
class InlineExitCollector : public ZoneObject {
|
||||
public:
|
||||
InlineExitCollector(FlowGraph* caller_graph, Definition* call)
|
||||
: caller_graph_(caller_graph), call_(call), exits_(4) {}
|
||||
|
||||
@@ -1188,7 +1188,7 @@ struct TableSelectorInfo {
|
||||
};
|
||||
|
||||
// Collection of table selector information for all selectors in the program.
|
||||
class TableSelectorMetadata : public ZoneAllocated {
|
||||
class TableSelectorMetadata : public ZoneObject {
|
||||
public:
|
||||
explicit TableSelectorMetadata(intptr_t num_selectors)
|
||||
: selectors(num_selectors) {
|
||||
@@ -1219,7 +1219,7 @@ class TableSelectorMetadataHelper : public MetadataHelper {
|
||||
};
|
||||
|
||||
// Information about a function regarding unboxed parameters and return value.
|
||||
class UnboxingInfoMetadata : public ZoneAllocated {
|
||||
class UnboxingInfoMetadata : public ZoneObject {
|
||||
public:
|
||||
// Should match UnboxingKind in pkg/vm/lib/metadata/unboxing_info.dart.
|
||||
enum UnboxingKind {
|
||||
|
||||
@@ -178,7 +178,7 @@ struct FunctionScope {
|
||||
LocalScope* scope;
|
||||
};
|
||||
|
||||
class ScopeBuildingResult : public ZoneAllocated {
|
||||
class ScopeBuildingResult : public ZoneObject {
|
||||
public:
|
||||
ScopeBuildingResult()
|
||||
: type_arguments_variable(nullptr),
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace compiler {
|
||||
class Assembler;
|
||||
|
||||
// Represents an unresolved PC-relative Call/TailCall.
|
||||
class UnresolvedPcRelativeCall : public ZoneAllocated {
|
||||
class UnresolvedPcRelativeCall : public ZoneObject {
|
||||
public:
|
||||
UnresolvedPcRelativeCall(intptr_t offset,
|
||||
const dart::Code& target,
|
||||
|
||||
@@ -290,7 +290,7 @@ class CodeBreakpoint {
|
||||
|
||||
// ActivationFrame represents one dart function activation frame
|
||||
// on the call stack.
|
||||
class ActivationFrame : public ZoneAllocated {
|
||||
class ActivationFrame : public ZoneObject {
|
||||
public:
|
||||
enum Kind {
|
||||
kRegular,
|
||||
@@ -488,7 +488,7 @@ class ActivationFrame : public ZoneAllocated {
|
||||
};
|
||||
|
||||
// Array of function activations on the call stack.
|
||||
class DebuggerStackTrace : public ZoneAllocated {
|
||||
class DebuggerStackTrace : public ZoneObject {
|
||||
public:
|
||||
explicit DebuggerStackTrace(int capacity)
|
||||
: thread_(Thread::Current()), zone_(thread_->zone()), trace_(capacity) {}
|
||||
|
||||
@@ -936,7 +936,7 @@ const char* DeoptInstr::KindToCString(Kind kind) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
class DeoptInfoBuilder::TrieNode : public ZoneAllocated {
|
||||
class DeoptInfoBuilder::TrieNode : public ZoneObject {
|
||||
public:
|
||||
// Construct the root node representing the implicit "shared" terminator
|
||||
// at the end of each deopt info.
|
||||
|
||||
@@ -267,7 +267,7 @@ class DeoptContext : public MallocAllocated {
|
||||
// Represents one deopt instruction, e.g, setup return address, store object,
|
||||
// store register, etc. The target is defined by instruction's position in
|
||||
// the deopt-info array.
|
||||
class DeoptInstr : public ZoneAllocated {
|
||||
class DeoptInstr : public ZoneObject {
|
||||
public:
|
||||
enum Kind {
|
||||
kRetAddress,
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ class DwarfPosition {
|
||||
|
||||
static constexpr auto kNoDwarfPositionInfo = DwarfPosition();
|
||||
|
||||
class InliningNode : public ZoneAllocated {
|
||||
class InliningNode : public ZoneObject {
|
||||
public:
|
||||
InliningNode(const Function& function,
|
||||
const DwarfPosition& position,
|
||||
|
||||
+1
-1
@@ -166,7 +166,7 @@ class DwarfWriteStream : public ValueObject {
|
||||
DISALLOW_COPY_AND_ASSIGN(DwarfWriteStream);
|
||||
};
|
||||
|
||||
class Dwarf : public ZoneAllocated {
|
||||
class Dwarf : public ZoneObject {
|
||||
public:
|
||||
// The compilation unit name is used as the DW_AT_name for the
|
||||
// Dart program's compilation unit. If nullptr, then the name of
|
||||
|
||||
+3
-3
@@ -85,7 +85,7 @@ class ElfStringTable;
|
||||
// Align note sections and segments to 4 byte boundaries.
|
||||
static constexpr intptr_t kNoteAlignment = 4;
|
||||
|
||||
class ElfSection : public ZoneAllocated {
|
||||
class ElfSection : public ZoneObject {
|
||||
public:
|
||||
ElfSection(elf::SectionHeaderType t,
|
||||
bool allocate,
|
||||
@@ -238,7 +238,7 @@ class ElfSection : public ZoneAllocated {
|
||||
#undef DEFINE_LINEAR_FIELD
|
||||
#undef DEFINE_LINEAR_FIELD_METHODS
|
||||
|
||||
class Segment : public ZoneAllocated {
|
||||
class Segment : public ZoneObject {
|
||||
public:
|
||||
Segment(Zone* zone,
|
||||
ElfSection* initial_section,
|
||||
@@ -721,7 +721,7 @@ class DynamicTable : public ElfSection {
|
||||
}
|
||||
|
||||
private:
|
||||
struct Entry : public ZoneAllocated {
|
||||
struct Entry : public ZoneObject {
|
||||
Entry(elf::DynamicEntryType tag, intptr_t value) : tag(tag), value(value) {}
|
||||
|
||||
void Write(ElfWriteStream* stream) const {
|
||||
|
||||
@@ -48,17 +48,17 @@ class GrowableArray : public BaseGrowableArray<T, ValueObject, Zone> {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class ZoneGrowableArray : public BaseGrowableArray<T, ZoneAllocated, Zone> {
|
||||
class ZoneGrowableArray : public BaseGrowableArray<T, ZoneObject, Zone> {
|
||||
public:
|
||||
ZoneGrowableArray(Zone* zone, intptr_t initial_capacity)
|
||||
: BaseGrowableArray<T, ZoneAllocated, Zone>(initial_capacity,
|
||||
ASSERT_NOTNULL(zone)) {}
|
||||
: BaseGrowableArray<T, ZoneObject, Zone>(initial_capacity,
|
||||
ASSERT_NOTNULL(zone)) {}
|
||||
explicit ZoneGrowableArray(intptr_t initial_capacity)
|
||||
: BaseGrowableArray<T, ZoneAllocated, Zone>(
|
||||
: BaseGrowableArray<T, ZoneObject, Zone>(
|
||||
initial_capacity,
|
||||
ASSERT_NOTNULL(ThreadState::Current()->zone())) {}
|
||||
ZoneGrowableArray()
|
||||
: BaseGrowableArray<T, ZoneAllocated, Zone>(
|
||||
: BaseGrowableArray<T, ZoneObject, Zone>(
|
||||
ASSERT_NOTNULL(ThreadState::Current()->zone())) {}
|
||||
|
||||
ZoneGrowableArray(ZoneGrowableArray&& other) = default;
|
||||
@@ -108,10 +108,10 @@ class GrowableHandlePtrArray
|
||||
|
||||
template <typename T>
|
||||
class ZoneGrowableHandlePtrArray
|
||||
: public BaseGrowableHandlePtrArray<T, ZoneAllocated> {
|
||||
: public BaseGrowableHandlePtrArray<T, ZoneObject> {
|
||||
public:
|
||||
ZoneGrowableHandlePtrArray(Zone* zone, intptr_t initial_capacity)
|
||||
: BaseGrowableHandlePtrArray<T, ZoneAllocated>(zone, initial_capacity) {}
|
||||
: BaseGrowableHandlePtrArray<T, ZoneObject>(zone, initial_capacity) {}
|
||||
};
|
||||
|
||||
} // namespace dart
|
||||
|
||||
@@ -349,15 +349,15 @@ class MallocDirectChainedHashMap
|
||||
|
||||
template <typename KeyValueTrait>
|
||||
class ZoneDirectChainedHashMap
|
||||
: public BaseDirectChainedHashMap<KeyValueTrait, ZoneAllocated, Zone> {
|
||||
: public BaseDirectChainedHashMap<KeyValueTrait, ZoneObject, Zone> {
|
||||
public:
|
||||
ZoneDirectChainedHashMap()
|
||||
: BaseDirectChainedHashMap<KeyValueTrait, ZoneAllocated, Zone>(
|
||||
: BaseDirectChainedHashMap<KeyValueTrait, ZoneObject, Zone>(
|
||||
ThreadState::Current()->zone()) {}
|
||||
explicit ZoneDirectChainedHashMap(
|
||||
Zone* zone,
|
||||
intptr_t initial_size = ZoneDirectChainedHashMap::kInitialSize)
|
||||
: BaseDirectChainedHashMap<KeyValueTrait, ZoneAllocated, Zone>(
|
||||
: BaseDirectChainedHashMap<KeyValueTrait, ZoneObject, Zone>(
|
||||
zone,
|
||||
initial_size) {}
|
||||
|
||||
@@ -445,12 +445,12 @@ class BaseCStringSet
|
||||
DISALLOW_COPY_AND_ASSIGN(BaseCStringSet);
|
||||
};
|
||||
|
||||
class ZoneCStringSet : public BaseCStringSet<ZoneAllocated, Zone> {
|
||||
class ZoneCStringSet : public BaseCStringSet<ZoneObject, Zone> {
|
||||
public:
|
||||
ZoneCStringSet()
|
||||
: BaseCStringSet<ZoneAllocated, Zone>(ThreadState::Current()->zone()) {}
|
||||
: BaseCStringSet<ZoneObject, Zone>(ThreadState::Current()->zone()) {}
|
||||
explicit ZoneCStringSet(Zone* zone)
|
||||
: BaseCStringSet<ZoneAllocated, Zone>(zone) {}
|
||||
: BaseCStringSet<ZoneObject, Zone>(zone) {}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ZoneCStringSet);
|
||||
|
||||
@@ -166,7 +166,7 @@ class Image : ValueObject {
|
||||
DISALLOW_COPY_AND_ASSIGN(Image);
|
||||
};
|
||||
|
||||
class ImageReader : public ZoneAllocated {
|
||||
class ImageReader : public ZoneObject {
|
||||
public:
|
||||
ImageReader(const uint8_t* data_image, const uint8_t* instructions_image);
|
||||
|
||||
@@ -263,7 +263,7 @@ struct ImageWriterCommand {
|
||||
|
||||
#if defined(DART_PRECOMPILER)
|
||||
template <typename T>
|
||||
class Trie : public ZoneAllocated {
|
||||
class Trie : public ZoneObject {
|
||||
public:
|
||||
// Returns whether [key] is a valid trie key (that is, a C string that
|
||||
// contains only characters for which charIndex returns a non-negative value).
|
||||
|
||||
@@ -63,7 +63,7 @@ struct FieldMapping {
|
||||
using FieldMappingArray = ZoneGrowableArray<FieldMapping>;
|
||||
using FieldOffsetArray = ZoneGrowableArray<intptr_t>;
|
||||
|
||||
class InstanceMorpher : public ZoneAllocated {
|
||||
class InstanceMorpher : public ZoneObject {
|
||||
public:
|
||||
// Creates a new [InstanceMorpher] based on the [from]/[to] class
|
||||
// descriptions.
|
||||
@@ -106,7 +106,7 @@ class InstanceMorpher : public ZoneAllocated {
|
||||
GrowableArray<const Instance*> before_;
|
||||
};
|
||||
|
||||
class ReasonForCancelling : public ZoneAllocated {
|
||||
class ReasonForCancelling : public ZoneObject {
|
||||
public:
|
||||
explicit ReasonForCancelling(Zone* zone) {}
|
||||
virtual ~ReasonForCancelling() {}
|
||||
|
||||
@@ -144,7 +144,7 @@ class ClassIndex {
|
||||
DISALLOW_COPY_AND_ASSIGN(ClassIndex);
|
||||
};
|
||||
|
||||
struct UriToSourceTableEntry : public ZoneAllocated {
|
||||
struct UriToSourceTableEntry : public ZoneObject {
|
||||
UriToSourceTableEntry() {}
|
||||
|
||||
const String* uri = nullptr;
|
||||
|
||||
@@ -427,7 +427,7 @@ class HashingMachOWriteStream : public BaseWriteStream,
|
||||
};
|
||||
|
||||
// A superclass for all objects that represent some content in the MachO output.
|
||||
class MachOContents : public ZoneAllocated {
|
||||
class MachOContents : public ZoneObject {
|
||||
public:
|
||||
explicit MachOContents(bool needs_offset = true, bool in_segment = true)
|
||||
// Set the file offset and/or (relative) memory address to 0 if unneeded.
|
||||
|
||||
@@ -75,7 +75,7 @@ class MessageDeserializer;
|
||||
class ApiMessageSerializer;
|
||||
class ApiMessageDeserializer;
|
||||
|
||||
class MessageSerializationCluster : public ZoneAllocated {
|
||||
class MessageSerializationCluster : public ZoneObject {
|
||||
public:
|
||||
explicit MessageSerializationCluster(const char* name,
|
||||
MessagePhase phase,
|
||||
@@ -106,7 +106,7 @@ class MessageSerializationCluster : public ZoneAllocated {
|
||||
DISALLOW_COPY_AND_ASSIGN(MessageSerializationCluster);
|
||||
};
|
||||
|
||||
class MessageDeserializationCluster : public ZoneAllocated {
|
||||
class MessageDeserializationCluster : public ZoneObject {
|
||||
public:
|
||||
explicit MessageDeserializationCluster(const char* name,
|
||||
bool is_canonical = false)
|
||||
|
||||
@@ -94,7 +94,7 @@ class ModuleSnapshot : public AllStatic {
|
||||
|
||||
class Deserializer;
|
||||
|
||||
class DeserializationCluster : public ZoneAllocated {
|
||||
class DeserializationCluster : public ZoneObject {
|
||||
public:
|
||||
explicit DeserializationCluster(const char* name)
|
||||
: name_(name), start_index_(-1), stop_index_(-1) {}
|
||||
|
||||
+1
-1
@@ -7199,7 +7199,7 @@ class Code : public Object {
|
||||
void Disassemble(DisassemblyFormatter* formatter = nullptr) const;
|
||||
|
||||
#if defined(INCLUDE_IL_PRINTER)
|
||||
class Comments : public ZoneAllocated, public CodeComments {
|
||||
class Comments : public ZoneObject, public CodeComments {
|
||||
public:
|
||||
static Comments& New(intptr_t count);
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace dart {
|
||||
|
||||
class ObjectSetRegion : public ZoneAllocated {
|
||||
class ObjectSetRegion : public ZoneObject {
|
||||
public:
|
||||
ObjectSetRegion(Zone* zone, uword start, uword end)
|
||||
: start_(start),
|
||||
@@ -44,7 +44,7 @@ class ObjectSetRegion : public ZoneAllocated {
|
||||
BitVector bit_vector_;
|
||||
};
|
||||
|
||||
class ObjectSet : public ZoneAllocated {
|
||||
class ObjectSet : public ZoneObject {
|
||||
public:
|
||||
explicit ObjectSet(Zone* zone) : zone_(zone), sorted_(true), regions_() {}
|
||||
|
||||
|
||||
+2
-2
@@ -66,7 +66,7 @@ class FieldKeyValueTrait {
|
||||
typedef DirectChainedHashMap<FieldKeyValueTrait> FieldSet;
|
||||
|
||||
// The class ParsedFunction holds the result of parsing a function.
|
||||
class ParsedFunction : public ZoneAllocated {
|
||||
class ParsedFunction : public ZoneObject {
|
||||
public:
|
||||
ParsedFunction(Thread* thread, const Function& function);
|
||||
|
||||
@@ -248,7 +248,7 @@ class ParsedFunction : public ZoneAllocated {
|
||||
|
||||
// Variables needed for the InvokeFieldDispatcher for dynamic closure calls,
|
||||
// because they are both read and written to by the builders.
|
||||
struct DynamicClosureCallVars : ZoneAllocated {
|
||||
struct DynamicClosureCallVars : ZoneObject {
|
||||
DynamicClosureCallVars(Zone* zone, intptr_t num_named)
|
||||
: named_argument_parameter_indices(zone, num_named) {}
|
||||
|
||||
|
||||
@@ -561,7 +561,7 @@ class AbstractCode {
|
||||
};
|
||||
|
||||
// A Code object descriptor.
|
||||
class CodeDescriptor : public ZoneAllocated {
|
||||
class CodeDescriptor : public ZoneObject {
|
||||
public:
|
||||
explicit CodeDescriptor(const AbstractCode code);
|
||||
|
||||
@@ -603,7 +603,7 @@ class CodeDescriptor : public ZoneAllocated {
|
||||
};
|
||||
|
||||
// Fast lookup of Dart code objects.
|
||||
class CodeLookupTable : public ZoneAllocated {
|
||||
class CodeLookupTable : public ZoneObject {
|
||||
public:
|
||||
explicit CodeLookupTable(Thread* thread);
|
||||
|
||||
@@ -858,7 +858,7 @@ intptr_t Profiler::Size() {
|
||||
// A |ProcessedSample| is a combination of 1 (or more) |Sample|(s) that have
|
||||
// been merged into a logical sample. The raw data may have been processed to
|
||||
// improve the quality of the stack trace.
|
||||
class ProcessedSample : public ZoneAllocated {
|
||||
class ProcessedSample : public ZoneObject {
|
||||
public:
|
||||
ProcessedSample();
|
||||
|
||||
@@ -943,7 +943,7 @@ class ProcessedSample : public ZoneAllocated {
|
||||
};
|
||||
|
||||
// A collection of |ProcessedSample|s.
|
||||
class ProcessedSampleBuffer : public ZoneAllocated {
|
||||
class ProcessedSampleBuffer : public ZoneObject {
|
||||
public:
|
||||
ProcessedSampleBuffer();
|
||||
|
||||
|
||||
@@ -490,7 +490,7 @@ void ProfileCode::PrintToJSONArray(JSONArray* codes) {
|
||||
}
|
||||
#endif // !defined(PRODUCT)
|
||||
|
||||
class ProfileFunctionTable : public ZoneAllocated {
|
||||
class ProfileFunctionTable : public ZoneObject {
|
||||
public:
|
||||
ProfileFunctionTable()
|
||||
: null_function_(Function::ZoneHandle()),
|
||||
|
||||
@@ -62,7 +62,7 @@ class ProfileFunctionSourcePosition {
|
||||
DISALLOW_ALLOCATION();
|
||||
};
|
||||
|
||||
class ProfileCodeInlinedFunctionsCache : public ZoneAllocated {
|
||||
class ProfileCodeInlinedFunctionsCache : public ZoneObject {
|
||||
public:
|
||||
ProfileCodeInlinedFunctionsCache() : cache_cursor_(0), last_hit_(0) {
|
||||
for (intptr_t i = 0; i < kCacheSize; i++) {
|
||||
@@ -138,7 +138,7 @@ class ProfileCodeInlinedFunctionsCache : public ZoneAllocated {
|
||||
};
|
||||
|
||||
// Profile data related to a |Function|.
|
||||
class ProfileFunction : public ZoneAllocated {
|
||||
class ProfileFunction : public ZoneObject {
|
||||
public:
|
||||
enum Kind {
|
||||
kDartFunction, // Dart function.
|
||||
@@ -234,7 +234,7 @@ class ProfileCodeAddress {
|
||||
};
|
||||
|
||||
// Profile data related to a |Code|.
|
||||
class ProfileCode : public ZoneAllocated {
|
||||
class ProfileCode : public ZoneObject {
|
||||
public:
|
||||
enum Kind {
|
||||
kDartCode, // Live Dart code.
|
||||
@@ -329,7 +329,7 @@ class ProfileCode : public ZoneAllocated {
|
||||
friend class ProfileBuilder;
|
||||
};
|
||||
|
||||
class ProfileCodeTable : public ZoneAllocated {
|
||||
class ProfileCodeTable : public ZoneObject {
|
||||
public:
|
||||
ProfileCodeTable() : table_(8) {}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
namespace dart {
|
||||
|
||||
class WorklistElement : public ZoneAllocated {
|
||||
class WorklistElement : public ZoneObject {
|
||||
public:
|
||||
WorklistElement(Zone* zone, const Object& object)
|
||||
: object_(Object::Handle(zone, object.ptr())), next_(nullptr) {}
|
||||
@@ -448,7 +448,7 @@ void ProgramVisitor::ShareMegamorphicBuckets(Thread* thread) {
|
||||
}
|
||||
}
|
||||
|
||||
class StackMapEntry : public ZoneAllocated {
|
||||
class StackMapEntry : public ZoneObject {
|
||||
public:
|
||||
StackMapEntry(Zone* zone,
|
||||
const CompressedStackMaps::Iterator<CompressedStackMaps>& it)
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace dart {
|
||||
|
||||
#if defined(DART_PRECOMPILER) || defined(DART_ENABLE_HEAP_SNAPSHOT_WRITER)
|
||||
|
||||
class OffsetsTable : public ZoneAllocated {
|
||||
class OffsetsTable : public ZoneObject {
|
||||
public:
|
||||
explicit OffsetsTable(Zone* zone);
|
||||
|
||||
@@ -67,7 +67,7 @@ class OffsetsTable : public ZoneAllocated {
|
||||
|
||||
#else
|
||||
|
||||
class OffsetsTable : public ZoneAllocated {
|
||||
class OffsetsTable : public ZoneObject {
|
||||
public:
|
||||
explicit OffsetsTable(Zone* zone) {}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ class CharacterRange {
|
||||
|
||||
// A set of unsigned integers that behaves especially well on small
|
||||
// integers (< 32). May do zone-allocation.
|
||||
class OutSet : public ZoneAllocated {
|
||||
class OutSet : public ZoneObject {
|
||||
public:
|
||||
OutSet() : first_(0), remaining_(nullptr), successors_(nullptr) {}
|
||||
OutSet* Extend(unsigned value, Zone* zone);
|
||||
@@ -381,7 +381,7 @@ class QuickCheckDetails {
|
||||
DISALLOW_ALLOCATION();
|
||||
};
|
||||
|
||||
class RegExpNode : public ZoneAllocated {
|
||||
class RegExpNode : public ZoneObject {
|
||||
public:
|
||||
explicit RegExpNode(Zone* zone)
|
||||
: replacement_(nullptr), trace_count_(0), zone_(zone) {
|
||||
@@ -858,7 +858,7 @@ class NegativeSubmatchSuccess : public EndNode {
|
||||
intptr_t clear_capture_start_;
|
||||
};
|
||||
|
||||
class Guard : public ZoneAllocated {
|
||||
class Guard : public ZoneObject {
|
||||
public:
|
||||
enum Relation { LT, GEQ };
|
||||
Guard(intptr_t reg, Relation op, intptr_t value)
|
||||
@@ -1093,7 +1093,7 @@ ContainedInLattice AddRange(ContainedInLattice a,
|
||||
intptr_t ranges_size,
|
||||
Interval new_range);
|
||||
|
||||
class BoyerMoorePositionInfo : public ZoneAllocated {
|
||||
class BoyerMoorePositionInfo : public ZoneObject {
|
||||
public:
|
||||
explicit BoyerMoorePositionInfo(Zone* zone)
|
||||
: map_(new (zone) ZoneGrowableArray<bool>(kMapSize)),
|
||||
@@ -1129,7 +1129,7 @@ class BoyerMoorePositionInfo : public ZoneAllocated {
|
||||
ContainedInLattice surrogate_; // Surrogate UTF-16 code units.
|
||||
};
|
||||
|
||||
class BoyerMooreLookahead : public ZoneAllocated {
|
||||
class BoyerMooreLookahead : public ZoneObject {
|
||||
public:
|
||||
BoyerMooreLookahead(intptr_t length, RegExpCompiler* compiler, Zone* Zone);
|
||||
|
||||
@@ -1427,7 +1427,7 @@ class Analysis : public NodeVisitor {
|
||||
DISALLOW_IMPLICIT_CONSTRUCTORS(Analysis);
|
||||
};
|
||||
|
||||
struct RegExpCompileData : public ZoneAllocated {
|
||||
struct RegExpCompileData : public ZoneObject {
|
||||
RegExpCompileData()
|
||||
: tree(nullptr),
|
||||
node(nullptr),
|
||||
|
||||
@@ -93,7 +93,7 @@ class BlockLabel : public ValueObject {
|
||||
#endif // !defined(DART_PRECOMPILED_RUNTIME)
|
||||
};
|
||||
|
||||
class RegExpMacroAssembler : public ZoneAllocated {
|
||||
class RegExpMacroAssembler : public ZoneObject {
|
||||
public:
|
||||
// The implementation must be able to handle at least:
|
||||
static constexpr intptr_t kMaxRegister = (1 << 16) - 1;
|
||||
|
||||
@@ -34,7 +34,7 @@ class RegExpVisitor : public ValueObject {
|
||||
#undef MAKE_CASE
|
||||
};
|
||||
|
||||
class RegExpTree : public ZoneAllocated {
|
||||
class RegExpTree : public ZoneObject {
|
||||
public:
|
||||
static constexpr intptr_t kInfinity = kMaxInt32;
|
||||
virtual ~RegExpTree() {}
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace dart {
|
||||
|
||||
// Accumulates RegExp atoms and assertions into lists of terms and alternatives.
|
||||
class RegExpBuilder : public ZoneAllocated {
|
||||
class RegExpBuilder : public ZoneObject {
|
||||
public:
|
||||
explicit RegExpBuilder(RegExpFlags flags);
|
||||
|
||||
@@ -154,7 +154,7 @@ class RegExpParser : public ValueObject {
|
||||
GROUPING
|
||||
};
|
||||
|
||||
class RegExpParserState : public ZoneAllocated {
|
||||
class RegExpParserState : public ZoneObject {
|
||||
public:
|
||||
RegExpParserState(RegExpParserState* previous_state,
|
||||
SubexpressionType group_type,
|
||||
|
||||
+2
-2
@@ -72,7 +72,7 @@ class VariableIndex {
|
||||
int value_;
|
||||
};
|
||||
|
||||
class LocalVariable : public ZoneAllocated {
|
||||
class LocalVariable : public ZoneObject {
|
||||
public:
|
||||
static constexpr intptr_t kNoKernelOffset = -1;
|
||||
|
||||
@@ -310,7 +310,7 @@ class LocalVarDescriptorsBuilder : public ValueObject {
|
||||
GrowableArray<VarDesc> vars_;
|
||||
};
|
||||
|
||||
class LocalScope : public ZoneAllocated {
|
||||
class LocalScope : public ZoneObject {
|
||||
public:
|
||||
LocalScope(LocalScope* parent, int function_level, int loop_level);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class Dwarf;
|
||||
class ElfWriter;
|
||||
class MachOWriter;
|
||||
|
||||
class SharedObjectWriter : public ZoneAllocated {
|
||||
class SharedObjectWriter : public ZoneObject {
|
||||
public:
|
||||
enum class Type {
|
||||
// A snapshot that should include segment contents.
|
||||
|
||||
@@ -15,15 +15,15 @@ namespace dart {
|
||||
// platform/splay-tree.h). The tree itself and all its elements are allocated
|
||||
// in the Zone.
|
||||
template <typename Config>
|
||||
class ZoneSplayTree final : public SplayTree<Config, ZoneAllocated, Zone> {
|
||||
class ZoneSplayTree final : public SplayTree<Config, ZoneObject, Zone> {
|
||||
public:
|
||||
explicit ZoneSplayTree(Zone* zone)
|
||||
: SplayTree<Config, ZoneAllocated, Zone>(ASSERT_NOTNULL(zone)) {}
|
||||
: SplayTree<Config, ZoneObject, Zone>(ASSERT_NOTNULL(zone)) {}
|
||||
~ZoneSplayTree() {
|
||||
// Reset the root to avoid unneeded iteration over all tree nodes
|
||||
// in the destructor. For a zone-allocated tree, nodes will be
|
||||
// freed by the Zone.
|
||||
SplayTree<Config, ZoneAllocated, Zone>::ResetRoot();
|
||||
SplayTree<Config, ZoneObject, Zone>::ResetRoot();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ enum class IdSpace : uint8_t {
|
||||
// Change ObjectId::kIdSpaceBits to use last entry if more are added.
|
||||
};
|
||||
|
||||
class V8SnapshotProfileWriter : public ZoneAllocated {
|
||||
class V8SnapshotProfileWriter : public ZoneObject {
|
||||
public:
|
||||
struct ObjectId {
|
||||
ObjectId() : ObjectId(IdSpace::kInvalid, -1) {}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#ifndef RUNTIME_VM_ZONE_H_
|
||||
#define RUNTIME_VM_ZONE_H_
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "platform/utils.h"
|
||||
#include "vm/allocation.h"
|
||||
#include "vm/handles.h"
|
||||
@@ -19,6 +21,15 @@ namespace dart {
|
||||
|
||||
class Zone {
|
||||
public:
|
||||
// Allocates memory for T instance and constructs object by calling respective
|
||||
// Args... constructor.
|
||||
template <typename T, typename... Args>
|
||||
T* New(Args&&... args) {
|
||||
static_assert(alignof(T) <= kAlignment);
|
||||
void* memory = reinterpret_cast<void*>(AllocUnsafe(sizeof(T)));
|
||||
return new (memory) T(std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
// Allocate an array sized to hold 'len' elements of type
|
||||
// 'ElementType'. Checks for integer overflow when performing the
|
||||
// size computation.
|
||||
|
||||
@@ -135,7 +135,7 @@ VM_UNIT_TEST_CASE(ZoneRealloc) {
|
||||
Dart_ShutdownIsolate();
|
||||
}
|
||||
|
||||
VM_UNIT_TEST_CASE(ZoneAllocated) {
|
||||
VM_UNIT_TEST_CASE(ZoneObject) {
|
||||
#if defined(DEBUG)
|
||||
FLAG_trace_zones = true;
|
||||
#endif
|
||||
@@ -144,7 +144,7 @@ VM_UNIT_TEST_CASE(ZoneAllocated) {
|
||||
EXPECT(thread->zone() == nullptr);
|
||||
static int marker;
|
||||
|
||||
class SimpleZoneObject : public ZoneAllocated {
|
||||
class SimpleZoneObject : public ZoneObject {
|
||||
public:
|
||||
SimpleZoneObject() : slot(marker++) {}
|
||||
virtual ~SimpleZoneObject() {}
|
||||
@@ -162,7 +162,7 @@ VM_UNIT_TEST_CASE(ZoneAllocated) {
|
||||
EXPECT_EQ(0UL, zone.SizeInBytes());
|
||||
SimpleZoneObject* first = new SimpleZoneObject();
|
||||
EXPECT(first != nullptr);
|
||||
SimpleZoneObject* second = new SimpleZoneObject();
|
||||
SimpleZoneObject* second = zone.GetZone()->New<SimpleZoneObject>();
|
||||
EXPECT(second != nullptr);
|
||||
EXPECT(first != second);
|
||||
uintptr_t expected_size = (2 * sizeof(SimpleZoneObject));
|
||||
|
||||
Reference in New Issue
Block a user