Reviewers: Mikhail Naganov (Chromium), Yury Semikhatsky, loislo,

Message:
It eliminates half of the links on gmail.com, so I'm expecting up to 2x
performance boost.

Description:
Eliminate internal and hidden links to oddballs and other non-essential objects
in heap snapshot.


Please review this at https://chromiumcodereview.appspot.com/10162005/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/profile-generator.h
  M src/profile-generator.cc


Index: src/profile-generator.cc
diff --git a/src/profile-generator.cc b/src/profile-generator.cc
index 256136d9f19923d08f145e5091d463714b6fd83c..fb0af91afddcb4756974c390a57c576c5fe05d3f 100644
--- a/src/profile-generator.cc
+++ b/src/profile-generator.cc
@@ -2461,6 +2461,21 @@ void V8HeapExplorer::SetObjectName(HeapObject* object) {
 }


+bool V8HeapExplorer::IsEssentialObject(Object* object) {
+  // We have to use raw_unchecked_* version because when the
+ // empty_*_array object itself is being processed all its inline properties
+  // are invalid and the check in empty_*_array() function would fail.
+  return object->IsHeapObject()
+      && !object->IsOddball()
+      && object != heap_->raw_unchecked_empty_byte_array()
+      && object != heap_->raw_unchecked_empty_fixed_array()
+      && object != heap_->raw_unchecked_empty_descriptor_array()
+      && object != heap_->raw_unchecked_fixed_array_map()
+      && object != heap_->raw_unchecked_global_property_cell_map()
+      && object != heap_->raw_unchecked_shared_function_info_map();
+}
+
+
 void V8HeapExplorer::SetClosureReference(HeapObject* parent_obj,
                                          HeapEntry* parent_entry,
                                          String* reference_name,
@@ -2516,10 +2531,7 @@ void V8HeapExplorer::SetInternalReference(HeapObject* parent_obj,
                                           int field_offset) {
   HeapEntry* child_entry = GetEntry(child_obj);
   if (child_entry == NULL) return;
-  // We have to use raw_unchecked_* version because when the
-  // empty_fixed_array itself is being processed all its inline properties
-  // are invalid and the check in empty_fixed_array() function fails.
-  if (child_obj != heap_->raw_unchecked_empty_fixed_array()) {
+  if (IsEssentialObject(child_obj)) {
     filler_->SetNamedReference(HeapGraphEdge::kInternal,
                                parent_obj, parent_entry,
                                reference_name,
@@ -2536,8 +2548,7 @@ void V8HeapExplorer::SetInternalReference(HeapObject* parent_obj,
                                           int field_offset) {
   HeapEntry* child_entry = GetEntry(child_obj);
   if (child_entry == NULL) return;
-  // See the comment regarding raw_unchecked_* above.
-  if (child_obj != heap_->raw_unchecked_empty_fixed_array()) {
+  if (IsEssentialObject(child_obj)) {
     filler_->SetNamedReference(HeapGraphEdge::kInternal,
                                parent_obj, parent_entry,
                                collection_->names()->GetName(index),
@@ -2552,7 +2563,7 @@ void V8HeapExplorer::SetHiddenReference(HeapObject* parent_obj,
                                         int index,
                                         Object* child_obj) {
   HeapEntry* child_entry = GetEntry(child_obj);
-  if (child_entry != NULL) {
+  if (child_entry != NULL && IsEssentialObject(child_obj)) {
     filler_->SetIndexedReference(HeapGraphEdge::kHidden,
                                  parent_obj,
                                  parent_entry,
@@ -2692,11 +2703,7 @@ const char* V8HeapExplorer::GetStrongGcSubrootName(Object* object) {


 void V8HeapExplorer::TagObject(Object* obj, const char* tag) {
-  if (obj->IsHeapObject() &&
-      !obj->IsOddball() &&
-      obj != heap_->raw_unchecked_empty_byte_array() &&
-      obj != heap_->raw_unchecked_empty_fixed_array() &&
-      obj != heap_->raw_unchecked_empty_descriptor_array()) {
+  if (IsEssentialObject(obj)) {
     objects_tags_.SetTag(obj, tag);
   }
 }
Index: src/profile-generator.h
diff --git a/src/profile-generator.h b/src/profile-generator.h
index aee741f1d2e27690036d141ac2a67ca644bb7335..3b748e234f1823644325c6c2ef6ec069341ada66 100644
--- a/src/profile-generator.h
+++ b/src/profile-generator.h
@@ -980,6 +980,7 @@ class V8HeapExplorer : public HeapEntriesAllocator {
   void ExtractPropertyReferences(JSObject* js_obj, HeapEntry* entry);
   void ExtractElementReferences(JSObject* js_obj, HeapEntry* entry);
   void ExtractInternalReferences(JSObject* js_obj, HeapEntry* entry);
+  bool IsEssentialObject(Object* object);
   void SetClosureReference(HeapObject* parent_obj,
                            HeapEntry* parent,
                            String* reference_name,


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to