Reviewers: yurys, loislo,
Message:
ptal
Description:
Allow arbitrary names for weak references in heap snapshots.
LOG=N
BUG=
Please review this at https://codereview.chromium.org/145353003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+24, -20 lines):
M src/heap-snapshot-generator.h
M src/heap-snapshot-generator.cc
Index: src/heap-snapshot-generator.cc
diff --git a/src/heap-snapshot-generator.cc b/src/heap-snapshot-generator.cc
index
35cfcb4f68592c138b30b24c836aa490da4a7c09..b998e83033d30de9623eac3ba6e222cfeeffc17d
100644
--- a/src/heap-snapshot-generator.cc
+++ b/src/heap-snapshot-generator.cc
@@ -1114,11 +1114,9 @@ void V8HeapExplorer::ExtractJSObjectReferences(
SetInternalReference(js_fun, entry,
"context", js_fun->context(),
JSFunction::kContextOffset);
- for (int i = JSFunction::kNonWeakFieldsEndOffset;
- i < JSFunction::kSize;
- i += kPointerSize) {
- SetWeakReference(js_fun, entry, i, *HeapObject::RawField(js_fun, i),
i);
- }
+ SetWeakReference(js_fun, entry,
+ "next_function_link", js_fun->next_function_link(),
+ JSFunction::kNextFunctionLinkOffset);
} else if (obj->IsGlobalObject()) {
GlobalObject* global_obj = GlobalObject::cast(obj);
SetInternalReference(global_obj, entry,
@@ -1180,8 +1178,13 @@ void V8HeapExplorer::ExtractContextReferences(int
entry, Context* context) {
}
#define EXTRACT_CONTEXT_FIELD(index, type, name) \
- SetInternalReference(context, entry, #name,
context->get(Context::index), \
- FixedArray::OffsetOfElementAt(Context::index));
+ if (Context::index < Context::FIRST_WEAK_SLOT) { \
+ SetInternalReference(context, entry, #name,
context->get(Context::index), \
+ FixedArray::OffsetOfElementAt(Context::index)); \
+ } else { \
+ SetWeakReference(context, entry, #name, context->get(Context::index), \
+ FixedArray::OffsetOfElementAt(Context::index)); \
+ }
EXTRACT_CONTEXT_FIELD(CLOSURE_INDEX, JSFunction, closure);
EXTRACT_CONTEXT_FIELD(PREVIOUS_INDEX, Context, previous);
EXTRACT_CONTEXT_FIELD(EXTENSION_INDEX, Object, extension);
@@ -1193,13 +1196,14 @@ void V8HeapExplorer::ExtractContextReferences(int
entry, Context* context) {
TagObject(context->runtime_context(), "(runtime context)");
TagObject(context->embedder_data(), "(context data)");
NATIVE_CONTEXT_FIELDS(EXTRACT_CONTEXT_FIELD);
+ EXTRACT_CONTEXT_FIELD(OPTIMIZED_FUNCTIONS_LIST, ,
optimized_functions_list);
+ EXTRACT_CONTEXT_FIELD(OPTIMIZED_CODE_LIST, , optimized_code_list);
+ EXTRACT_CONTEXT_FIELD(DEOPTIMIZED_CODE_LIST, , deoptimized_code_list);
+ EXTRACT_CONTEXT_FIELD(NEXT_CONTEXT_LINK, , next_context_link);
#undef EXTRACT_CONTEXT_FIELD
- for (int i = Context::FIRST_WEAK_SLOT;
- i < Context::NATIVE_CONTEXT_SLOTS;
- ++i) {
- SetWeakReference(context, entry, i, context->get(i),
- FixedArray::OffsetOfElementAt(i));
- }
+ STATIC_CHECK(Context::OPTIMIZED_FUNCTIONS_LIST ==
Context::FIRST_WEAK_SLOT);
+ STATIC_CHECK(Context::NEXT_CONTEXT_LINK + 1
+ == Context::NATIVE_CONTEXT_SLOTS);
}
}
@@ -1293,7 +1297,7 @@ void
V8HeapExplorer::ExtractSharedFunctionInfoReferences(
"optimized_code_map", shared->optimized_code_map(),
SharedFunctionInfo::kOptimizedCodeMapOffset);
SetWeakReference(obj, entry,
- 1, shared->initial_map(),
+ "initial_map", shared->initial_map(),
SharedFunctionInfo::kInitialMapOffset);
}
@@ -1823,17 +1827,17 @@ void V8HeapExplorer::SetHiddenReference(HeapObject*
parent_obj,
void V8HeapExplorer::SetWeakReference(HeapObject* parent_obj,
int parent_entry,
- int index,
+ const char* reference_name,
Object* child_obj,
int field_offset) {
ASSERT(parent_entry == GetEntry(parent_obj)->index());
HeapEntry* child_entry = GetEntry(child_obj);
if (child_entry == NULL) return;
if (IsEssentialObject(child_obj)) {
- filler_->SetIndexedReference(HeapGraphEdge::kWeak,
- parent_entry,
- index,
- child_entry);
+ filler_->SetNamedReference(HeapGraphEdge::kWeak,
+ parent_entry,
+ reference_name,
+ child_entry);
}
IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
}
Index: src/heap-snapshot-generator.h
diff --git a/src/heap-snapshot-generator.h b/src/heap-snapshot-generator.h
index
d93362f63bc1a6d61fa90792b660a1e0b9432a2a..c14fbb2108a32fb0559a3a1254bb5add2e188fb1
100644
--- a/src/heap-snapshot-generator.h
+++ b/src/heap-snapshot-generator.h
@@ -448,7 +448,7 @@ class V8HeapExplorer : public HeapEntriesAllocator {
Object* child);
void SetWeakReference(HeapObject* parent_obj,
int parent,
- int index,
+ const char* reference_name,
Object* child_obj,
int field_offset);
void SetPropertyReference(HeapObject* parent_obj,
--
--
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.