live-range-separator.h 1.57 KB
Newer Older
1 2 3 4 5 6 7
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_LIVE_RANGE_SEPARATOR_H_
#define V8_LIVE_RANGE_SEPARATOR_H_

8
#include "src/zone/zone.h"
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
namespace v8 {
namespace internal {

class Zone;

namespace compiler {

class RegisterAllocationData;


// A register allocation pair of transformations: splinter and merge live ranges
class LiveRangeSeparator final : public ZoneObject {
 public:
  LiveRangeSeparator(RegisterAllocationData* data, Zone* zone)
      : data_(data), zone_(zone) {}

  void Splinter();

 private:
  RegisterAllocationData* data() const { return data_; }
  Zone* zone() const { return zone_; }

  RegisterAllocationData* const data_;
  Zone* const zone_;

  DISALLOW_COPY_AND_ASSIGN(LiveRangeSeparator);
};


class LiveRangeMerger final : public ZoneObject {
 public:
  LiveRangeMerger(RegisterAllocationData* data, Zone* zone)
      : data_(data), zone_(zone) {}

  void Merge();

 private:
  RegisterAllocationData* data() const { return data_; }
  Zone* zone() const { return zone_; }

49 50 51 52 53
  // Mark ranges spilled in deferred blocks, that also cover non-deferred code.
  // We do nothing special for ranges fully contained in deferred blocks,
  // because they would "spill in deferred blocks" anyway.
  void MarkRangesSpilledInDeferredBlocks();

54 55 56 57 58 59 60 61 62 63 64
  RegisterAllocationData* const data_;
  Zone* const zone_;

  DISALLOW_COPY_AND_ASSIGN(LiveRangeMerger);
};


}  // namespace compiler
}  // namespace internal
}  // namespace v8
#endif  // V8_LIVE_RANGE_SEPARATOR_H_