Commit 09954144 authored by alph's avatar alph Committed by Commit bot

Remove non essential weak next_* links from the heap snapshot.

Remove the 'next' link for Code, JSFunction, and Context.

Review-Url: https://codereview.chromium.org/2209673002
Cr-Commit-Position: refs/heads/master@{#38303}
parent 827b1f41
...@@ -1132,9 +1132,6 @@ void V8HeapExplorer::ExtractJSObjectReferences( ...@@ -1132,9 +1132,6 @@ void V8HeapExplorer::ExtractJSObjectReferences(
SetInternalReference(js_fun, entry, SetInternalReference(js_fun, entry,
"context", js_fun->context(), "context", js_fun->context(),
JSFunction::kContextOffset); JSFunction::kContextOffset);
SetWeakReference(js_fun, entry,
"next_function_link", js_fun->next_function_link(),
JSFunction::kNextFunctionLinkOffset);
// Ensure no new weak references appeared in JSFunction. // Ensure no new weak references appeared in JSFunction.
STATIC_ASSERT(JSFunction::kCodeEntryOffset == STATIC_ASSERT(JSFunction::kCodeEntryOffset ==
JSFunction::kNonWeakFieldsEndOffset); JSFunction::kNonWeakFieldsEndOffset);
...@@ -1249,7 +1246,6 @@ void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) { ...@@ -1249,7 +1246,6 @@ void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) {
optimized_functions_list); optimized_functions_list);
EXTRACT_CONTEXT_FIELD(OPTIMIZED_CODE_LIST, unused, optimized_code_list); EXTRACT_CONTEXT_FIELD(OPTIMIZED_CODE_LIST, unused, optimized_code_list);
EXTRACT_CONTEXT_FIELD(DEOPTIMIZED_CODE_LIST, unused, deoptimized_code_list); EXTRACT_CONTEXT_FIELD(DEOPTIMIZED_CODE_LIST, unused, deoptimized_code_list);
EXTRACT_CONTEXT_FIELD(NEXT_CONTEXT_LINK, unused, next_context_link);
#undef EXTRACT_CONTEXT_FIELD #undef EXTRACT_CONTEXT_FIELD
STATIC_ASSERT(Context::OPTIMIZED_FUNCTIONS_LIST == STATIC_ASSERT(Context::OPTIMIZED_FUNCTIONS_LIST ==
Context::FIRST_WEAK_SLOT); Context::FIRST_WEAK_SLOT);
...@@ -1455,18 +1451,12 @@ void V8HeapExplorer::ExtractCodeReferences(int entry, Code* code) { ...@@ -1455,18 +1451,12 @@ void V8HeapExplorer::ExtractCodeReferences(int entry, Code* code) {
code->source_position_table(), code->source_position_table(),
Code::kSourcePositionTableOffset); Code::kSourcePositionTableOffset);
if (code->kind() == Code::FUNCTION) { if (code->kind() == Code::FUNCTION) {
SetInternalReference(code, entry, SetInternalReference(code, entry, "type_feedback_info",
"type_feedback_info", code->type_feedback_info(), code->type_feedback_info(),
Code::kTypeFeedbackInfoOffset); Code::kTypeFeedbackInfoOffset);
} }
SetInternalReference(code, entry, SetInternalReference(code, entry, "gc_metadata", code->gc_metadata(),
"gc_metadata", code->gc_metadata(),
Code::kGCMetadataOffset); Code::kGCMetadataOffset);
if (code->kind() == Code::OPTIMIZED_FUNCTION) {
SetWeakReference(code, entry,
"next_code_link", code->next_code_link(),
Code::kNextCodeLinkOffset);
}
} }
void V8HeapExplorer::ExtractBoxReferences(int entry, Box* box) { void V8HeapExplorer::ExtractBoxReferences(int entry, Box* box) {
...@@ -1841,11 +1831,16 @@ bool V8HeapExplorer::IsEssentialHiddenReference(Object* parent, ...@@ -1841,11 +1831,16 @@ bool V8HeapExplorer::IsEssentialHiddenReference(Object* parent,
if (parent->IsAllocationSite() && if (parent->IsAllocationSite() &&
field_offset == AllocationSite::kWeakNextOffset) field_offset == AllocationSite::kWeakNextOffset)
return false; return false;
if (parent->IsJSFunction() &&
field_offset == JSFunction::kNextFunctionLinkOffset)
return false;
if (parent->IsCode() && field_offset == Code::kNextCodeLinkOffset)
return false;
if (parent->IsContext() &&
field_offset == Context::OffsetOfElementAt(Context::NEXT_CONTEXT_LINK))
return false;
if (parent->IsWeakCell() && field_offset == WeakCell::kNextOffset) if (parent->IsWeakCell() && field_offset == WeakCell::kNextOffset)
return false; return false;
// TODO(ulan): JSFunction, Code, and Context also have next weak link, which
// is non-essential. Currently they are handled as normal weak links.
// Move them here.
return true; return true;
} }
...@@ -1944,11 +1939,9 @@ void V8HeapExplorer::SetHiddenReference(HeapObject* parent_obj, ...@@ -1944,11 +1939,9 @@ void V8HeapExplorer::SetHiddenReference(HeapObject* parent_obj,
Object* child_obj, int field_offset) { Object* child_obj, int field_offset) {
DCHECK(parent_entry == GetEntry(parent_obj)->index()); DCHECK(parent_entry == GetEntry(parent_obj)->index());
HeapEntry* child_entry = GetEntry(child_obj); HeapEntry* child_entry = GetEntry(child_obj);
if (child_entry != NULL && IsEssentialObject(child_obj) && if (child_entry != nullptr && IsEssentialObject(child_obj) &&
IsEssentialHiddenReference(parent_obj, field_offset)) { IsEssentialHiddenReference(parent_obj, field_offset)) {
filler_->SetIndexedReference(HeapGraphEdge::kHidden, filler_->SetIndexedReference(HeapGraphEdge::kHidden, parent_entry, index,
parent_entry,
index,
child_entry); child_entry);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment