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

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

Issue 888613002: Initial switch to Chromium-style CHECK_* and DCHECK_* macros. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix slow dchecks. 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
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/node.h" 5 #include "src/compiler/node.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
(...skipping 21 matching lines...) Expand all
32 use->from = result; 32 use->from = result;
33 to->AppendUse(use); 33 to->AppendUse(use);
34 ++use; 34 ++use;
35 ++input; 35 ++input;
36 } 36 }
37 return result; 37 return result;
38 } 38 }
39 39
40 40
41 void Node::Kill() { 41 void Node::Kill() {
42 DCHECK_NOT_NULL(op()); 42 DCHECK(op());
43 RemoveAllInputs(); 43 RemoveAllInputs();
44 DCHECK(uses().empty()); 44 DCHECK(uses().empty());
45 } 45 }
46 46
47 47
48 void Node::AppendInput(Zone* zone, Node* new_to) { 48 void Node::AppendInput(Zone* zone, Node* new_to) {
49 DCHECK_NOT_NULL(zone); 49 DCHECK(zone);
50 DCHECK_NOT_NULL(new_to); 50 DCHECK(new_to);
51 Use* new_use = new (zone) Use; 51 Use* new_use = new (zone) Use;
52 Input new_input; 52 Input new_input;
53 new_input.to = new_to; 53 new_input.to = new_to;
54 new_input.use = new_use; 54 new_input.use = new_use;
55 if (reserved_input_count() > 0) { 55 if (reserved_input_count() > 0) {
56 DCHECK(!has_appendable_inputs()); 56 DCHECK(!has_appendable_inputs());
57 set_reserved_input_count(reserved_input_count() - 1); 57 set_reserved_input_count(reserved_input_count() - 1);
58 inputs_.static_[input_count()] = new_input; 58 inputs_.static_[input_count()] = new_input;
59 } else { 59 } else {
60 EnsureAppendableInputs(zone); 60 EnsureAppendableInputs(zone);
61 inputs_.appendable_->push_back(new_input); 61 inputs_.appendable_->push_back(new_input);
62 } 62 }
63 new_use->input_index = input_count(); 63 new_use->input_index = input_count();
64 new_use->from = this; 64 new_use->from = this;
65 new_to->AppendUse(new_use); 65 new_to->AppendUse(new_use);
66 set_input_count(input_count() + 1); 66 set_input_count(input_count() + 1);
67 } 67 }
68 68
69 69
70 void Node::InsertInput(Zone* zone, int index, Node* new_to) { 70 void Node::InsertInput(Zone* zone, int index, Node* new_to) {
71 DCHECK_NOT_NULL(zone); 71 DCHECK(zone);
72 DCHECK_LE(0, index); 72 DCHECK_LE(0, index);
73 DCHECK_LT(index, InputCount()); 73 DCHECK_LT(index, InputCount());
74 AppendInput(zone, InputAt(InputCount() - 1)); 74 AppendInput(zone, InputAt(InputCount() - 1));
75 for (int i = InputCount() - 1; i > index; --i) { 75 for (int i = InputCount() - 1; i > index; --i) {
76 ReplaceInput(i, InputAt(i - 1)); 76 ReplaceInput(i, InputAt(i - 1));
77 } 77 }
78 ReplaceInput(index, new_to); 78 ReplaceInput(index, new_to);
79 } 79 }
80 80
81 81
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 return use->from; 128 return use->from;
129 } 129 }
130 130
131 131
132 void Node::ReplaceUses(Node* replace_to) { 132 void Node::ReplaceUses(Node* replace_to) {
133 for (Use* use = first_use_; use; use = use->next) { 133 for (Use* use = first_use_; use; use = use->next) {
134 use->from->GetInputRecordPtr(use->input_index)->to = replace_to; 134 use->from->GetInputRecordPtr(use->input_index)->to = replace_to;
135 } 135 }
136 if (!replace_to->last_use_) { 136 if (!replace_to->last_use_) {
137 DCHECK_EQ(nullptr, replace_to->first_use_); 137 DCHECK(!replace_to->first_use_);
138 replace_to->first_use_ = first_use_; 138 replace_to->first_use_ = first_use_;
139 replace_to->last_use_ = last_use_; 139 replace_to->last_use_ = last_use_;
140 } else if (first_use_) { 140 } else if (first_use_) {
141 DCHECK_NOT_NULL(replace_to->first_use_); 141 DCHECK(replace_to->first_use_);
142 replace_to->last_use_->next = first_use_; 142 replace_to->last_use_->next = first_use_;
143 first_use_->prev = replace_to->last_use_; 143 first_use_->prev = replace_to->last_use_;
144 replace_to->last_use_ = last_use_; 144 replace_to->last_use_ = last_use_;
145 } 145 }
146 first_use_ = nullptr; 146 first_use_ = nullptr;
147 last_use_ = nullptr; 147 last_use_ = nullptr;
148 } 148 }
149 149
150 150
151 void Node::Input::Update(Node* new_to) { 151 void Node::Input::Update(Node* new_to) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 ++(*this); 267 ++(*this);
268 return result; 268 return result;
269 } 269 }
270 270
271 271
272 bool Node::Uses::empty() const { return begin() == end(); } 272 bool Node::Uses::empty() const { return begin() == end(); }
273 273
274 } // namespace compiler 274 } // namespace compiler
275 } // namespace internal 275 } // namespace internal
276 } // namespace v8 276 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698