| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1704 return AddEntry(object, | 1704 return AddEntry(object, |
| 1705 HeapEntry::kCode, | 1705 HeapEntry::kCode, |
| 1706 collection_->names()->GetName(name)); | 1706 collection_->names()->GetName(name)); |
| 1707 } else if (object->IsScript()) { | 1707 } else if (object->IsScript()) { |
| 1708 Object* name = Script::cast(object)->name(); | 1708 Object* name = Script::cast(object)->name(); |
| 1709 return AddEntry(object, | 1709 return AddEntry(object, |
| 1710 HeapEntry::kCode, | 1710 HeapEntry::kCode, |
| 1711 name->IsString() | 1711 name->IsString() |
| 1712 ? collection_->names()->GetName(String::cast(name)) | 1712 ? collection_->names()->GetName(String::cast(name)) |
| 1713 : ""); | 1713 : ""); |
| 1714 } else if (object->IsGlobalContext()) { | 1714 } else if (object->IsNativeContext()) { |
| 1715 return AddEntry(object, HeapEntry::kHidden, "system / GlobalContext"); | 1715 return AddEntry(object, HeapEntry::kHidden, "system / NativeContext"); |
| 1716 } else if (object->IsContext()) { | 1716 } else if (object->IsContext()) { |
| 1717 return AddEntry(object, HeapEntry::kHidden, "system / Context"); | 1717 return AddEntry(object, HeapEntry::kHidden, "system / Context"); |
| 1718 } else if (object->IsFixedArray() || | 1718 } else if (object->IsFixedArray() || |
| 1719 object->IsFixedDoubleArray() || | 1719 object->IsFixedDoubleArray() || |
| 1720 object->IsByteArray() || | 1720 object->IsByteArray() || |
| 1721 object->IsExternalArray()) { | 1721 object->IsExternalArray()) { |
| 1722 return AddEntry(object, HeapEntry::kArray, ""); | 1722 return AddEntry(object, HeapEntry::kArray, ""); |
| 1723 } else if (object->IsHeapNumber()) { | 1723 } else if (object->IsHeapNumber()) { |
| 1724 return AddEntry(object, HeapEntry::kHeapNumber, "number"); | 1724 return AddEntry(object, HeapEntry::kHeapNumber, "number"); |
| 1725 } | 1725 } |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1939 i < JSFunction::kSize; | 1939 i < JSFunction::kSize; |
| 1940 i += kPointerSize) { | 1940 i += kPointerSize) { |
| 1941 SetWeakReference(js_fun, entry, i, *HeapObject::RawField(js_fun, i), i); | 1941 SetWeakReference(js_fun, entry, i, *HeapObject::RawField(js_fun, i), i); |
| 1942 } | 1942 } |
| 1943 } else if (obj->IsGlobalObject()) { | 1943 } else if (obj->IsGlobalObject()) { |
| 1944 GlobalObject* global_obj = GlobalObject::cast(obj); | 1944 GlobalObject* global_obj = GlobalObject::cast(obj); |
| 1945 SetInternalReference(global_obj, entry, | 1945 SetInternalReference(global_obj, entry, |
| 1946 "builtins", global_obj->builtins(), | 1946 "builtins", global_obj->builtins(), |
| 1947 GlobalObject::kBuiltinsOffset); | 1947 GlobalObject::kBuiltinsOffset); |
| 1948 SetInternalReference(global_obj, entry, | 1948 SetInternalReference(global_obj, entry, |
| 1949 "global_context", global_obj->global_context(), | 1949 "native_context", global_obj->native_context(), |
| 1950 GlobalObject::kGlobalContextOffset); | 1950 GlobalObject::kNativeContextOffset); |
| 1951 SetInternalReference(global_obj, entry, | 1951 SetInternalReference(global_obj, entry, |
| 1952 "global_receiver", global_obj->global_receiver(), | 1952 "global_receiver", global_obj->global_receiver(), |
| 1953 GlobalObject::kGlobalReceiverOffset); | 1953 GlobalObject::kGlobalReceiverOffset); |
| 1954 } | 1954 } |
| 1955 TagObject(js_obj->properties(), "(object properties)"); | 1955 TagObject(js_obj->properties(), "(object properties)"); |
| 1956 SetInternalReference(obj, entry, | 1956 SetInternalReference(obj, entry, |
| 1957 "properties", js_obj->properties(), | 1957 "properties", js_obj->properties(), |
| 1958 JSObject::kPropertiesOffset); | 1958 JSObject::kPropertiesOffset); |
| 1959 TagObject(js_obj->elements(), "(object elements)"); | 1959 TagObject(js_obj->elements(), "(object elements)"); |
| 1960 SetInternalReference(obj, entry, | 1960 SetInternalReference(obj, entry, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1976 | 1976 |
| 1977 | 1977 |
| 1978 void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) { | 1978 void V8HeapExplorer::ExtractContextReferences(int entry, Context* context) { |
| 1979 #define EXTRACT_CONTEXT_FIELD(index, type, name) \ | 1979 #define EXTRACT_CONTEXT_FIELD(index, type, name) \ |
| 1980 SetInternalReference(context, entry, #name, context->get(Context::index), \ | 1980 SetInternalReference(context, entry, #name, context->get(Context::index), \ |
| 1981 FixedArray::OffsetOfElementAt(Context::index)); | 1981 FixedArray::OffsetOfElementAt(Context::index)); |
| 1982 EXTRACT_CONTEXT_FIELD(CLOSURE_INDEX, JSFunction, closure); | 1982 EXTRACT_CONTEXT_FIELD(CLOSURE_INDEX, JSFunction, closure); |
| 1983 EXTRACT_CONTEXT_FIELD(PREVIOUS_INDEX, Context, previous); | 1983 EXTRACT_CONTEXT_FIELD(PREVIOUS_INDEX, Context, previous); |
| 1984 EXTRACT_CONTEXT_FIELD(EXTENSION_INDEX, Object, extension); | 1984 EXTRACT_CONTEXT_FIELD(EXTENSION_INDEX, Object, extension); |
| 1985 EXTRACT_CONTEXT_FIELD(GLOBAL_INDEX, GlobalObject, global); | 1985 EXTRACT_CONTEXT_FIELD(GLOBAL_INDEX, GlobalObject, global); |
| 1986 if (context->IsGlobalContext()) { | 1986 if (context->IsNativeContext()) { |
| 1987 TagObject(context->jsfunction_result_caches(), | 1987 TagObject(context->jsfunction_result_caches(), |
| 1988 "(context func. result caches)"); | 1988 "(context func. result caches)"); |
| 1989 TagObject(context->normalized_map_cache(), "(context norm. map cache)"); | 1989 TagObject(context->normalized_map_cache(), "(context norm. map cache)"); |
| 1990 TagObject(context->runtime_context(), "(runtime context)"); | 1990 TagObject(context->runtime_context(), "(runtime context)"); |
| 1991 TagObject(context->data(), "(context data)"); | 1991 TagObject(context->data(), "(context data)"); |
| 1992 GLOBAL_CONTEXT_FIELDS(EXTRACT_CONTEXT_FIELD); | 1992 NATIVE_CONTEXT_FIELDS(EXTRACT_CONTEXT_FIELD); |
| 1993 #undef EXTRACT_CONTEXT_FIELD | 1993 #undef EXTRACT_CONTEXT_FIELD |
| 1994 for (int i = Context::FIRST_WEAK_SLOT; | 1994 for (int i = Context::FIRST_WEAK_SLOT; |
| 1995 i < Context::GLOBAL_CONTEXT_SLOTS; | 1995 i < Context::NATIVE_CONTEXT_SLOTS; |
| 1996 ++i) { | 1996 ++i) { |
| 1997 SetWeakReference(context, entry, i, context->get(i), | 1997 SetWeakReference(context, entry, i, context->get(i), |
| 1998 FixedArray::OffsetOfElementAt(i)); | 1998 FixedArray::OffsetOfElementAt(i)); |
| 1999 } | 1999 } |
| 2000 } | 2000 } |
| 2001 } | 2001 } |
| 2002 | 2002 |
| 2003 | 2003 |
| 2004 void V8HeapExplorer::ExtractMapReferences(int entry, Map* map) { | 2004 void V8HeapExplorer::ExtractMapReferences(int entry, Map* map) { |
| 2005 SetInternalReference(map, entry, | 2005 SetInternalReference(map, entry, |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2655 entry->set_name(tag); | 2655 entry->set_name(tag); |
| 2656 } | 2656 } |
| 2657 } | 2657 } |
| 2658 } | 2658 } |
| 2659 | 2659 |
| 2660 | 2660 |
| 2661 class GlobalObjectsEnumerator : public ObjectVisitor { | 2661 class GlobalObjectsEnumerator : public ObjectVisitor { |
| 2662 public: | 2662 public: |
| 2663 virtual void VisitPointers(Object** start, Object** end) { | 2663 virtual void VisitPointers(Object** start, Object** end) { |
| 2664 for (Object** p = start; p < end; p++) { | 2664 for (Object** p = start; p < end; p++) { |
| 2665 if ((*p)->IsGlobalContext()) { | 2665 if ((*p)->IsNativeContext()) { |
| 2666 Context* context = Context::cast(*p); | 2666 Context* context = Context::cast(*p); |
| 2667 JSObject* proxy = context->global_proxy(); | 2667 JSObject* proxy = context->global_proxy(); |
| 2668 if (proxy->IsJSGlobalProxy()) { | 2668 if (proxy->IsJSGlobalProxy()) { |
| 2669 Object* global = proxy->map()->prototype(); | 2669 Object* global = proxy->map()->prototype(); |
| 2670 if (global->IsJSGlobalObject()) { | 2670 if (global->IsJSGlobalObject()) { |
| 2671 objects_.Add(Handle<JSGlobalObject>(JSGlobalObject::cast(global))); | 2671 objects_.Add(Handle<JSGlobalObject>(JSGlobalObject::cast(global))); |
| 2672 } | 2672 } |
| 2673 } | 2673 } |
| 2674 } | 2674 } |
| 2675 } | 2675 } |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3569 | 3569 |
| 3570 | 3570 |
| 3571 void HeapSnapshotJSONSerializer::SortHashMap( | 3571 void HeapSnapshotJSONSerializer::SortHashMap( |
| 3572 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3572 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
| 3573 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3573 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
| 3574 sorted_entries->Add(p); | 3574 sorted_entries->Add(p); |
| 3575 sorted_entries->Sort(SortUsingEntryValue); | 3575 sorted_entries->Sort(SortUsingEntryValue); |
| 3576 } | 3576 } |
| 3577 | 3577 |
| 3578 } } // namespace v8::internal | 3578 } } // namespace v8::internal |
| OLD | NEW |