OLD | NEW |
(Empty) | |
| 1 // Copyright 2013 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_COMPILER_SCHEDULER_H_ |
| 6 #define V8_COMPILER_SCHEDULER_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "src/v8.h" |
| 11 |
| 12 #include "src/compiler/opcodes.h" |
| 13 #include "src/compiler/schedule.h" |
| 14 #include "src/zone-allocator.h" |
| 15 #include "src/zone-containers.h" |
| 16 |
| 17 namespace v8 { |
| 18 namespace internal { |
| 19 namespace compiler { |
| 20 |
| 21 class Scheduler { |
| 22 public: |
| 23 explicit Scheduler(Zone* zone); |
| 24 Scheduler(Zone* zone, Graph* graph, Schedule* schedule); |
| 25 |
| 26 Schedule* NewSchedule(Graph* graph); |
| 27 |
| 28 BasicBlockVector* ComputeSpecialRPO(); |
| 29 |
| 30 private: |
| 31 Zone* zone_; |
| 32 Graph* graph_; |
| 33 Schedule* schedule_; |
| 34 NodeVector branches_; |
| 35 NodeVector calls_; |
| 36 NodeVector deopts_; |
| 37 NodeVector returns_; |
| 38 NodeVector loops_and_merges_; |
| 39 BasicBlockVector node_block_placement_; |
| 40 IntVector unscheduled_uses_; |
| 41 NodeVectorVector scheduled_nodes_; |
| 42 NodeVector schedule_root_nodes_; |
| 43 IntVector schedule_early_rpo_index_; |
| 44 |
| 45 int GetRPONumber(BasicBlock* block) { |
| 46 ASSERT(block->rpo_number_ >= 0 && |
| 47 block->rpo_number_ < static_cast<int>(schedule_->rpo_order_.size())); |
| 48 ASSERT(schedule_->rpo_order_[block->rpo_number_] == block); |
| 49 return block->rpo_number_; |
| 50 } |
| 51 |
| 52 void PrepareAuxiliaryNodeData(); |
| 53 void PrepareAuxiliaryBlockData(); |
| 54 |
| 55 friend class CreateBlockVisitor; |
| 56 void CreateBlocks(); |
| 57 |
| 58 void WireBlocks(); |
| 59 |
| 60 void AddPredecessorsForLoopsAndMerges(); |
| 61 void AddSuccessorsForBranches(); |
| 62 void AddSuccessorsForReturns(); |
| 63 void AddSuccessorsForCalls(); |
| 64 void AddSuccessorsForDeopts(); |
| 65 |
| 66 void GenerateImmediateDominatorTree(); |
| 67 BasicBlock* GetCommonDominator(BasicBlock* b1, BasicBlock* b2); |
| 68 |
| 69 friend class ScheduleEarlyNodeVisitor; |
| 70 void ScheduleEarly(); |
| 71 |
| 72 friend class PrepareUsesVisitor; |
| 73 void PrepareUses(); |
| 74 |
| 75 friend class ScheduleLateNodeVisitor; |
| 76 void ScheduleLate(); |
| 77 }; |
| 78 } |
| 79 } |
| 80 } // namespace v8::internal::compiler |
| 81 |
| 82 #endif // V8_COMPILER_SCHEDULER_H_ |
OLD | NEW |