OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/js-inlining-heuristic.h" | 5 #include "src/compiler/js-inlining-heuristic.h" |
6 | 6 |
7 #include "src/compilation-info.h" | 7 #include "src/compilation-info.h" |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/simplified-operator.h" | 10 #include "src/compiler/simplified-operator.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, num_calls), | 263 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, num_calls), |
264 num_calls + 1, calls); | 264 num_calls + 1, calls); |
265 ReplaceWithValue(node, value, effect, control); | 265 ReplaceWithValue(node, value, effect, control); |
266 | 266 |
267 // Inline the individual, cloned call sites. | 267 // Inline the individual, cloned call sites. |
268 for (int i = 0; i < num_calls; ++i) { | 268 for (int i = 0; i < num_calls; ++i) { |
269 Handle<JSFunction> function = candidate.functions[i]; | 269 Handle<JSFunction> function = candidate.functions[i]; |
270 Node* node = calls[i]; | 270 Node* node = calls[i]; |
271 Reduction const reduction = inliner_.ReduceJSCall(node); | 271 Reduction const reduction = inliner_.ReduceJSCall(node); |
272 if (reduction.Changed()) { | 272 if (reduction.Changed()) { |
| 273 // Killing the call node is not strictly necessary, but it is safer to |
| 274 // make sure we do not resurrect the node. |
| 275 node->Kill(); |
273 cumulative_count_ += function->shared()->ast_node_count(); | 276 cumulative_count_ += function->shared()->ast_node_count(); |
274 } | 277 } |
275 } | 278 } |
276 | 279 |
277 return Replace(value); | 280 return Replace(value); |
278 } | 281 } |
279 | 282 |
280 bool JSInliningHeuristic::CandidateCompare::operator()( | 283 bool JSInliningHeuristic::CandidateCompare::operator()( |
281 const Candidate& left, const Candidate& right) const { | 284 const Candidate& left, const Candidate& right) const { |
282 if (left.frequency > right.frequency) { | 285 if (left.frequency > right.frequency) { |
(...skipping 27 matching lines...) Expand all Loading... |
310 return jsgraph()->common(); | 313 return jsgraph()->common(); |
311 } | 314 } |
312 | 315 |
313 SimplifiedOperatorBuilder* JSInliningHeuristic::simplified() const { | 316 SimplifiedOperatorBuilder* JSInliningHeuristic::simplified() const { |
314 return jsgraph()->simplified(); | 317 return jsgraph()->simplified(); |
315 } | 318 } |
316 | 319 |
317 } // namespace compiler | 320 } // namespace compiler |
318 } // namespace internal | 321 } // namespace internal |
319 } // namespace v8 | 322 } // namespace v8 |
OLD | NEW |