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

#include <deferred_objects.h>

Inheritance diagram for dart::DeferredPcMarker:
dart::DeferredSlot

Public Member Functions

 DeferredPcMarker (intptr_t index, ObjectPtr *slot, DeferredSlot *next)
 
virtual void Materialize (DeoptContext *deopt_context)
 
intptr_t index () const
 
- Public Member Functions inherited from dart::DeferredSlot
 DeferredSlot (ObjectPtr *slot, DeferredSlot *next)
 
virtual ~DeferredSlot ()
 
ObjectPtrslot () const
 
DeferredSlotnext () const
 
virtual void Materialize (DeoptContext *deopt_context)=0
 

Detailed Description

Definition at line 151 of file deferred_objects.h.

Constructor & Destructor Documentation

◆ DeferredPcMarker()

dart::DeferredPcMarker::DeferredPcMarker ( intptr_t  index,
ObjectPtr slot,
DeferredSlot next 
)
inline

Definition at line 153 of file deferred_objects.h.

154 : DeferredSlot(slot, next), index_(index) {}
intptr_t index() const
ObjectPtr * slot() const
DeferredSlot * next() const
DeferredSlot(ObjectPtr *slot, DeferredSlot *next)

Member Function Documentation

◆ index()

intptr_t dart::DeferredPcMarker::index ( ) const
inline

Definition at line 158 of file deferred_objects.h.

158{ return index_; }

◆ Materialize()

void dart::DeferredPcMarker::Materialize ( DeoptContext deopt_context)
virtual

Implements dart::DeferredSlot.

Definition at line 149 of file deferred_objects.cc.

149 {
150 Thread* thread = deopt_context->thread();
151 Zone* zone = deopt_context->zone();
152 uword* dest_addr = reinterpret_cast<uword*>(slot());
153 Function& function = Function::Handle(zone);
154 function ^= deopt_context->ObjectAt(index_);
155 ASSERT(!function.IsNull());
156 SafepointWriteRwLocker ml(thread, thread->isolate_group()->program_lock());
157 const Error& error =
159 if (!error.IsNull()) {
161 }
162 const Code& code = Code::Handle(zone, function.unoptimized_code());
163 ASSERT(!code.IsNull());
164 ASSERT(function.HasCode());
165 *reinterpret_cast<ObjectPtr*>(dest_addr) = code.ptr();
166
167 if (FLAG_trace_deoptimization_verbose) {
168 THR_Print("materializing pc marker at 0x%" Px ": %s, %s\n",
169 reinterpret_cast<uword>(slot()), code.ToCString(),
170 function.ToCString());
171 }
172
173 // Increment the deoptimization counter. This effectively increments each
174 // function occurring in the optimized frame.
175 if (deopt_context->deoptimizing_code()) {
176 function.set_deoptimization_counter(function.deoptimization_counter() + 1);
177 }
178 if (FLAG_trace_deoptimization || FLAG_trace_deoptimization_verbose) {
179 THR_Print("Deoptimizing '%s' (count %d)\n",
180 function.ToFullyQualifiedCString(),
181 function.deoptimization_counter());
182 }
183 // Clear invocation counter so that hopefully the function gets reoptimized
184 // only after more feedback has been collected.
185 function.SetUsageCounter(0);
186 if (function.HasOptimizedCode()) {
187 function.SwitchToUnoptimizedCode();
188 }
189}
static ErrorPtr EnsureUnoptimizedCode(Thread *thread, const Function &function)
Definition: compiler.cc:854
static DART_NORETURN void PropagateError(const Error &error)
Definition: exceptions.cc:1003
static Object & Handle()
Definition: object.h:407
#define THR_Print(format,...)
Definition: log.h:20
#define ASSERT(E)
const uint8_t uint32_t uint32_t GError ** error
Dart_NativeFunction function
Definition: fuchsia.cc:51
uintptr_t uword
Definition: globals.h:501
#define Px
Definition: globals.h:410

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