• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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"
9 namespace v8 {
10 namespace internal {
11 
12 class Zone;
13 
14 namespace compiler {
15 
16 class RegisterAllocationData;
17 
18 
19 // A register allocation pair of transformations: splinter and merge live ranges
20 class LiveRangeSeparator final : public ZoneObject {
21  public:
LiveRangeSeparator(RegisterAllocationData * data,Zone * zone)22   LiveRangeSeparator(RegisterAllocationData* data, Zone* zone)
23       : data_(data), zone_(zone) {}
24 
25   void Splinter();
26 
27  private:
data()28   RegisterAllocationData* data() const { return data_; }
zone()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 
38 class LiveRangeMerger final : public ZoneObject {
39  public:
LiveRangeMerger(RegisterAllocationData * data,Zone * zone)40   LiveRangeMerger(RegisterAllocationData* data, Zone* zone)
41       : data_(data), zone_(zone) {}
42 
43   void Merge();
44 
45  private:
data()46   RegisterAllocationData* data() const { return data_; }
zone()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