| Index: src/compiler/instruction-scheduler.h
|
| diff --git a/src/compiler/instruction-scheduler.h b/src/compiler/instruction-scheduler.h
|
| index fafbe47908019115d95f2dabfb3aec3f73c80b1f..104c0b97de8bd401d2a39c42d7bbfac81f38bec9 100644
|
| --- a/src/compiler/instruction-scheduler.h
|
| +++ b/src/compiler/instruction-scheduler.h
|
| @@ -90,11 +90,66 @@ class InstructionScheduler final : public ZoneObject {
|
| int start_cycle_;
|
| };
|
|
|
| - // Compare the two nodes and return true if node1 is a better candidate than
|
| - // node2 (i.e. node1 should be scheduled before node2).
|
| - bool CompareNodes(ScheduleGraphNode *node1, ScheduleGraphNode *node2) const;
|
| + // Keep track of all nodes ready to be scheduled (i.e. all their dependencies
|
| + // have been scheduled. Note that this class is inteded to be extended by
|
| + // concrete implementation of the scheduling queue which define the policy
|
| + // to pop node from the queue.
|
| + class SchedulingQueueBase {
|
| + public:
|
| + explicit SchedulingQueueBase(InstructionScheduler* scheduler)
|
| + : scheduler_(scheduler),
|
| + nodes_(scheduler->zone()) {
|
| + }
|
| +
|
| + void AddNode(ScheduleGraphNode* node) {
|
| + nodes_.push_back(node);
|
| + }
|
| +
|
| + bool IsEmpty() const {
|
| + return nodes_.empty();
|
| + }
|
| +
|
| + protected:
|
| + InstructionScheduler* scheduler_;
|
| + ZoneLinkedList<ScheduleGraphNode*> nodes_;
|
| + };
|
| +
|
| + // A scheduling queue which prioritize nodes on the critical path (we look
|
| + // for the instruction with the highest latency on the path to reach the end
|
| + // of the graph).
|
| + class CriticalPathFirstQueue : public SchedulingQueueBase {
|
| + public:
|
| + explicit CriticalPathFirstQueue(InstructionScheduler* scheduler)
|
| + : SchedulingQueueBase(scheduler) { }
|
| +
|
| + // Look for the best candidate to schedule, remove it from the queue and
|
| + // return it.
|
| + ScheduleGraphNode* PopBestCandidate(int cycle);
|
| +
|
| + private:
|
| + // Compare the two nodes and return true if node1 is a better candidate than
|
| + // node2 (i.e. node1 should be scheduled before node2).
|
| + bool CompareNodes(ScheduleGraphNode *node1, ScheduleGraphNode *node2) const;
|
| + };
|
| +
|
| + // A queue which pop a random node from the queue to perform stress tests on
|
| + // the scheduler.
|
| + class StressSchedulerQueue : public SchedulingQueueBase {
|
| + public:
|
| + explicit StressSchedulerQueue(InstructionScheduler* scheduler)
|
| + : SchedulingQueueBase(scheduler) { }
|
| +
|
| + ScheduleGraphNode* PopBestCandidate(int cycle);
|
| +
|
| + private:
|
| + Isolate *isolate() {
|
| + return scheduler_->isolate();
|
| + }
|
| + };
|
|
|
| - // Perform scheduling for the current block.
|
| + // Perform scheduling for the current block specifying the queue type to
|
| + // use to determine the next best candidate.
|
| + template <typename QueueType>
|
| void ScheduleBlock();
|
|
|
| // Return the scheduling properties of the given instruction.
|
| @@ -134,6 +189,7 @@ class InstructionScheduler final : public ZoneObject {
|
|
|
| Zone* zone() { return zone_; }
|
| InstructionSequence* sequence() { return sequence_; }
|
| + Isolate* isolate() { return sequence()->isolate(); }
|
|
|
| Zone* zone_;
|
| InstructionSequence* sequence_;
|
|
|