OLD | NEW |
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 #include "src/compiler/node.h" | 5 #include "src/compiler/node.h" |
6 | 6 |
| 7 #include "src/compiler/generic-node-inl.h" |
| 8 |
7 namespace v8 { | 9 namespace v8 { |
8 namespace internal { | 10 namespace internal { |
9 namespace compiler { | 11 namespace compiler { |
10 | 12 |
| 13 void Node::CollectProjections(int projection_count, Node** projections) { |
| 14 for (int i = 0; i < projection_count; ++i) projections[i] = NULL; |
| 15 for (UseIter i = uses().begin(); i != uses().end(); ++i) { |
| 16 if ((*i)->opcode() != IrOpcode::kProjection) continue; |
| 17 int32_t index = OpParameter<int32_t>(*i); |
| 18 ASSERT_GE(index, 0); |
| 19 ASSERT_LT(index, projection_count); |
| 20 ASSERT_EQ(NULL, projections[index]); |
| 21 projections[index] = *i; |
| 22 } |
| 23 } |
| 24 |
| 25 |
11 OStream& operator<<(OStream& os, const Operator& op) { return op.PrintTo(os); } | 26 OStream& operator<<(OStream& os, const Operator& op) { return op.PrintTo(os); } |
12 | 27 |
13 | 28 |
14 OStream& operator<<(OStream& os, const Node& n) { | 29 OStream& operator<<(OStream& os, const Node& n) { |
15 os << n.id() << ": " << *n.op(); | 30 os << n.id() << ": " << *n.op(); |
16 if (n.op()->InputCount() != 0) { | 31 if (n.op()->InputCount() != 0) { |
17 os << "("; | 32 os << "("; |
18 for (int i = 0; i < n.op()->InputCount(); ++i) { | 33 for (int i = 0; i < n.op()->InputCount(); ++i) { |
19 if (i != 0) os << ", "; | 34 if (i != 0) os << ", "; |
20 os << n.InputAt(i)->id(); | 35 os << n.InputAt(i)->id(); |
21 } | 36 } |
22 os << ")"; | 37 os << ")"; |
23 } | 38 } |
24 return os; | 39 return os; |
25 } | 40 } |
26 } | 41 |
27 } | 42 } // namespace compiler |
28 } // namespace v8::internal::compiler | 43 } // namespace internal |
| 44 } // namespace v8 |
OLD | NEW |