Flutter Engine
The Flutter Engine
Public Member Functions | Friends | List of all members
dart::StackZone Class Reference

#include <zone.h>

Inheritance diagram for dart::StackZone:
dart::StackResource

Public Member Functions

 StackZone (ThreadState *thread)
 
virtual ~StackZone ()
 
uintptr_t SizeInBytes () const
 
intptr_t CapacityInBytes () const
 
ZoneGetZone ()
 
- Public Member Functions inherited from dart::StackResource
 StackResource (ThreadState *thread)
 
virtual ~StackResource ()
 
ThreadStatethread () const
 

Friends

template<typename T >
class GrowableArray
 
template<typename T >
class ZoneGrowableArray
 

Additional Inherited Members

- Static Public Member Functions inherited from dart::StackResource
static void Unwind (ThreadState *thread)
 
static void UnwindAbove (ThreadState *thread, StackResource *new_top)
 

Detailed Description

Definition at line 187 of file zone.h.

Constructor & Destructor Documentation

◆ StackZone()

dart::StackZone::StackZone ( ThreadState thread)
explicit

Definition at line 325 of file zone.cc.

328 : StackResource(thread), zone_(new Zone()) {
329#else
330 : StackResource(thread), zone_() {
331#endif // defined(DART_USE_ABSL)
332 if (FLAG_trace_zones) {
333 OS::PrintErr("*** Starting a new Stack zone 0x%" Px "(0x%" Px ")\n",
334 reinterpret_cast<intptr_t>(this),
335 reinterpret_cast<intptr_t>(GetZone()));
336 }
337
338 // This thread must be preventing safepoints or the GC could be visiting the
339 // chain of handle blocks we're about the mutate.
340 ASSERT(Thread::Current()->MayAllocateHandles());
341
342 Zone* lzone = GetZone();
343 lzone->Link(thread->zone());
344 thread->set_zone(lzone);
345}
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
ThreadState * thread() const
Definition: allocation.h:33
StackResource(ThreadState *thread)
Definition: allocation.h:25
Zone * GetZone()
Definition: zone.h:213
Zone * zone() const
Definition: thread_state.h:37
static Thread * Current()
Definition: thread.h:362
#define ASSERT(E)
#define Px
Definition: globals.h:410

◆ ~StackZone()

dart::StackZone::~StackZone ( )
virtual

Definition at line 347 of file zone.cc.

347 {
348 // This thread must be preventing safepoints or the GC could be visiting the
349 // chain of handle blocks we're about the mutate.
350 ASSERT(Thread::Current()->MayAllocateHandles());
351
352 Zone* lzone = GetZone();
353 ASSERT(thread()->zone() == lzone);
354 thread()->set_zone(lzone->previous_);
355 if (FLAG_trace_zones) {
356 OS::PrintErr("*** Deleting Stack zone 0x%" Px "(0x%" Px ")\n",
357 reinterpret_cast<intptr_t>(this),
358 reinterpret_cast<intptr_t>(lzone));
359 }
360
361#if defined(DART_USE_ABSL)
362 // DART_USE_ABSL encodes the use of fibers in the Dart VM for threading.
363 delete zone_;
364#endif // defined(DART_USE_ABSL)
365}

Member Function Documentation

◆ CapacityInBytes()

intptr_t dart::StackZone::CapacityInBytes ( ) const
inline

Definition at line 211 of file zone.h.

211{ return zone_.CapacityInBytes(); }
uintptr_t CapacityInBytes() const
Definition: zone.cc:186

◆ GetZone()

Zone * dart::StackZone::GetZone ( )
inline

Definition at line 213 of file zone.h.

213{ return &zone_; }

◆ SizeInBytes()

uintptr_t dart::StackZone::SizeInBytes ( ) const
inline

Definition at line 208 of file zone.h.

208{ return zone_.SizeInBytes(); }
uintptr_t SizeInBytes() const
Definition: zone.cc:182

Friends And Related Function Documentation

◆ GrowableArray

template<typename T >
friend class GrowableArray
friend

Definition at line 229 of file zone.h.

◆ ZoneGrowableArray

template<typename T >
friend class ZoneGrowableArray
friend

Definition at line 231 of file zone.h.


The documentation for this class was generated from the following files: