1 // Copyright 2015 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_LIVE_RANGE_SEPARATOR_H_ 6 #define V8_LIVE_RANGE_SEPARATOR_H_ 7 8 9 #include <src/zone.h> 10 namespace v8 { 11 namespace internal { 12 13 class Zone; 14 15 namespace compiler { 16 17 class RegisterAllocationData; 18 19 20 // A register allocation pair of transformations: splinter and merge live ranges 21 class LiveRangeSeparator final : public ZoneObject { 22 public: LiveRangeSeparator(RegisterAllocationData * data,Zone * zone)23 LiveRangeSeparator(RegisterAllocationData* data, Zone* zone) 24 : data_(data), zone_(zone) {} 25 26 void Splinter(); 27 28 private: data()29 RegisterAllocationData* data() const { return data_; } zone()30 Zone* zone() const { return zone_; } 31 32 RegisterAllocationData* const data_; 33 Zone* const zone_; 34 35 DISALLOW_COPY_AND_ASSIGN(LiveRangeSeparator); 36 }; 37 38 39 class LiveRangeMerger final : public ZoneObject { 40 public: LiveRangeMerger(RegisterAllocationData * data,Zone * zone)41 LiveRangeMerger(RegisterAllocationData* data, Zone* zone) 42 : data_(data), zone_(zone) {} 43 44 void Merge(); 45 46 private: data()47 RegisterAllocationData* data() const { return data_; } zone()48 Zone* zone() const { return zone_; } 49 50 // Mark ranges spilled in deferred blocks, that also cover non-deferred code. 51 // We do nothing special for ranges fully contained in deferred blocks, 52 // because they would "spill in deferred blocks" anyway. 53 void MarkRangesSpilledInDeferredBlocks(); 54 55 RegisterAllocationData* const data_; 56 Zone* const zone_; 57 58 DISALLOW_COPY_AND_ASSIGN(LiveRangeMerger); 59 }; 60 61 62 } // namespace compiler 63 } // namespace internal 64 } // namespace v8 65 #endif // V8_LIVE_RANGE_SEPARATOR_H_ 66