Skip card mark when storing known null reference
We don't need to mark the gc card if storing a null reference.
Change-Id: I445db196a097ed92b67b8bf1e6b486c6fac7d08f
diff --git a/src/compiler/compiler_ir.h b/src/compiler/compiler_ir.h
index 056c308..2b2dabe 100644
--- a/src/compiler/compiler_ir.h
+++ b/src/compiler/compiler_ir.h
@@ -605,6 +605,11 @@
Low32Bits(static_cast<int64_t>(cu->constant_values[loc.orig_sreg]));
}
+static inline bool IsConstantNullRef(const CompilationUnit* cu, RegLocation loc)
+{
+ return loc.ref && loc.is_const && (ConstantValue(cu, loc) == 0);
+}
+
static inline bool MustFlushConstant(const CompilationUnit* cu, RegLocation loc)
{
DCHECK(IsConst(cu, loc));