Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(826)

Side by Side Diff: src/compiler/graph.cc

Issue 897883002: [turbofan]: Improved source position information (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/graph.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11
12 namespace v8 { 12 namespace v8 {
13 namespace internal { 13 namespace internal {
14 namespace compiler { 14 namespace compiler {
15 15
16 Graph::Graph(Zone* zone) 16 Graph::Graph(Zone* zone)
17 : zone_(zone), 17 : zone_(zone),
18 start_(nullptr), 18 start_(nullptr),
19 end_(nullptr), 19 end_(nullptr),
20 mark_max_(0), 20 mark_max_(0),
21 next_node_id_(0), 21 next_node_id_(0),
22 decorators_(zone) {} 22 decorators_(zone) {}
23 23
24 24
25 void Graph::Decorate(Node* node) { 25 void Graph::Decorate(Node* node, bool incomplete) {
26 for (auto const decorator : decorators_) decorator->Decorate(node); 26 for (auto const decorator : decorators_) {
27 decorator->Decorate(node, incomplete);
28 }
27 } 29 }
28 30
29 31
30 void Graph::AddDecorator(GraphDecorator* decorator) { 32 void Graph::AddDecorator(GraphDecorator* decorator) {
31 decorators_.push_back(decorator); 33 decorators_.push_back(decorator);
32 } 34 }
33 35
34 36
35 void Graph::RemoveDecorator(GraphDecorator* decorator) { 37 void Graph::RemoveDecorator(GraphDecorator* decorator) {
36 auto const it = std::find(decorators_.begin(), decorators_.end(), decorator); 38 auto const it = std::find(decorators_.begin(), decorators_.end(), decorator);
37 DCHECK(it != decorators_.end()); 39 DCHECK(it != decorators_.end());
38 decorators_.erase(it); 40 decorators_.erase(it);
39 } 41 }
40 42
41 43
42 Node* Graph::NewNode(const Operator* op, int input_count, Node** inputs, 44 Node* Graph::NewNode(const Operator* op, int input_count, Node** inputs,
43 bool incomplete) { 45 bool incomplete) {
44 DCHECK_LE(op->ValueInputCount(), input_count); 46 DCHECK_LE(op->ValueInputCount(), input_count);
45 Node* const node = 47 Node* const node =
46 Node::New(zone(), NextNodeId(), op, input_count, inputs, incomplete); 48 Node::New(zone(), NextNodeId(), op, input_count, inputs, incomplete);
47 if (!incomplete) Decorate(node); 49 Decorate(node, incomplete);
48 return node; 50 return node;
49 } 51 }
50 52
51 53
52 NodeId Graph::NextNodeId() { 54 NodeId Graph::NextNodeId() {
53 NodeId const id = next_node_id_; 55 NodeId const id = next_node_id_;
54 CHECK(!base::bits::SignedAddOverflow32(id, 1, &next_node_id_)); 56 CHECK(!base::bits::SignedAddOverflow32(id, 1, &next_node_id_));
55 return id; 57 return id;
56 } 58 }
57 59
58 } // namespace compiler 60 } // namespace compiler
59 } // namespace internal 61 } // namespace internal
60 } // namespace v8 62 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/graph.h ('k') | src/compiler/pipeline.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698