Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Unified Diff: runtime/vm/deopt_instructions.h

Issue 10825236: Replace deopt stubs location/register shuffling with using deopt-info. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/deopt_instructions.h
===================================================================
--- runtime/vm/deopt_instructions.h (revision 10450)
+++ runtime/vm/deopt_instructions.h (working copy)
@@ -6,6 +6,7 @@
#define VM_DEOPT_INSTRUCTIONS_H_
#include "vm/allocation.h"
+#include "vm/assembler.h"
#include "vm/growable_array.h"
#include "vm/object.h"
@@ -14,6 +15,52 @@
class Location;
class Value;
+// Holds all data relevant for execution of deoptimization instructions.
+class DeoptimizationContext : public ValueObject {
+ public:
+ // 'frame_start' points to the return address just below the frame's
siva 2012/08/09 21:38:19 'frame_start' -> 'to_frame_start'
srdjan 2012/08/09 23:28:30 Done.
+ // stack pointer. 'num_args' is 0 if there are no arguments or if there
+ // are optional arguments.
+ explicit DeoptimizationContext(intptr_t* to_frame_start,
+ const Array& object_table,
+ intptr_t num_args);
siva 2012/08/09 21:38:19 why explicit?
srdjan 2012/08/09 23:28:30 Removed
+
+ intptr_t* GetFromFrameAddressAt(intptr_t index) const {
+ ASSERT((0 <= index) && (index < from_frame_size_));
+ return &from_frame_[index];
+ }
+
+ intptr_t* GetToFrameAddressAt(intptr_t index) const {
+ ASSERT(0 <= index);
siva 2012/08/09 21:38:19 Is there a way to assert that index is valid on th
srdjan 2012/08/09 23:28:30 Passing additional to_frame_size and checking it h
+ return &to_frame_[index];
+ }
+
+ intptr_t* GetFromFpAddress() const;
+ intptr_t* GetFromPcAddress() const;
+
+ RawObject* ObjectAt(intptr_t index) const {
+ return object_table_.At(index);
+ }
+
+ intptr_t RegisterValue(Register reg) const {
+ return registers_copy_[reg];
+ }
+
+ intptr_t from_frame_size() const { return from_frame_size_; }
+
+ private:
+ const Array& object_table_;
+ intptr_t* to_frame_;
+ intptr_t* from_frame_;
+ intptr_t from_frame_size_;
+ intptr_t* registers_copy_;
+ const intptr_t num_args_;
+
+ DISALLOW_COPY_AND_ASSIGN(DeoptimizationContext);
+};
+
+
+
// 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.
@@ -21,8 +68,14 @@
public:
static DeoptInstr* Create(intptr_t kind_as_int, intptr_t from_index);
+ DeoptInstr() {}
+ virtual ~DeoptInstr() {}
+
virtual const char* ToCString() const = 0;
+ virtual void Execute(DeoptimizationContext* deopt_context,
+ intptr_t to_index) = 0;
+
protected:
enum Kind {
kSetRetAddress,
@@ -34,8 +87,6 @@
kSetCallerPc,
};
- DeoptInstr() {}
-
virtual DeoptInstr::Kind kind() const = 0;
virtual intptr_t from_index() const = 0;

Powered by Google App Engine
This is Rietveld 408576698