Revision: 18907
Author:   [email protected]
Date:     Wed Jan 29 13:45:41 2014 UTC
Log:      Mark next_code_link as weak in heap profiler.

LOG=N
[email protected], [email protected]

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

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 Mon Jan 27 09:37:02 2014 UTC +++ /branches/bleeding_edge/src/heap-snapshot-generator.cc Wed Jan 29 13:45:41 2014 UTC
@@ -992,8 +992,9 @@
   }
   void VisitPointers(Object** start, Object** end) {
     for (Object** p = start; p < end; p++) {
+      ++next_index_;
       if (CheckVisitedAndUnmark(p)) continue;
- generator_->SetHiddenReference(parent_obj_, parent_, next_index_++, *p); + generator_->SetHiddenReference(parent_obj_, parent_, next_index_, *p);
     }
   }
   static void MarkVisitedField(HeapObject* obj, int offset) {
@@ -1403,6 +1404,11 @@
   SetInternalReference(code, entry,
                        "constant_pool", code->constant_pool(),
                        Code::kConstantPoolOffset);
+  if (code->kind() == Code::OPTIMIZED_FUNCTION) {
+    SetWeakReference(code, entry,
+                     "next_code_link", code->next_code_link(),
+                     Code::kNextCodeLinkOffset);
+  }
 }


@@ -1427,14 +1433,12 @@
                        AllocationSite::kTransitionInfoOffset);
   SetInternalReference(site, entry, "nested_site", site->nested_site(),
                        AllocationSite::kNestedSiteOffset);
-  SetInternalReference(site, entry, "pretenure_data",
-                       site->pretenure_data(),
-                       AllocationSite::kPretenureDataOffset);
-  SetInternalReference(site, entry, "pretenure_create_count",
-                       site->pretenure_create_count(),
-                       AllocationSite::kPretenureCreateCountOffset);
SetInternalReference(site, entry, "dependent_code", site->dependent_code(),
                        AllocationSite::kDependentCodeOffset);
+  // Do not visit weak_next as it is not visited by the StaticVisitor,
+  // and we're not very interested in weak_next field here.
+  STATIC_CHECK(AllocationSite::kWeakNextOffset >=
+               AllocationSite::BodyDescriptor::kEndOffset);
 }


=======================================
--- /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Mon Jan 27 09:37:02 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-heap-profiler.cc Wed Jan 29 13:45:41 2014 UTC
@@ -344,6 +344,15 @@
       GetProperty(lazy, v8::HeapGraphEdge::kInternal, "shared");
   CHECK_NE(NULL, lazy_code);

+  // Check that there's no strong next_code_link. There might be a weak one
+  // but might be not, so we can't check that fact.
+  const v8::HeapGraphNode* code =
+      GetProperty(compiled_code, v8::HeapGraphEdge::kInternal, "code");
+  CHECK_NE(NULL, code);
+  const v8::HeapGraphNode* next_code_link =
+      GetProperty(code, v8::HeapGraphEdge::kInternal, "code");
+  CHECK_EQ(NULL, next_code_link);
+
   // Verify that non-compiled code doesn't contain references to "x"
// literal, while compiled code does. The scope info is stored in FixedArray
   // objects attached to the SharedFunctionInfo.

--
--
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