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#include "src/zone/zone.h" 9namespace v8 { 10namespace internal { 11 12class Zone; 13 14namespace compiler { 15 16class RegisterAllocationData; 17 18 19// A register allocation pair of transformations: splinter and merge live ranges 20class LiveRangeSeparator final : public ZoneObject { 21 public: 22 LiveRangeSeparator(RegisterAllocationData* data, Zone* zone) 23 : data_(data), zone_(zone) {} 24 25 void Splinter(); 26 27 private: 28 RegisterAllocationData* data() const { return data_; } 29 Zone* zone() const { return zone_; } 30 31 RegisterAllocationData* const data_; 32 Zone* const zone_; 33 34 DISALLOW_COPY_AND_ASSIGN(LiveRangeSeparator); 35}; 36 37 38class LiveRangeMerger final : public ZoneObject { 39 public: 40 LiveRangeMerger(RegisterAllocationData* data, Zone* zone) 41 : data_(data), zone_(zone) {} 42 43 void Merge(); 44 45 private: 46 RegisterAllocationData* data() const { return data_; } 47 Zone* zone() const { return zone_; } 48 49 // Mark ranges spilled in deferred blocks, that also cover non-deferred code. 50 // We do nothing special for ranges fully contained in deferred blocks, 51 // because they would "spill in deferred blocks" anyway. 52 void MarkRangesSpilledInDeferredBlocks(); 53 54 RegisterAllocationData* const data_; 55 Zone* const zone_; 56 57 DISALLOW_COPY_AND_ASSIGN(LiveRangeMerger); 58}; 59 60 61} // namespace compiler 62} // namespace internal 63} // namespace v8 64#endif // V8_LIVE_RANGE_SEPARATOR_H_ 65