Index: runtime/vm/object.cc |
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
index 7bae66e59fe6ac754f0b027ef312b6be49271c58..82e4ef3087bb16ae09b767ade4692b288817ec6a 100644 |
--- a/runtime/vm/object.cc |
+++ b/runtime/vm/object.cc |
@@ -10483,6 +10483,24 @@ bool Instance::IsInstanceOf(const AbstractType& other, |
} |
+bool Instance::IsIdenticalTo(const Instance& other) const { |
+ if (raw() == other.raw()) return true; |
+ if (IsInteger() && other.IsInteger()) { |
+ return Equals(other); |
+ } |
+ if (IsDouble() && other.IsDouble()) { |
+ if (Equals(other)) return true; |
+ // Check for NaN. |
+ const Double& a_double = Double::Cast(*this); |
+ const Double& b_double = Double::Cast(other); |
+ if (isnan(a_double.value()) && isnan(b_double.value())) { |
+ return true; |
+ } |
+ } |
+ return false; |
+} |
+ |
+ |
void Instance::SetNativeField(int index, intptr_t value) const { |
ASSERT(IsValidNativeIndex(index)); |
Object& native_fields = Object::Handle(*NativeFieldsAddr()); |