Chromium Code Reviews| 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); |
|
yurys
2014/01/24 14:02:55
Please add STATIC_CHECK that there are no other we
|
| - } |
| + 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); |
| } |