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

Unified Diff: src/objects-inl.h

Issue 411483002: Correctly hook up back references to internalized strings in code deserializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: edited comment Created 6 years, 5 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 | « src/objects.h ('k') | src/serialize.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 0aca5cfcdb488b0718af22d18c95afc69a17da19..36e7eb1758769709f12c17d6abf609f422dd9359 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -6580,6 +6580,32 @@ bool String::AsArrayIndex(uint32_t* index) {
}
+void String::SetForwardedInternalizedString(String* canonical) {
+ ASSERT(IsInternalizedString());
+ ASSERT(HasHashCode());
+ if (canonical == this) return; // No need to forward.
+ ASSERT(SlowEquals(canonical));
+ ASSERT(canonical->IsInternalizedString());
+ ASSERT(canonical->HasHashCode());
+ WRITE_FIELD(this, kHashFieldOffset, canonical);
+ // Setting the hash field to a tagged value sets the LSB, causing the hash
+ // code to be interpreted as uninitialized. We use this fact to recognize
+ // that we have a forwarded string.
+ ASSERT(!HasHashCode());
+}
+
+
+String* String::GetForwardedInternalizedString() {
+ ASSERT(IsInternalizedString());
+ if (HasHashCode()) return this;
+ String* canonical = String::cast(READ_FIELD(this, kHashFieldOffset));
+ ASSERT(canonical->IsInternalizedString());
+ ASSERT(SlowEquals(canonical));
+ ASSERT(canonical->HasHashCode());
+ return canonical;
+}
+
+
Object* JSReceiver::GetConstructor() {
return map()->constructor();
}
« no previous file with comments | « src/objects.h ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698