Chromium Code Reviews| 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" | 7 #include "src/compiler/generic-node-inl.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| 11 namespace compiler { | 11 namespace compiler { |
| 12 | 12 |
| 13 void Node::CollectProjections(NodeVector* projections) { | 13 void Node::CollectProjections(NodeVector* projections) { |
| 14 for (size_t i = 0; i < projections->size(); i++) { | |
| 15 (*projections)[i] = NULL; | |
|
titzer
2014/08/25 13:17:13
I think you can use projections->at(i) here.
| |
| 16 } | |
| 14 for (UseIter i = uses().begin(); i != uses().end(); ++i) { | 17 for (UseIter i = uses().begin(); i != uses().end(); ++i) { |
| 15 if ((*i)->opcode() != IrOpcode::kProjection) continue; | 18 if ((*i)->opcode() != IrOpcode::kProjection) continue; |
| 16 DCHECK_GE(OpParameter<int32_t>(*i), 0); | 19 int32_t index = OpParameter<int32_t>(*i); |
| 17 projections->push_back(*i); | 20 DCHECK_GE(index, 0); |
| 21 DCHECK_LT(index, projections->size()); | |
| 22 DCHECK_EQ(NULL, (*projections)[index]); | |
| 23 (*projections)[index] = *i; | |
| 18 } | 24 } |
| 19 } | 25 } |
| 20 | 26 |
| 21 | 27 |
| 22 Node* Node::FindProjection(int32_t projection_index) { | 28 Node* Node::FindProjection(int32_t projection_index) { |
| 23 for (UseIter i = uses().begin(); i != uses().end(); ++i) { | 29 for (UseIter i = uses().begin(); i != uses().end(); ++i) { |
| 24 if ((*i)->opcode() == IrOpcode::kProjection && | 30 if ((*i)->opcode() == IrOpcode::kProjection && |
| 25 OpParameter<int32_t>(*i) == projection_index) { | 31 OpParameter<int32_t>(*i) == projection_index) { |
| 26 return *i; | 32 return *i; |
| 27 } | 33 } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 42 os << n.InputAt(i)->id(); | 48 os << n.InputAt(i)->id(); |
| 43 } | 49 } |
| 44 os << ")"; | 50 os << ")"; |
| 45 } | 51 } |
| 46 return os; | 52 return os; |
| 47 } | 53 } |
| 48 | 54 |
| 49 } // namespace compiler | 55 } // namespace compiler |
| 50 } // namespace internal | 56 } // namespace internal |
| 51 } // namespace v8 | 57 } // namespace v8 |
| OLD | NEW |