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 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 cumulative_count_ += function->shared()->ast_node_count(); | 299 cumulative_count_ += function->shared()->ast_node_count(); |
300 } | 300 } |
301 } | 301 } |
302 | 302 |
303 return Replace(value); | 303 return Replace(value); |
304 } | 304 } |
305 | 305 |
306 bool JSInliningHeuristic::CandidateCompare::operator()( | 306 bool JSInliningHeuristic::CandidateCompare::operator()( |
307 const Candidate& left, const Candidate& right) const { | 307 const Candidate& left, const Candidate& right) const { |
308 if (right.frequency.IsUnknown()) { | 308 if (right.frequency.IsUnknown()) { |
| 309 if (left.frequency.IsUnknown()) { |
| 310 // If left and right are both unknown then the ordering is indeterminate, |
| 311 // which breaks strict weak ordering requirements, so we fall back to the |
| 312 // node id as a tie breaker. |
| 313 return left.node->id() > right.node->id(); |
| 314 } |
309 return true; | 315 return true; |
310 } else if (left.frequency.IsUnknown()) { | 316 } else if (left.frequency.IsUnknown()) { |
311 return false; | 317 return false; |
312 } else if (left.frequency.value() > right.frequency.value()) { | 318 } else if (left.frequency.value() > right.frequency.value()) { |
313 return true; | 319 return true; |
314 } else if (left.frequency.value() < right.frequency.value()) { | 320 } else if (left.frequency.value() < right.frequency.value()) { |
315 return false; | 321 return false; |
316 } else { | 322 } else { |
317 return left.node->id() > right.node->id(); | 323 return left.node->id() > right.node->id(); |
318 } | 324 } |
(...skipping 23 matching lines...) Expand all Loading... |
342 return jsgraph()->common(); | 348 return jsgraph()->common(); |
343 } | 349 } |
344 | 350 |
345 SimplifiedOperatorBuilder* JSInliningHeuristic::simplified() const { | 351 SimplifiedOperatorBuilder* JSInliningHeuristic::simplified() const { |
346 return jsgraph()->simplified(); | 352 return jsgraph()->simplified(); |
347 } | 353 } |
348 | 354 |
349 } // namespace compiler | 355 } // namespace compiler |
350 } // namespace internal | 356 } // namespace internal |
351 } // namespace v8 | 357 } // namespace v8 |
OLD | NEW |