Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Unified Diff: runtime/vm/object.cc

Issue 2351613005: VM: Fix canonicalization of old-space allocated instances (Closed)
Patch Set: fixes Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/isolate.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 372a10fd041f635dacfd93fab3501a181773df20..21b4366394f74bae4157d03c988fff5d20f04e7c 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -15511,11 +15511,11 @@ RawInstance* Instance::CheckAndCanonicalize(Thread* thread,
const Class& cls = Class::Handle(zone, this->clazz());
{
SafepointMutexLocker ml(isolate->constant_canonicalization_mutex());
+ result ^= cls.LookupCanonicalInstance(zone, *this);
+ if (!result.IsNull()) {
+ return result.raw();
+ }
if (IsNew()) {
- result ^= cls.LookupCanonicalInstance(zone, *this);
- if (!result.IsNull()) {
- return result.raw();
- }
ASSERT((isolate == Dart::vm_isolate()) || !InVMHeap());
// Create a canonical object in old space.
result ^= Object::Clone(*this, Heap::kOld);
@@ -15537,12 +15537,6 @@ bool Instance::CheckIsCanonical(Thread* thread) const {
const Class& cls = Class::Handle(zone, this->clazz());
SafepointMutexLocker ml(isolate->constant_canonicalization_mutex());
result ^= cls.LookupCanonicalInstance(zone, *this);
- // TODO(johnmccutchan) : Temporary workaround for issue (26988).
- if ((result.raw() != raw()) &&
- isolate->HasAttemptedReload() &&
- (GetClassId() == kImmutableArrayCid)) {
- return true;
- }
return (result.raw() == this->raw());
}
#endif // DEBUG
@@ -21588,6 +21582,7 @@ bool Array::CanonicalizeEquals(const Instance& other) const {
uword Array::ComputeCanonicalTableHash() const {
ASSERT(!IsNull());
+ NoSafepointScope no_safepoint;
intptr_t len = Length();
uword hash = len;
uword value = reinterpret_cast<uword>(GetTypeArguments());
« no previous file with comments | « runtime/vm/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698