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

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: 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') | src/serialize.cc » ('J')
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..d304b8d6170d21ab8ed93fadf7a8e0a8d35ebde9 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -6580,6 +6580,31 @@ 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);
+ // With canonical being a string, the LSB is set. Interpreted as hash code,
+ // this means that the hash code uninitialized. We use this for distinction.
+ ASSERT(!HasHashCode());
mvstanton 2014/07/22 13:31:31 How about words along this line? "Setting a tagge
Yang 2014/07/23 06:55:58 Done.
+}
+
+
+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') | src/serialize.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698