Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index f45dd4c0f70f3e33b4efbf98a3c37db27efe19d8..592c37fea7f5938035ee143b309c4b8b98dae411 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -8953,6 +8953,24 @@ Handle<String> SeqString::Truncate(Handle<SeqString> string, int new_length) { |
} |
+AllocationSite* AllocationSite::GetLastNestedSite() { |
+ AllocationSite* current_site = this; |
+ while (current_site->nested_sites() != Smi::FromInt(0)) { |
+ current_site = AllocationSite::cast(current_site->nested_sites()); |
+ } |
+ return current_site == this ? NULL : current_site; |
+} |
+ |
+ |
+void AllocationSite::AppendNestedSite(AllocationSite* nested_site) { |
+ AllocationSite* last_nested_site = GetLastNestedSite(); |
+ AllocationSite* append_to = last_nested_site == NULL |
+ ? this |
+ : last_nested_site; |
+ append_to->set_nested_sites(nested_site); |
+} |
+ |
+ |
AllocationMemento* AllocationMemento::FindForJSObject(JSObject* object) { |
// Currently, AllocationMemento objects are only allocated immediately |
// after JSArrays in NewSpace, and detecting whether a JSArray has one |