Revision: 15731
Author:   [email protected]
Date:     Wed Jul 17 11:23:16 2013
Log:      Do not report unessential weak references in heap snapshot.

[email protected], [email protected]

Review URL: https://codereview.chromium.org/19267023
http://code.google.com/p/v8/source/detail?r=15731

Modified:
 /branches/bleeding_edge/src/heap-snapshot-generator.cc
 /branches/bleeding_edge/test/cctest/test-heap-profiler.cc

=======================================
--- /branches/bleeding_edge/src/heap-snapshot-generator.cc Wed Jul 17 06:12:48 2013 +++ /branches/bleeding_edge/src/heap-snapshot-generator.cc Wed Jul 17 11:23:16 2013
@@ -1681,13 +1681,14 @@
                                       int field_offset) {
   ASSERT(parent_entry == GetEntry(parent_obj)->index());
   HeapEntry* child_entry = GetEntry(child_obj);
-  if (child_entry != NULL) {
+  if (child_entry == NULL) return;
+  if (IsEssentialObject(child_obj)) {
     filler_->SetIndexedReference(HeapGraphEdge::kWeak,
                                  parent_entry,
                                  index,
                                  child_entry);
-    IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
   }
+  IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
 }


=======================================
--- /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Wed Jul 17 06:12:48 2013 +++ /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Wed Jul 17 11:23:16 2013
@@ -1726,27 +1726,6 @@

   CHECK(HasWeakGlobalHandle());
 }
-
-
-TEST(WeakNativeContextRefs) {
-  LocalContext env;
-  v8::HandleScope scope(env->GetIsolate());
-  v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
-
-  const v8::HeapSnapshot* snapshot =
-      heap_profiler->TakeHeapSnapshot(v8_str("weaks"));
-  CHECK(ValidateSnapshot(snapshot));
-  const v8::HeapGraphNode* gc_roots = GetNode(
-      snapshot->GetRoot(), v8::HeapGraphNode::kSynthetic, "(GC roots)");
-  CHECK_NE(NULL, gc_roots);
-  const v8::HeapGraphNode* global_handles = GetNode(
-      gc_roots, v8::HeapGraphNode::kSynthetic, "(Global handles)");
-  CHECK_NE(NULL, global_handles);
-  const v8::HeapGraphNode* native_context = GetNode(
- global_handles, v8::HeapGraphNode::kHidden, "system / NativeContext");
-  CHECK_NE(NULL, native_context);
-  CHECK(HasWeakEdge(native_context));
-}


 TEST(SfiAndJsFunctionWeakRefs) {
@@ -1763,10 +1742,10 @@
   CHECK_NE(NULL, global);
   const v8::HeapGraphNode* fun =
       GetProperty(global, v8::HeapGraphEdge::kProperty, "fun");
-  CHECK(HasWeakEdge(fun));
+  CHECK(!HasWeakEdge(fun));
   const v8::HeapGraphNode* shared =
       GetProperty(fun, v8::HeapGraphEdge::kInternal, "shared");
-  CHECK(HasWeakEdge(shared));
+  CHECK(!HasWeakEdge(shared));
 }


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to