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

Side by Side Diff: src/compiler/loop-analysis.cc

Issue 883613006: [turbofan] Cleanup the NodeProperties. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « src/compiler/load-elimination.cc ('k') | src/compiler/loop-peeling.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 #include "src/compiler/loop-analysis.h" 5 #include "src/compiler/loop-analysis.h"
6 6
7 #include "src/compiler/graph.h" 7 #include "src/compiler/graph.h"
8 #include "src/compiler/node.h" 8 #include "src/compiler/node.h"
9 #include "src/compiler/node-marker.h" 9 #include "src/compiler/node-marker.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties.h"
11 #include "src/zone.h" 11 #include "src/zone.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 namespace compiler { 15 namespace compiler {
16 16
17 #define OFFSET(x) ((x)&0x1f) 17 #define OFFSET(x) ((x)&0x1f)
18 #define BIT(x) (1u << OFFSET(x)) 18 #define BIT(x) (1u << OFFSET(x))
19 #define INDEX(x) ((x) >> 5) 19 #define INDEX(x) ((x) >> 5)
20 20
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 Node* node = queue_.front(); 189 Node* node = queue_.front();
190 info(node); 190 info(node);
191 queue_.pop_front(); 191 queue_.pop_front();
192 queued_.Set(node, false); 192 queued_.Set(node, false);
193 193
194 int loop_num = -1; 194 int loop_num = -1;
195 // Setup loop headers first. 195 // Setup loop headers first.
196 if (node->opcode() == IrOpcode::kLoop) { 196 if (node->opcode() == IrOpcode::kLoop) {
197 // found the loop node first. 197 // found the loop node first.
198 loop_num = CreateLoopInfo(node); 198 loop_num = CreateLoopInfo(node);
199 } else if (IrOpcode::IsPhiOpcode(node->opcode())) { 199 } else if (NodeProperties::IsPhi(node)) {
200 // found a phi first. 200 // found a phi first.
201 Node* merge = node->InputAt(node->InputCount() - 1); 201 Node* merge = node->InputAt(node->InputCount() - 1);
202 if (merge->opcode() == IrOpcode::kLoop) { 202 if (merge->opcode() == IrOpcode::kLoop) {
203 loop_num = CreateLoopInfo(merge); 203 loop_num = CreateLoopInfo(merge);
204 } 204 }
205 } 205 }
206 206
207 // Propagate marks backwards from this node. 207 // Propagate marks backwards from this node.
208 for (int i = 0; i < node->InputCount(); i++) { 208 for (int i = 0; i < node->InputCount(); i++) {
209 Node* input = node->InputAt(i); 209 Node* input = node->InputAt(i);
(...skipping 17 matching lines...) Expand all
227 if (INDEX(loop_num) >= width_) ResizeBackwardMarks(); 227 if (INDEX(loop_num) >= width_) ResizeBackwardMarks();
228 228
229 // Create a new loop. 229 // Create a new loop.
230 loops_.push_back({node, nullptr, nullptr, nullptr}); 230 loops_.push_back({node, nullptr, nullptr, nullptr});
231 loop_tree_->NewLoop(); 231 loop_tree_->NewLoop();
232 SetBackwardMark(node, loop_num); 232 SetBackwardMark(node, loop_num);
233 loop_tree_->node_to_loop_num_[node->id()] = loop_num; 233 loop_tree_->node_to_loop_num_[node->id()] = loop_num;
234 234
235 // Setup loop mark for phis attached to loop header. 235 // Setup loop mark for phis attached to loop header.
236 for (Node* use : node->uses()) { 236 for (Node* use : node->uses()) {
237 if (IrOpcode::IsPhiOpcode(use->opcode())) { 237 if (NodeProperties::IsPhi(use)) {
238 SetBackwardMark(use, loop_num); 238 SetBackwardMark(use, loop_num);
239 loop_tree_->node_to_loop_num_[use->id()] = loop_num; 239 loop_tree_->node_to_loop_num_[use->id()] = loop_num;
240 } 240 }
241 } 241 }
242 242
243 return loop_num; 243 return loop_num;
244 } 244 }
245 245
246 void ResizeBackwardMarks() { 246 void ResizeBackwardMarks() {
247 int new_width = width_ + 1; 247 int new_width = width_ + 1;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 if (!IsBackedge(use, edge)) { 282 if (!IsBackedge(use, edge)) {
283 if (PropagateForwardMarks(node, use)) Queue(use); 283 if (PropagateForwardMarks(node, use)) Queue(use);
284 } 284 }
285 } 285 }
286 } 286 }
287 } 287 }
288 288
289 bool IsBackedge(Node* use, Edge& edge) { 289 bool IsBackedge(Node* use, Edge& edge) {
290 if (LoopNum(use) <= 0) return false; 290 if (LoopNum(use) <= 0) return false;
291 if (edge.index() == kAssumedLoopEntryIndex) return false; 291 if (edge.index() == kAssumedLoopEntryIndex) return false;
292 if (IrOpcode::IsPhiOpcode(use->opcode())) { 292 if (NodeProperties::IsPhi(use)) {
293 return !NodeProperties::IsControlEdge(edge); 293 return !NodeProperties::IsControlEdge(edge);
294 } 294 }
295 return true; 295 return true;
296 } 296 }
297 297
298 int LoopNum(Node* node) { return loop_tree_->node_to_loop_num_[node->id()]; } 298 int LoopNum(Node* node) { return loop_tree_->node_to_loop_num_[node->id()]; }
299 299
300 NodeInfo& info(Node* node) { 300 NodeInfo& info(Node* node) {
301 NodeInfo& i = info_[node->id()]; 301 NodeInfo& i = info_[node->id()];
302 if (i.node == nullptr) i.node = node; 302 if (i.node == nullptr) i.node = node;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 finder.Run(); 457 finder.Run();
458 if (FLAG_trace_turbo_graph) { 458 if (FLAG_trace_turbo_graph) {
459 finder.Print(); 459 finder.Print();
460 } 460 }
461 return loop_tree; 461 return loop_tree;
462 } 462 }
463 463
464 } // namespace compiler 464 } // namespace compiler
465 } // namespace internal 465 } // namespace internal
466 } // namespace v8 466 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/load-elimination.cc ('k') | src/compiler/loop-peeling.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698