Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
dart::StackResource Class Reference

#include <allocation.h>

Inheritance diagram for dart::StackResource:
dart::ActiveIsolateScope dart::BaseSerializer dart::CompilerTimings::Scope dart::DisableThreadInterruptsScope dart::ExceptionHandlerFinder dart::HandleScope dart::HeapLocker dart::LogBlock dart::LongJumpScope dart::NoActiveIsolateScope dart::NoBackgroundCompilerScope dart::ObjectGraphCopier dart::ReadRwLocker dart::RuntimeCallDeoptScope dart::SafepointMutexLocker dart::SafepointReadRwLocker dart::SafepointWriteRwLocker dart::SerializedObjectBuffer dart::StackZone dart::TestStackResource dart::TestStackedStackResource dart::ThreadStackResource dart::TimerScope dart::WritableCodePages dart::WriteRwLocker dart::compiler::AssemblerBase

Public Member Functions

 StackResource (ThreadState *thread)
 
virtual ~StackResource ()
 
ThreadStatethread () const
 

Static Public Member Functions

static void Unwind (ThreadState *thread)
 
static void UnwindAbove (ThreadState *thread, StackResource *new_top)
 

Detailed Description

Definition at line 23 of file allocation.h.

Constructor & Destructor Documentation

◆ StackResource()

dart::StackResource::StackResource ( ThreadState thread)
inlineexplicit

Definition at line 25 of file allocation.h.

26 : thread_(nullptr), previous_(nullptr) {
27 Init(thread);
28 }
ThreadState * thread() const
Definition: allocation.h:33

◆ ~StackResource()

dart::StackResource::~StackResource ( )
virtual

Definition at line 30 of file allocation.cc.

30 {
31 if (thread_ != nullptr) {
32 StackResource* top = thread_->top_resource();
33 ASSERT(top == this);
34 thread_->set_top_resource(previous_);
35 }
36#if defined(DEBUG)
37 if (thread_ != nullptr) {
38 ASSERT(Thread::Current() == thread_);
39 }
40#endif
41}
StackResource(ThreadState *thread)
Definition: allocation.h:25
void set_top_resource(StackResource *value)
Definition: thread_state.h:42
StackResource * top_resource() const
Definition: thread_state.h:41
static Thread * Current()
Definition: thread.h:362
#define ASSERT(E)

Member Function Documentation

◆ thread()

ThreadState * dart::StackResource::thread ( ) const
inline

Definition at line 33 of file allocation.h.

33{ return thread_; }

◆ Unwind()

static void dart::StackResource::Unwind ( ThreadState thread)
inlinestatic

Definition at line 36 of file allocation.h.

36{ UnwindAbove(thread, nullptr); }
static void UnwindAbove(ThreadState *thread, StackResource *new_top)
Definition: allocation.cc:56

◆ UnwindAbove()

void dart::StackResource::UnwindAbove ( ThreadState thread,
StackResource new_top 
)
static

Definition at line 56 of file allocation.cc.

56 {
57 StackResource* current_resource = thread->top_resource();
58 while (current_resource != new_top) {
59 current_resource->~StackResource();
60 current_resource = thread->top_resource();
61 }
62}
virtual ~StackResource()
Definition: allocation.cc:30

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