Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_FLOW_GRAPH_ALLOCATOR_H_ | 5 #ifndef VM_FLOW_GRAPH_ALLOCATOR_H_ |
| 6 #define VM_FLOW_GRAPH_ALLOCATOR_H_ | 6 #define VM_FLOW_GRAPH_ALLOCATOR_H_ |
| 7 | 7 |
| 8 #include "vm/growable_array.h" | 8 #include "vm/growable_array.h" |
| 9 #include "vm/intermediate_language.h" | 9 #include "vm/intermediate_language.h" |
| 10 | 10 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 class AllocationFinger; | 13 class AllocationFinger; |
| 14 class BlockInfo; | 14 class BlockInfo; |
| 15 class FlowGraphBuilder; | 15 class FlowGraph; |
| 16 class LiveRange; | 16 class LiveRange; |
| 17 class UseInterval; | 17 class UseInterval; |
| 18 class UsePosition; | 18 class UsePosition; |
| 19 | 19 |
| 20 class FlowGraphAllocator : public ValueObject { | 20 class FlowGraphAllocator : public ValueObject { |
| 21 public: | 21 public: |
| 22 FlowGraphAllocator(const GrowableArray<BlockEntryInstr*>& block_order, | 22 explicit FlowGraphAllocator(FlowGraph* flow_graph); |
| 23 FlowGraphBuilder* builder); | |
| 24 | 23 |
| 25 void AllocateRegisters(); | 24 void AllocateRegisters(); |
| 26 | 25 |
| 27 // Build live-in and live-out sets for each block. | 26 // Build live-in and live-out sets for each block. |
| 28 void AnalyzeLiveness(); | 27 void AnalyzeLiveness(); |
| 29 | 28 |
| 30 // Map a virtual register number to its live range. | 29 // Map a virtual register number to its live range. |
| 31 LiveRange* GetLiveRange(intptr_t vreg); | 30 LiveRange* GetLiveRange(intptr_t vreg); |
| 32 | 31 |
| 33 private: | 32 private: |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 void SpillBetween(LiveRange* range, intptr_t from, intptr_t to); | 166 void SpillBetween(LiveRange* range, intptr_t from, intptr_t to); |
| 168 | 167 |
| 169 // Mark the live range as a live object pointer at all safepoints | 168 // Mark the live range as a live object pointer at all safepoints |
| 170 // contained in the range. | 169 // contained in the range. |
| 171 void MarkAsObjectAtSafepoints(LiveRange* range); | 170 void MarkAsObjectAtSafepoints(LiveRange* range); |
| 172 | 171 |
| 173 MoveOperands* AddMoveAt(intptr_t pos, Location to, Location from); | 172 MoveOperands* AddMoveAt(intptr_t pos, Location to, Location from); |
| 174 | 173 |
| 175 void PrintLiveRanges(); | 174 void PrintLiveRanges(); |
| 176 | 175 |
| 177 // TODO(vegorov): this field is used only to call Bailout. Remove when | 176 // TODO(vegorov): this field is used only to call Bailout. Remove when |
|
Kevin Millikin (Google)
2012/08/16 08:09:57
I don't think the TODO comment is accurate anymore
zerny-google
2012/08/16 11:52:27
Done.
| |
| 178 // all bailouts are gone. | 177 // all bailouts are gone. |
| 179 FlowGraphBuilder* builder_; | 178 FlowGraph* flow_graph_; |
| 180 | 179 |
| 181 const GrowableArray<BlockEntryInstr*>& block_order_; | 180 const GrowableArray<BlockEntryInstr*>& block_order_; |
| 182 const GrowableArray<BlockEntryInstr*>& postorder_; | 181 const GrowableArray<BlockEntryInstr*>& postorder_; |
| 183 | 182 |
| 184 // Mapping between lifetime positions and instructions. | 183 // Mapping between lifetime positions and instructions. |
| 185 GrowableArray<Instruction*> instructions_; | 184 GrowableArray<Instruction*> instructions_; |
| 186 | 185 |
| 187 // Mapping between lifetime positions and blocks containing them. | 186 // Mapping between lifetime positions and blocks containing them. |
| 188 GrowableArray<BlockInfo*> block_info_; | 187 GrowableArray<BlockInfo*> block_info_; |
| 189 | 188 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 | 509 |
| 511 AllocationFinger finger_; | 510 AllocationFinger finger_; |
| 512 | 511 |
| 513 DISALLOW_COPY_AND_ASSIGN(LiveRange); | 512 DISALLOW_COPY_AND_ASSIGN(LiveRange); |
| 514 }; | 513 }; |
| 515 | 514 |
| 516 | 515 |
| 517 } // namespace dart | 516 } // namespace dart |
| 518 | 517 |
| 519 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_ | 518 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_ |
| OLD | NEW |