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

Unified Diff: runtime/vm/intermediate_language_dbc.cc

Issue 2400103002: Fix DBC double comparisons for NaN. (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_dbc.cc
diff --git a/runtime/vm/intermediate_language_dbc.cc b/runtime/vm/intermediate_language_dbc.cc
index aca13bdda4f4d677e5fae7d59cca94a1699c7b3f..179f0b4e0105b225d9390c2adc0ee182f4440d49 100644
--- a/runtime/vm/intermediate_language_dbc.cc
+++ b/runtime/vm/intermediate_language_dbc.cc
@@ -454,7 +454,7 @@ static void EmitBranchOnCondition(FlowGraphCompiler* compiler,
}
} else {
ASSERT(true_condition == NEXT_IS_FALSE);
- // NEXT_IS_FALSE indicates that the preceeing test has been flipped and
+ // NEXT_IS_FALSE indicates that the preceeding test has been flipped and
// expects the false case to be in the subsequent instruction, which it
// skips if the test succeeds.
__ Jump(labels.false_label);
@@ -479,7 +479,7 @@ Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler,
condition = NEXT_IS_TRUE;
comparison = kind();
} else {
- // Flip comparision to save a jump.
+ // Flip comparison to save a jump.
condition = NEXT_IS_FALSE;
comparison = (kind() == Token::kEQ_STRICT) ? Token::kNE_STRICT
: Token::kEQ_STRICT;
@@ -1788,15 +1788,12 @@ static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler,
const Register left = locs->in(0).reg();
const Register right = locs->in(1).reg();
Token::Kind comparison = kind;
+ // For double comparisons we can't flip the condition like with smi
zra 2016/10/07 02:14:43 Can we flip for all but == and/or != ?
Florian Schneider 2016/10/07 16:49:33 As discussed offline, we could do inline assembly
+ // comparisons because of NaN which will compare false for all except !=
+ // operations.
+ // TODO(fschneider): Change the block order instead in DBC so that the
+ // false block in always the fall-through block.
Condition condition = NEXT_IS_TRUE;
- if (labels.fall_through != labels.false_label) {
- // If we aren't falling through to the false label, we can save a Jump
- // instruction in the case that the true case is the fall through by
- // flipping the sense of the test such that the instruction following the
- // test is the Jump to the false label.
- condition = NEXT_IS_FALSE;
- comparison = FlipCondition(kind);
- }
__ Emit(Bytecode::Encode(OpcodeForDoubleCondition(comparison), left, right));
return condition;
}
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698