Index: runtime/vm/intermediate_language_dbc.cc |
diff --git a/runtime/vm/intermediate_language_dbc.cc b/runtime/vm/intermediate_language_dbc.cc |
index 91b96a7770dcea3e255de54124dee999907f86fb..ca81c461c83942f63806285fee1fff73cbc81dc3 100644 |
--- a/runtime/vm/intermediate_language_dbc.cc |
+++ b/runtime/vm/intermediate_language_dbc.cc |
@@ -40,7 +40,6 @@ DECLARE_FLAG(int, optimization_counter_threshold); |
M(DoubleToDouble) \ |
M(DoubleToFloat) \ |
M(FloatToDouble) \ |
- M(UnboxedConstant) \ |
M(MathUnary) \ |
M(MathMinMax) \ |
M(BoxInt64) \ |
@@ -308,6 +307,25 @@ EMIT_NATIVE_CODE(Constant, 0, Location::RequiresRegister()) { |
} |
+EMIT_NATIVE_CODE(UnboxedConstant, 0, Location::RequiresRegister()) { |
+ // The register allocator drops constant definitions that have no uses. |
+ if (locs()->out(0).IsInvalid()) { |
+ return; |
+ } |
+ if (representation_ != kUnboxedDouble) { |
+ Unsupported(compiler); |
+ UNREACHABLE(); |
+ } |
+ const Register result = locs()->out(0).reg(); |
+ if (Utils::DoublesBitEqual(Double::Cast(value()).value(), 0.0)) { |
+ __ BitXor(result, result, result); |
+ } else { |
+ __ LoadConstant(result, value()); |
+ __ UnboxDouble(result, result); |
+ } |
+} |
+ |
+ |
EMIT_NATIVE_CODE(Return, 1) { |
if (compiler->is_optimizing()) { |
__ Return(locs()->in(0).reg()); |