| 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" |
| 11 #include "src/compiler/node-properties.h" | 11 #include "src/compiler/node-properties.h" |
| 12 #include "src/compiler/verifier.h" |
| 12 | 13 |
| 13 namespace v8 { | 14 namespace v8 { |
| 14 namespace internal { | 15 namespace internal { |
| 15 namespace compiler { | 16 namespace compiler { |
| 16 | 17 |
| 17 Graph::Graph(Zone* zone) | 18 Graph::Graph(Zone* zone) |
| 18 : zone_(zone), | 19 : zone_(zone), |
| 19 start_(nullptr), | 20 start_(nullptr), |
| 20 end_(nullptr), | 21 end_(nullptr), |
| 21 mark_max_(0), | 22 mark_max_(0), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 void Graph::RemoveDecorator(GraphDecorator* decorator) { | 39 void Graph::RemoveDecorator(GraphDecorator* decorator) { |
| 39 auto const it = std::find(decorators_.begin(), decorators_.end(), decorator); | 40 auto const it = std::find(decorators_.begin(), decorators_.end(), decorator); |
| 40 DCHECK(it != decorators_.end()); | 41 DCHECK(it != decorators_.end()); |
| 41 decorators_.erase(it); | 42 decorators_.erase(it); |
| 42 } | 43 } |
| 43 | 44 |
| 44 | 45 |
| 45 Node* Graph::NewNode(const Operator* op, int input_count, Node** inputs, | 46 Node* Graph::NewNode(const Operator* op, int input_count, Node** inputs, |
| 46 bool incomplete) { | 47 bool incomplete) { |
| 47 Node* node = NewNodeUnchecked(op, input_count, inputs, incomplete); | 48 Node* node = NewNodeUnchecked(op, input_count, inputs, incomplete); |
| 48 #ifdef DEBUG | 49 Verifier::VerifyNode(node); |
| 49 NodeProperties::Verify(node); | |
| 50 #endif // DEBUG | |
| 51 return node; | 50 return node; |
| 52 } | 51 } |
| 53 | 52 |
| 54 | 53 |
| 55 Node* Graph::NewNodeUnchecked(const Operator* op, int input_count, | 54 Node* Graph::NewNodeUnchecked(const Operator* op, int input_count, |
| 56 Node** inputs, bool incomplete) { | 55 Node** inputs, bool incomplete) { |
| 57 Node* const node = | 56 Node* const node = |
| 58 Node::New(zone(), NextNodeId(), op, input_count, inputs, incomplete); | 57 Node::New(zone(), NextNodeId(), op, input_count, inputs, incomplete); |
| 59 Decorate(node); | 58 Decorate(node); |
| 60 return node; | 59 return node; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 71 | 70 |
| 72 NodeId Graph::NextNodeId() { | 71 NodeId Graph::NextNodeId() { |
| 73 NodeId const id = next_node_id_; | 72 NodeId const id = next_node_id_; |
| 74 CHECK(!base::bits::UnsignedAddOverflow32(id, 1, &next_node_id_)); | 73 CHECK(!base::bits::UnsignedAddOverflow32(id, 1, &next_node_id_)); |
| 75 return id; | 74 return id; |
| 76 } | 75 } |
| 77 | 76 |
| 78 } // namespace compiler | 77 } // namespace compiler |
| 79 } // namespace internal | 78 } // namespace internal |
| 80 } // namespace v8 | 79 } // namespace v8 |
| OLD | NEW |