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/codegen/arm/int_arm.cc b/src/compiler/codegen/arm/int_arm.cc
index 5a9786c..d908bf5 100644
--- a/src/compiler/codegen/arm/int_arm.cc
+++ b/src/compiler/codegen/arm/int_arm.cc
@@ -457,7 +457,7 @@
RegLocation rl_object = LoadValue(cu, rl_src_obj, kCoreReg);
RegLocation rl_new_value = LoadValue(cu, rl_src_new_value, kCoreReg);
- if (need_write_barrier) {
+ if (need_write_barrier && !IsConstantNullRef(cu, rl_new_value)) {
// Mark card for object assuming new value is stored.
MarkGCCard(cu, rl_new_value.low_reg, rl_object.low_reg);
}
@@ -946,7 +946,9 @@
StoreBaseIndexed(cu, r_ptr, r_index, r_value, scale, kWord);
FreeTemp(cu, r_ptr);
FreeTemp(cu, r_index);
- MarkGCCard(cu, r_value, r_array);
+ if (!IsConstantNullRef(cu, rl_src)) {
+ MarkGCCard(cu, r_value, r_array);
+ }
}
bool ArmCodegen::GenShiftImmOpLong(CompilationUnit* cu, Instruction::Code opcode,