Commit 58ba4cef authored by brucedawson's avatar brucedawson Committed by Commit bot

Enforce strict weak ordering on NaN frequencies

In crrev.com/2856103002 sentinel frequency values were introduced, using
NaN as the sentinel. However the comparison function was not *fully*
updated to support these - comparing two NaNs would give ambiguous
results. This caused test failures when building with VS 2017, probably
because of subtle changes in the arrangement of nodes in the tree.

This change uses the the node ID to break ties. An alternative would be
to use a non-NaN sentinel value.

R=bmeurer@chromium.org
BUG=chromium:722480

Review-Url: https://codereview.chromium.org/2894433004
Cr-Commit-Position: refs/heads/master@{#45415}
parent d652d06f
...@@ -306,6 +306,12 @@ Reduction JSInliningHeuristic::InlineCandidate(Candidate const& candidate) { ...@@ -306,6 +306,12 @@ Reduction JSInliningHeuristic::InlineCandidate(Candidate const& candidate) {
bool JSInliningHeuristic::CandidateCompare::operator()( bool JSInliningHeuristic::CandidateCompare::operator()(
const Candidate& left, const Candidate& right) const { const Candidate& left, const Candidate& right) const {
if (right.frequency.IsUnknown()) { if (right.frequency.IsUnknown()) {
if (left.frequency.IsUnknown()) {
// If left and right are both unknown then the ordering is indeterminate,
// which breaks strict weak ordering requirements, so we fall back to the
// node id as a tie breaker.
return left.node->id() > right.node->id();
}
return true; return true;
} else if (left.frequency.IsUnknown()) { } else if (left.frequency.IsUnknown()) {
return false; return false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment