| OLD | NEW |
| 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.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 |
| 21 // TODO(titzer): don't assume entry edges have a particular index. | |
| 22 static const int kAssumedLoopEntryIndex = 0; // assume loops are entered here. | |
| 23 | |
| 24 | |
| 25 // Temporary information for each node during marking. | 21 // Temporary information for each node during marking. |
| 26 struct NodeInfo { | 22 struct NodeInfo { |
| 27 Node* node; | 23 Node* node; |
| 28 NodeInfo* next; // link in chaining loop members | 24 NodeInfo* next; // link in chaining loop members |
| 29 }; | 25 }; |
| 30 | 26 |
| 31 | 27 |
| 32 // Temporary loop info needed during traversal and building the loop tree. | 28 // Temporary loop info needed during traversal and building the loop tree. |
| 33 struct LoopInfo { | 29 struct LoopInfo { |
| 34 Node* header; | 30 Node* header; |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 if (first->opcode() == IrOpcode::kLoop) return first; | 464 if (first->opcode() == IrOpcode::kLoop) return first; |
| 469 DCHECK(IrOpcode::IsPhiOpcode(first->opcode())); | 465 DCHECK(IrOpcode::IsPhiOpcode(first->opcode())); |
| 470 Node* header = NodeProperties::GetControlInput(first); | 466 Node* header = NodeProperties::GetControlInput(first); |
| 471 DCHECK_EQ(IrOpcode::kLoop, header->opcode()); | 467 DCHECK_EQ(IrOpcode::kLoop, header->opcode()); |
| 472 return header; | 468 return header; |
| 473 } | 469 } |
| 474 | 470 |
| 475 } // namespace compiler | 471 } // namespace compiler |
| 476 } // namespace internal | 472 } // namespace internal |
| 477 } // namespace v8 | 473 } // namespace v8 |
| OLD | NEW |