| Index: src/profile-generator.cc
|
| diff --git a/src/profile-generator.cc b/src/profile-generator.cc
|
| index 9812c26e9e410be711b567bff01a0b8b4d061163..a4767007146abc11882bdcee672fae20a64fd408 100644
|
| --- a/src/profile-generator.cc
|
| +++ b/src/profile-generator.cc
|
| @@ -2061,20 +2061,27 @@ void V8HeapExplorer::ExtractReferences(HeapObject* obj) {
|
| void V8HeapExplorer::ExtractClosureReferences(JSObject* js_obj,
|
| HeapEntry* entry) {
|
| if (js_obj->IsJSFunction()) {
|
| - HandleScope hs;
|
| JSFunction* func = JSFunction::cast(js_obj);
|
| Context* context = func->context();
|
| - ZoneScope zscope(Isolate::Current(), DELETE_ON_EXIT);
|
| - SerializedScopeInfo* serialized_scope_info =
|
| - context->closure()->shared()->scope_info();
|
| - ScopeInfo<ZoneListAllocationPolicy> zone_scope_info(serialized_scope_info);
|
| - int locals_number = zone_scope_info.NumberOfLocals();
|
| - for (int i = 0; i < locals_number; ++i) {
|
| - String* local_name = *zone_scope_info.LocalName(i);
|
| - int idx = serialized_scope_info->ContextSlotIndex(local_name, NULL);
|
| - if (idx >= 0 && idx < context->length()) {
|
| - SetClosureReference(js_obj, entry, local_name, context->get(idx));
|
| - }
|
| + ScopeInfo* scope_info = context->closure()->shared()->scope_info();
|
| +
|
| + // Add context allocated locals.
|
| + int context_locals = scope_info->NumContextLocals();
|
| + for (int i = 0; i < context_locals; ++i) {
|
| + String* local_name = scope_info->ContextLocalName(i);
|
| + int idx = Context::MIN_CONTEXT_SLOTS + i;
|
| + SetClosureReference(js_obj, entry, local_name, context->get(idx));
|
| + }
|
| +
|
| + // Add function variable.
|
| + if (scope_info->HasFunctionName()) {
|
| + String* name = scope_info->FunctionName();
|
| + int idx = Context::MIN_CONTEXT_SLOTS + context_locals;
|
| +#ifdef DEBUG
|
| + VariableMode mode;
|
| + ASSERT(idx == scope_info->FunctionContextSlotIndex(name, &mode));
|
| +#endif
|
| + SetClosureReference(js_obj, entry, name, context->get(idx));
|
| }
|
| }
|
| }
|
|
|