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

Side by Side Diff: src/compiler/js-inlining.cc

Issue 877753007: Reland "Initial switch to Chromium-style CHECK_* and DCHECK_* macros.". (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: VS201x now happy? 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/instruction-selector.cc ('k') | src/compiler/loop-peeling.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/ast.h" 5 #include "src/ast.h"
6 #include "src/ast-numbering.h" 6 #include "src/ast-numbering.h"
7 #include "src/compiler/access-builder.h" 7 #include "src/compiler/access-builder.h"
8 #include "src/compiler/ast-graph-builder.h" 8 #include "src/compiler/ast-graph-builder.h"
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/graph-inl.h" 10 #include "src/compiler/graph-inl.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 Node* unique_return = NodeProperties::GetControlInput(end_); 77 Node* unique_return = NodeProperties::GetControlInput(end_);
78 DCHECK_EQ(IrOpcode::kReturn, unique_return->opcode()); 78 DCHECK_EQ(IrOpcode::kReturn, unique_return->opcode());
79 return unique_return; 79 return unique_return;
80 } 80 }
81 81
82 // Counts JSFunction, Receiver, arguments, context but not effect, control. 82 // Counts JSFunction, Receiver, arguments, context but not effect, control.
83 size_t total_parameters() { return start_->op()->ValueOutputCount(); } 83 size_t total_parameters() { return start_->op()->ValueOutputCount(); }
84 84
85 // Counts only formal parameters. 85 // Counts only formal parameters.
86 size_t formal_parameters() { 86 size_t formal_parameters() {
87 DCHECK_GE(total_parameters(), 3); 87 DCHECK_GE(total_parameters(), 3u);
88 return total_parameters() - 3; 88 return total_parameters() - 3;
89 } 89 }
90 90
91 // Inline this graph at {call}, use {jsgraph} and its zone to create 91 // Inline this graph at {call}, use {jsgraph} and its zone to create
92 // any new nodes. 92 // any new nodes.
93 void InlineAtCall(JSGraph* jsgraph, Node* call); 93 void InlineAtCall(JSGraph* jsgraph, Node* call);
94 94
95 // Ensure that only a single return reaches the end node. 95 // Ensure that only a single return reaches the end node.
96 static void UnifyReturn(JSGraph* jsgraph); 96 static void UnifyReturn(JSGraph* jsgraph);
97 97
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 target_graph_->NewNode(original->op(), static_cast<int>(inputs.size()), 169 target_graph_->NewNode(original->op(), static_cast<int>(inputs.size()),
170 (inputs.empty() ? NULL : &inputs.front())); 170 (inputs.empty() ? NULL : &inputs.front()));
171 copies_[original->id()] = copy; 171 copies_[original->id()] = copy;
172 } 172 }
173 173
174 Node* GetCopy(Node* original) { 174 Node* GetCopy(Node* original) {
175 Node* copy = copies_[original->id()]; 175 Node* copy = copies_[original->id()];
176 if (copy == NULL) { 176 if (copy == NULL) {
177 copy = GetSentinel(original); 177 copy = GetSentinel(original);
178 } 178 }
179 DCHECK_NE(NULL, copy); 179 DCHECK(copy);
180 return copy; 180 return copy;
181 } 181 }
182 182
183 void CopyGraph() { 183 void CopyGraph() {
184 source_graph_->VisitNodeInputsFromEnd(this); 184 source_graph_->VisitNodeInputsFromEnd(this);
185 ReplaceSentinels(); 185 ReplaceSentinels();
186 } 186 }
187 187
188 const NodeVector& copies() { return copies_; } 188 const NodeVector& copies() { return copies_; }
189 189
190 private: 190 private:
191 void ReplaceSentinels() { 191 void ReplaceSentinels() {
192 for (NodeId id = 0; id < source_graph_->NodeCount(); ++id) { 192 for (NodeId id = 0; id < source_graph_->NodeCount(); ++id) {
193 Node* sentinel = sentinels_[id]; 193 Node* sentinel = sentinels_[id];
194 if (sentinel == NULL) continue; 194 if (sentinel == NULL) continue;
195 Node* copy = copies_[id]; 195 Node* copy = copies_[id];
196 DCHECK_NE(NULL, copy); 196 DCHECK(copy);
197 sentinel->ReplaceUses(copy); 197 sentinel->ReplaceUses(copy);
198 } 198 }
199 } 199 }
200 200
201 Node* GetSentinel(Node* original) { 201 Node* GetSentinel(Node* original) {
202 if (sentinels_[original->id()] == NULL) { 202 if (sentinels_[original->id()] == NULL) {
203 sentinels_[original->id()] = target_graph_->NewNode(&sentinel_op_); 203 sentinels_[original->id()] = target_graph_->NewNode(&sentinel_op_);
204 } 204 }
205 return sentinels_[original->id()]; 205 return sentinels_[original->id()];
206 } 206 }
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 } 408 }
409 } 409 }
410 } 410 }
411 411
412 inlinee.InlineAtCall(jsgraph_, call_node); 412 inlinee.InlineAtCall(jsgraph_, call_node);
413 } 413 }
414 414
415 } // namespace compiler 415 } // namespace compiler
416 } // namespace internal 416 } // namespace internal
417 } // namespace v8 417 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/instruction-selector.cc ('k') | src/compiler/loop-peeling.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698