Chromium Code Reviews| Index: src/profile-generator.cc |
| diff --git a/src/profile-generator.cc b/src/profile-generator.cc |
| index 9812c26e9e410be711b567bff01a0b8b4d061163..e4908be6e449e3a15646f873341ad25e349e2cf3 100644 |
| --- a/src/profile-generator.cc |
| +++ b/src/profile-generator.cc |
| @@ -2064,17 +2064,22 @@ void V8HeapExplorer::ExtractClosureReferences(JSObject* js_obj, |
| 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->num_context_locals(); |
| + for (int i = 0; i < context_locals; ++i) { |
| + String* local_name = *scope_info->context_local_name(i); |
|
Kevin Millikin (Chromium)
2011/11/02 16:31:19
Not your code, but while you're cleaning this up I
Steven
2011/11/02 18:52:59
Done. However AFAICS this is the only HandleScope
|
| + 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->function_name(); |
| + int idx = Context::MIN_CONTEXT_SLOTS + context_locals; |
| + ASSERT(idx == scope_info->FunctionContextSlotIndex(name, NULL)); |
| + SetClosureReference(js_obj, entry, name, context->get(idx)); |
| } |
| } |
| } |