Implement Reference.refersTo() intrinsic.
Test: Added tests to 122-npe and 160-read-barrier-stress
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: run-gtests.sh
Test: testrunner.py --target --optimizing
Bug: 172573708
Change-Id: I8342510565289058df218d3249ffac1eb993ca4f
diff --git a/compiler/optimizing/nodes.cc b/compiler/optimizing/nodes.cc
index e815474..4bb7ffc 100644
--- a/compiler/optimizing/nodes.cc
+++ b/compiler/optimizing/nodes.cc
@@ -3199,6 +3199,19 @@
}
}
+bool HInvokeVirtual::CanDoImplicitNullCheckOn(HInstruction* obj) const {
+ if (obj != InputAt(0)) {
+ return false;
+ }
+ switch (GetIntrinsic()) {
+ case Intrinsics::kReferenceRefersTo:
+ return true;
+ default:
+ // TODO: Add implicit null checks in more intrinsics.
+ return false;
+ }
+}
+
bool HLoadClass::InstructionDataEquals(const HInstruction* other) const {
const HLoadClass* other_load_class = other->AsLoadClass();
// TODO: To allow GVN for HLoadClass from different dex files, we should compare the type