| 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/graph.h" | 5 #include "src/compiler/graph.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 decorators_.push_back(decorator); | 35 decorators_.push_back(decorator); |
| 36 } | 36 } |
| 37 | 37 |
| 38 | 38 |
| 39 void Graph::RemoveDecorator(GraphDecorator* decorator) { | 39 void Graph::RemoveDecorator(GraphDecorator* decorator) { |
| 40 auto const it = std::find(decorators_.begin(), decorators_.end(), decorator); | 40 auto const it = std::find(decorators_.begin(), decorators_.end(), decorator); |
| 41 DCHECK(it != decorators_.end()); | 41 DCHECK(it != decorators_.end()); |
| 42 decorators_.erase(it); | 42 decorators_.erase(it); |
| 43 } | 43 } |
| 44 | 44 |
| 45 | 45 Node* Graph::NewNode(const Operator* op, int input_count, Node* const* inputs, |
| 46 Node* Graph::NewNode(const Operator* op, int input_count, Node** inputs, | |
| 47 bool incomplete) { | 46 bool incomplete) { |
| 48 Node* node = NewNodeUnchecked(op, input_count, inputs, incomplete); | 47 Node* node = NewNodeUnchecked(op, input_count, inputs, incomplete); |
| 49 Verifier::VerifyNode(node); | 48 Verifier::VerifyNode(node); |
| 50 return node; | 49 return node; |
| 51 } | 50 } |
| 52 | 51 |
| 53 | |
| 54 Node* Graph::NewNodeUnchecked(const Operator* op, int input_count, | 52 Node* Graph::NewNodeUnchecked(const Operator* op, int input_count, |
| 55 Node** inputs, bool incomplete) { | 53 Node* const* inputs, bool incomplete) { |
| 56 Node* const node = | 54 Node* const node = |
| 57 Node::New(zone(), NextNodeId(), op, input_count, inputs, incomplete); | 55 Node::New(zone(), NextNodeId(), op, input_count, inputs, incomplete); |
| 58 Decorate(node); | 56 Decorate(node); |
| 59 return node; | 57 return node; |
| 60 } | 58 } |
| 61 | 59 |
| 62 | 60 |
| 63 Node* Graph::CloneNode(const Node* node) { | 61 Node* Graph::CloneNode(const Node* node) { |
| 64 DCHECK_NOT_NULL(node); | 62 DCHECK_NOT_NULL(node); |
| 65 Node* const clone = Node::Clone(zone(), NextNodeId(), node); | 63 Node* const clone = Node::Clone(zone(), NextNodeId(), node); |
| 66 Decorate(clone); | 64 Decorate(clone); |
| 67 return clone; | 65 return clone; |
| 68 } | 66 } |
| 69 | 67 |
| 70 | 68 |
| 71 NodeId Graph::NextNodeId() { | 69 NodeId Graph::NextNodeId() { |
| 72 NodeId const id = next_node_id_; | 70 NodeId const id = next_node_id_; |
| 73 CHECK(!base::bits::UnsignedAddOverflow32(id, 1, &next_node_id_)); | 71 CHECK(!base::bits::UnsignedAddOverflow32(id, 1, &next_node_id_)); |
| 74 return id; | 72 return id; |
| 75 } | 73 } |
| 76 | 74 |
| 77 } // namespace compiler | 75 } // namespace compiler |
| 78 } // namespace internal | 76 } // namespace internal |
| 79 } // namespace v8 | 77 } // namespace v8 |
| OLD | NEW |