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 16 matching lines...) Expand all Loading... |
27 | 27 |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "profile-generator-inl.h" | 30 #include "profile-generator-inl.h" |
31 | 31 |
32 #include "global-handles.h" | 32 #include "global-handles.h" |
33 #include "heap-profiler.h" | 33 #include "heap-profiler.h" |
34 #include "scopeinfo.h" | 34 #include "scopeinfo.h" |
35 #include "unicode.h" | 35 #include "unicode.h" |
36 #include "zone-inl.h" | 36 #include "zone-inl.h" |
| 37 #include "debug.h" |
37 | 38 |
38 namespace v8 { | 39 namespace v8 { |
39 namespace internal { | 40 namespace internal { |
40 | 41 |
41 | 42 |
42 TokenEnumerator::TokenEnumerator() | 43 TokenEnumerator::TokenEnumerator() |
43 : token_locations_(4), | 44 : token_locations_(4), |
44 token_removed_(4) { | 45 token_removed_(4) { |
45 } | 46 } |
46 | 47 |
(...skipping 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1979 void V8HeapExplorer::ExtractReferences(HeapObject* obj) { | 1980 void V8HeapExplorer::ExtractReferences(HeapObject* obj) { |
1980 HeapEntry* entry = GetEntry(obj); | 1981 HeapEntry* entry = GetEntry(obj); |
1981 if (entry == NULL) return; // No interest in this object. | 1982 if (entry == NULL) return; // No interest in this object. |
1982 | 1983 |
1983 bool extract_indexed_refs = true; | 1984 bool extract_indexed_refs = true; |
1984 if (obj->IsJSGlobalProxy()) { | 1985 if (obj->IsJSGlobalProxy()) { |
1985 // We need to reference JS global objects from snapshot's root. | 1986 // We need to reference JS global objects from snapshot's root. |
1986 // We use JSGlobalProxy because this is what embedder (e.g. browser) | 1987 // We use JSGlobalProxy because this is what embedder (e.g. browser) |
1987 // uses for the global object. | 1988 // uses for the global object. |
1988 JSGlobalProxy* proxy = JSGlobalProxy::cast(obj); | 1989 JSGlobalProxy* proxy = JSGlobalProxy::cast(obj); |
1989 SetWindowReference(proxy->map()->prototype()); | 1990 Object* object = proxy->map()->prototype(); |
| 1991 bool is_debug_object = false; |
| 1992 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1993 is_debug_object = object->IsGlobalObject() && |
| 1994 Isolate::Current()->debug()->IsDebugGlobal(GlobalObject::cast(object)); |
| 1995 #endif |
| 1996 if (!is_debug_object) { |
| 1997 SetUserGlobalReference(object); |
| 1998 } |
1990 } else if (obj->IsJSObject()) { | 1999 } else if (obj->IsJSObject()) { |
1991 JSObject* js_obj = JSObject::cast(obj); | 2000 JSObject* js_obj = JSObject::cast(obj); |
1992 ExtractClosureReferences(js_obj, entry); | 2001 ExtractClosureReferences(js_obj, entry); |
1993 ExtractPropertyReferences(js_obj, entry); | 2002 ExtractPropertyReferences(js_obj, entry); |
1994 ExtractElementReferences(js_obj, entry); | 2003 ExtractElementReferences(js_obj, entry); |
1995 ExtractInternalReferences(js_obj, entry); | 2004 ExtractInternalReferences(js_obj, entry); |
1996 SetPropertyReference( | 2005 SetPropertyReference( |
1997 obj, entry, heap_->Proto_symbol(), js_obj->GetPrototype()); | 2006 obj, entry, heap_->Proto_symbol(), js_obj->GetPrototype()); |
1998 if (obj->IsJSFunction()) { | 2007 if (obj->IsJSFunction()) { |
1999 JSFunction* js_fun = JSFunction::cast(js_obj); | 2008 JSFunction* js_fun = JSFunction::cast(js_obj); |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2624 | 2633 |
2625 | 2634 |
2626 void V8HeapExplorer::SetRootGcRootsReference() { | 2635 void V8HeapExplorer::SetRootGcRootsReference() { |
2627 filler_->SetIndexedAutoIndexReference( | 2636 filler_->SetIndexedAutoIndexReference( |
2628 HeapGraphEdge::kElement, | 2637 HeapGraphEdge::kElement, |
2629 kInternalRootObject, snapshot_->root(), | 2638 kInternalRootObject, snapshot_->root(), |
2630 kGcRootsObject, snapshot_->gc_roots()); | 2639 kGcRootsObject, snapshot_->gc_roots()); |
2631 } | 2640 } |
2632 | 2641 |
2633 | 2642 |
2634 void V8HeapExplorer::SetWindowReference(Object* child_obj) { | 2643 void V8HeapExplorer::SetUserGlobalReference(Object* child_obj) { |
2635 HeapEntry* child_entry = GetEntry(child_obj); | 2644 HeapEntry* child_entry = GetEntry(child_obj); |
2636 ASSERT(child_entry != NULL); | 2645 ASSERT(child_entry != NULL); |
2637 filler_->SetNamedAutoIndexReference( | 2646 filler_->SetNamedAutoIndexReference( |
2638 HeapGraphEdge::kShortcut, | 2647 HeapGraphEdge::kShortcut, |
2639 kInternalRootObject, snapshot_->root(), | 2648 kInternalRootObject, snapshot_->root(), |
2640 child_obj, child_entry); | 2649 child_obj, child_entry); |
2641 } | 2650 } |
2642 | 2651 |
2643 | 2652 |
2644 void V8HeapExplorer::SetGcRootsReference(VisitorSynchronization::SyncTag tag) { | 2653 void V8HeapExplorer::SetGcRootsReference(VisitorSynchronization::SyncTag tag) { |
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3899 | 3908 |
3900 | 3909 |
3901 void HeapSnapshotJSONSerializer::SortHashMap( | 3910 void HeapSnapshotJSONSerializer::SortHashMap( |
3902 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3911 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
3903 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3912 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
3904 sorted_entries->Add(p); | 3913 sorted_entries->Add(p); |
3905 sorted_entries->Sort(SortUsingEntryValue); | 3914 sorted_entries->Sort(SortUsingEntryValue); |
3906 } | 3915 } |
3907 | 3916 |
3908 } } // namespace v8::internal | 3917 } } // namespace v8::internal |
OLD | NEW |