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

Unified Diff: runtime/vm/constant_propagator.cc

Issue 2433813002: Reland "Add DoubleTestOp instruction" (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 | runtime/vm/constants_dbc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/constant_propagator.cc
diff --git a/runtime/vm/constant_propagator.cc b/runtime/vm/constant_propagator.cc
index 1f5290dd6664924fac0670b65978b29a0766d424..06f8dd5ff2760de8f62cb99c60df3985ae0cd4e6 100644
--- a/runtime/vm/constant_propagator.cc
+++ b/runtime/vm/constant_propagator.cc
@@ -1168,6 +1168,27 @@ void ConstantPropagator::VisitBinaryDoubleOp(
}
+void ConstantPropagator::VisitDoubleTestOp(DoubleTestOpInstr* instr) {
+ const Object& value = instr->value()->definition()->constant_value();
+ if (value.IsInteger()) {
+ SetValue(instr, Bool::False());
+ } else if (IsIntegerOrDouble(value)) {
+ switch (instr->op_kind()) {
+ case MethodRecognizer::kDouble_getIsNaN:
+ SetValue(instr, Bool::Get(isnan(ToDouble(value))));
+ break;
+ case MethodRecognizer::kDouble_getIsInfinite:
+ SetValue(instr, Bool::Get(isinf(ToDouble(value))));
+ break;
+ default:
+ UNREACHABLE();
+ }
+ } else {
+ SetValue(instr, non_constant_);
+ }
+}
+
+
void ConstantPropagator::VisitBinaryFloat32x4Op(
BinaryFloat32x4OpInstr* instr) {
const Object& left = instr->left()->definition()->constant_value();
« no previous file with comments | « no previous file | runtime/vm/constants_dbc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698