| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1986 SetInternalReference(obj, entry, "map", obj->map(), HeapObject::kMapOffset); | 1986 SetInternalReference(obj, entry, "map", obj->map(), HeapObject::kMapOffset); |
| 1987 IndexedReferencesExtractor refs_extractor(this, obj, entry); | 1987 IndexedReferencesExtractor refs_extractor(this, obj, entry); |
| 1988 obj->Iterate(&refs_extractor); | 1988 obj->Iterate(&refs_extractor); |
| 1989 } | 1989 } |
| 1990 } | 1990 } |
| 1991 | 1991 |
| 1992 | 1992 |
| 1993 void V8HeapExplorer::ExtractClosureReferences(JSObject* js_obj, | 1993 void V8HeapExplorer::ExtractClosureReferences(JSObject* js_obj, |
| 1994 HeapEntry* entry) { | 1994 HeapEntry* entry) { |
| 1995 if (js_obj->IsJSFunction()) { | 1995 if (js_obj->IsJSFunction()) { |
| 1996 HandleScope hs; | 1996 HandleScope hs(heap_->isolate()); |
| 1997 JSFunction* func = JSFunction::cast(js_obj); | 1997 JSFunction* func = JSFunction::cast(js_obj); |
| 1998 Context* context = func->context(); | 1998 Context* context = func->context(); |
| 1999 ZoneScope zscope(Isolate::Current(), DELETE_ON_EXIT); | 1999 ZoneScope zscope(Isolate::Current(), DELETE_ON_EXIT); |
| 2000 SerializedScopeInfo* serialized_scope_info = | 2000 SerializedScopeInfo* serialized_scope_info = |
| 2001 context->closure()->shared()->scope_info(); | 2001 context->closure()->shared()->scope_info(); |
| 2002 ScopeInfo<ZoneListAllocationPolicy> zone_scope_info(serialized_scope_info); | 2002 ScopeInfo<ZoneListAllocator> zone_scope_info( |
| 2003 serialized_scope_info, |
| 2004 ZoneListAllocator(heap_->isolate()->zone())); |
| 2003 int locals_number = zone_scope_info.NumberOfLocals(); | 2005 int locals_number = zone_scope_info.NumberOfLocals(); |
| 2004 for (int i = 0; i < locals_number; ++i) { | 2006 for (int i = 0; i < locals_number; ++i) { |
| 2005 String* local_name = *zone_scope_info.LocalName(i); | 2007 String* local_name = *zone_scope_info.LocalName(i); |
| 2006 int idx = serialized_scope_info->ContextSlotIndex(local_name, NULL); | 2008 int idx = serialized_scope_info->ContextSlotIndex(local_name, NULL); |
| 2007 if (idx >= 0 && idx < context->length()) { | 2009 if (idx >= 0 && idx < context->length()) { |
| 2008 SetClosureReference(js_obj, entry, local_name, context->get(idx)); | 2010 SetClosureReference(js_obj, entry, local_name, context->get(idx)); |
| 2009 } | 2011 } |
| 2010 } | 2012 } |
| 2011 } | 2013 } |
| 2012 } | 2014 } |
| (...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3250 sorted_entries->Sort(SortUsingEntryValue); | 3252 sorted_entries->Sort(SortUsingEntryValue); |
| 3251 } | 3253 } |
| 3252 | 3254 |
| 3253 | 3255 |
| 3254 String* GetConstructorNameForHeapProfile(JSObject* object) { | 3256 String* GetConstructorNameForHeapProfile(JSObject* object) { |
| 3255 if (object->IsJSFunction()) return HEAP->closure_symbol(); | 3257 if (object->IsJSFunction()) return HEAP->closure_symbol(); |
| 3256 return object->constructor_name(); | 3258 return object->constructor_name(); |
| 3257 } | 3259 } |
| 3258 | 3260 |
| 3259 } } // namespace v8::internal | 3261 } } // namespace v8::internal |
| OLD | NEW |