Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(653)

Side by Side Diff: src/compiler/scheduler.h

Issue 673513004: Make sure floating phi nodes are coupled to their control (2). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove bitlength. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/compiler/scheduler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_COMPILER_SCHEDULER_H_ 5 #ifndef V8_COMPILER_SCHEDULER_H_
6 #define V8_COMPILER_SCHEDULER_H_ 6 #define V8_COMPILER_SCHEDULER_H_
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/compiler/opcodes.h" 10 #include "src/compiler/opcodes.h"
(...skipping 11 matching lines...) Expand all
22 public: 22 public:
23 // The complete scheduling algorithm. Creates a new schedule and places all 23 // The complete scheduling algorithm. Creates a new schedule and places all
24 // nodes from the graph into it. 24 // nodes from the graph into it.
25 static Schedule* ComputeSchedule(ZonePool* zone_pool, Graph* graph); 25 static Schedule* ComputeSchedule(ZonePool* zone_pool, Graph* graph);
26 26
27 // Compute the RPO of blocks in an existing schedule. 27 // Compute the RPO of blocks in an existing schedule.
28 static BasicBlockVector* ComputeSpecialRPO(ZonePool* zone_pool, 28 static BasicBlockVector* ComputeSpecialRPO(ZonePool* zone_pool,
29 Schedule* schedule); 29 Schedule* schedule);
30 30
31 private: 31 private:
32 enum Placement { kUnknown, kSchedulable, kFixed }; 32 enum Placement { kUnknown, kSchedulable, kFixed, kCoupled };
33 33
34 // Per-node data tracked during scheduling. 34 // Per-node data tracked during scheduling.
35 struct SchedulerData { 35 struct SchedulerData {
36 BasicBlock* minimum_block_; // Minimum legal RPO placement. 36 BasicBlock* minimum_block_; // Minimum legal RPO placement.
37 int unscheduled_count_; // Number of unscheduled uses of this node. 37 int unscheduled_count_; // Number of unscheduled uses of this node.
38 bool is_connected_control_; // {true} if control-connected to the end node. 38 bool is_connected_control_; // {true} if control-connected to the end node.
39 bool is_floating_control_; // {true} if control, but not control-connected 39 bool is_floating_control_; // {true} if control, but not control-connected
40 // to the end node. 40 // to the end node.
41 Placement placement_ : 3; // Whether the node is fixed, schedulable, 41 Placement placement_; // Whether the node is fixed, schedulable,
42 // or not yet known. 42 // coupled to another node, or not yet known.
43 }; 43 };
44 44
45 ZonePool* zone_pool_;
46 Zone* zone_; 45 Zone* zone_;
47 Graph* graph_; 46 Graph* graph_;
48 Schedule* schedule_; 47 Schedule* schedule_;
49 NodeVectorVector scheduled_nodes_; 48 NodeVectorVector scheduled_nodes_;
50 NodeVector schedule_root_nodes_; 49 NodeVector schedule_root_nodes_;
50 ZoneQueue<Node*> schedule_queue_;
51 ZoneVector<SchedulerData> node_data_; 51 ZoneVector<SchedulerData> node_data_;
52 bool has_floating_control_; 52 bool has_floating_control_;
53 53
54 Scheduler(ZonePool* zone_pool, Zone* zone, Graph* graph, Schedule* schedule); 54 Scheduler(Zone* zone, Graph* graph, Schedule* schedule);
55 55
56 SchedulerData DefaultSchedulerData(); 56 inline SchedulerData DefaultSchedulerData();
57 57 inline SchedulerData* GetData(Node* node);
58 SchedulerData* GetData(Node* node) {
59 DCHECK(node->id() < static_cast<int>(node_data_.size()));
60 return &node_data_[node->id()];
61 }
62 58
63 Placement GetPlacement(Node* node); 59 Placement GetPlacement(Node* node);
64 60
65 int GetRPONumber(BasicBlock* block) { 61 void IncrementUnscheduledUseCount(Node* node, Node* from);
66 DCHECK(block->rpo_number() >= 0 && 62 void DecrementUnscheduledUseCount(Node* node, Node* from);
67 block->rpo_number() <
68 static_cast<int>(schedule_->rpo_order_.size()));
69 DCHECK(schedule_->rpo_order_[block->rpo_number()] == block);
70 return block->rpo_number();
71 }
72 63
64 inline int GetRPONumber(BasicBlock* block);
73 BasicBlock* GetCommonDominator(BasicBlock* b1, BasicBlock* b2); 65 BasicBlock* GetCommonDominator(BasicBlock* b1, BasicBlock* b2);
74 66
75 // Phase 1: Build control-flow graph and dominator tree. 67 // Phase 1: Build control-flow graph and dominator tree.
76 friend class CFGBuilder; 68 friend class CFGBuilder;
77 void BuildCFG(); 69 void BuildCFG();
78 void GenerateImmediateDominatorTree(); 70 void GenerateImmediateDominatorTree();
79 71
80 // Phase 2: Prepare use counts for nodes. 72 // Phase 2: Prepare use counts for nodes.
81 friend class PrepareUsesVisitor; 73 friend class PrepareUsesVisitor;
82 void PrepareUses(); 74 void PrepareUses();
83 75
84 // Phase 3: Schedule nodes early. 76 // Phase 3: Schedule nodes early.
85 friend class ScheduleEarlyNodeVisitor; 77 friend class ScheduleEarlyNodeVisitor;
86 void ScheduleEarly(); 78 void ScheduleEarly();
87 79
88 // Phase 4: Schedule nodes late. 80 // Phase 4: Schedule nodes late.
89 friend class ScheduleLateNodeVisitor; 81 friend class ScheduleLateNodeVisitor;
90 void ScheduleLate(); 82 void ScheduleLate();
91 83
92 bool ConnectFloatingControl(); 84 bool ConnectFloatingControl();
93 void ConnectFloatingControlSubgraph(BasicBlock* block, Node* node); 85 void ConnectFloatingControlSubgraph(BasicBlock* block, Node* node);
94 }; 86 };
95 87
96 } // namespace compiler 88 } // namespace compiler
97 } // namespace internal 89 } // namespace internal
98 } // namespace v8 90 } // namespace v8
99 91
100 #endif // V8_COMPILER_SCHEDULER_H_ 92 #endif // V8_COMPILER_SCHEDULER_H_
OLDNEW
« no previous file with comments | « no previous file | src/compiler/scheduler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698