 Chromium Code Reviews
 Chromium Code Reviews Issue 10823308:
  Implement basic support for deferred slow path code with calls that save and restore live registers.  (Closed) 
  Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
    
  
    Issue 10823308:
  Implement basic support for deferred slow path code with calls that save and restore live registers.  (Closed) 
  Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart| Index: runtime/vm/flow_graph_allocator.h | 
| diff --git a/runtime/vm/flow_graph_allocator.h b/runtime/vm/flow_graph_allocator.h | 
| index cab8c129942df47c22a6cd405f2e32efe005bb23..25e5fd3ece609c1a0c84cdb7ae0a403eae77cce3 100644 | 
| --- a/runtime/vm/flow_graph_allocator.h | 
| +++ b/runtime/vm/flow_graph_allocator.h | 
| @@ -96,6 +96,9 @@ class FlowGraphAllocator : public ValueObject { | 
| void ConnectIncomingPhiMoves(BlockEntryInstr* block); | 
| void BlockLocation(Location loc, intptr_t from, intptr_t to); | 
| + // Find all safepoints that are covered by this live range. | 
| + void AssignSafepoints(LiveRange* range); | 
| + | 
| // Process live ranges sorted by their start and assign registers | 
| // to them | 
| void AllocateCPURegisters(); | 
| @@ -213,8 +216,12 @@ class FlowGraphAllocator : public ValueObject { | 
| GrowableArray<LiveRange*> temporaries_; | 
| #endif | 
| + // List of spilled live ranges. | 
| GrowableArray<LiveRange*> spilled_; | 
| + // List of instructions containing calls. | 
| + GrowableArray<Instruction*> safepoints_; | 
| + | 
| // Per register lists of allocated live ranges. Contain only those | 
| // ranges that can be affected by future allocation decisions. | 
| // Those live ranges that end before the start of the current live range are | 
| @@ -225,13 +232,6 @@ class FlowGraphAllocator : public ValueObject { | 
| // become free and can be reused for allocation. | 
| GrowableArray<intptr_t> spill_slots_; | 
| - // List of safepoints. | 
| - struct Safepoint { | 
| - intptr_t position; | 
| - BitmapBuilder* stack_bitmap; | 
| - }; | 
| - GrowableArray<Safepoint> safepoints_; | 
| - | 
| bool blocked_cpu_regs_[kNumberOfCpuRegisters]; | 
| DISALLOW_COPY_AND_ASSIGN(FlowGraphAllocator); | 
| @@ -387,6 +387,27 @@ class AllocationFinger : public ValueObject { | 
| }; | 
| +class SafepointPosition : public ZoneAllocated { | 
| 
srdjan
2012/08/15 00:12:03
Make a common superclass PositionsList (subclasses
 | 
| + public: | 
| + SafepointPosition(intptr_t pos, | 
| + LocationSummary* locs) | 
| + : pos_(pos), locs_(locs), next_(NULL) { } | 
| + | 
| + void set_next(SafepointPosition* next) { next_ = next; } | 
| + SafepointPosition* next() const { return next_; } | 
| + | 
| + intptr_t pos() const { return pos_; } | 
| + | 
| + LocationSummary* locs() const { return locs_; } | 
| + | 
| + private: | 
| + const intptr_t pos_; | 
| + LocationSummary* const locs_; | 
| + | 
| + SafepointPosition* next_; | 
| +}; | 
| + | 
| + | 
| // LiveRange represents a sequence of UseIntervals for a given SSA value. | 
| class LiveRange : public ZoneAllocated { | 
| public: | 
| @@ -397,6 +418,8 @@ class LiveRange : public ZoneAllocated { | 
| uses_(NULL), | 
| first_use_interval_(NULL), | 
| last_use_interval_(NULL), | 
| + first_safepoint_(NULL), | 
| + last_safepoint_(NULL), | 
| next_sibling_(NULL), | 
| finger_() { | 
| } | 
| @@ -413,6 +436,8 @@ class LiveRange : public ZoneAllocated { | 
| intptr_t Start() const { return first_use_interval()->start(); } | 
| intptr_t End() const { return last_use_interval()->end(); } | 
| + SafepointPosition* first_safepoint() const { return first_safepoint_; } | 
| + | 
| AllocationFinger* finger() { return &finger_; } | 
| void set_assigned_location(Location location) { | 
| @@ -425,6 +450,8 @@ class LiveRange : public ZoneAllocated { | 
| void DefineAt(intptr_t pos); | 
| + void AddSafepoint(intptr_t pos, LocationSummary* locs); | 
| + | 
| void AddUse(intptr_t pos, Location* location_slot); | 
| void AddHintedUse(intptr_t pos, Location* location_slot, Location* hint); | 
| @@ -455,12 +482,15 @@ class LiveRange : public ZoneAllocated { | 
| UsePosition* uses, | 
| UseInterval* first_use_interval, | 
| UseInterval* last_use_interval, | 
| + SafepointPosition* first_safepoint, | 
| LiveRange* next_sibling) | 
| : vreg_(vreg), | 
| assigned_location_(), | 
| uses_(uses), | 
| first_use_interval_(first_use_interval), | 
| last_use_interval_(last_use_interval), | 
| + first_safepoint_(first_safepoint), | 
| + last_safepoint_(NULL), | 
| next_sibling_(next_sibling), | 
| finger_() { | 
| } | 
| @@ -473,6 +503,9 @@ class LiveRange : public ZoneAllocated { | 
| UseInterval* first_use_interval_; | 
| UseInterval* last_use_interval_; | 
| + SafepointPosition* first_safepoint_; | 
| + SafepointPosition* last_safepoint_; | 
| + | 
| LiveRange* next_sibling_; | 
| AllocationFinger finger_; |