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...) 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...) 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 = | |
1992 #ifdef ENABLE_DEBUGGER_SUPPORT | |
1993 object->IsGlobalObject() && | |
1994 Isolate::Current()->debug()->IsDebugGlobal(GlobalObject::cast(object)); | |
1995 #else | |
1996 false; | |
yurys
2012/04/16 17:44:15
You could initialize is_debug_object with false an
alexeif
2012/04/17 13:43:00
Done.
| |
1997 #endif | |
1998 if (!is_debug_object) { | |
1999 SetUserGlobalReference(object); | |
2000 } | |
1990 } else if (obj->IsJSObject()) { | 2001 } else if (obj->IsJSObject()) { |
1991 JSObject* js_obj = JSObject::cast(obj); | 2002 JSObject* js_obj = JSObject::cast(obj); |
1992 ExtractClosureReferences(js_obj, entry); | 2003 ExtractClosureReferences(js_obj, entry); |
1993 ExtractPropertyReferences(js_obj, entry); | 2004 ExtractPropertyReferences(js_obj, entry); |
1994 ExtractElementReferences(js_obj, entry); | 2005 ExtractElementReferences(js_obj, entry); |
1995 ExtractInternalReferences(js_obj, entry); | 2006 ExtractInternalReferences(js_obj, entry); |
1996 SetPropertyReference( | 2007 SetPropertyReference( |
1997 obj, entry, heap_->Proto_symbol(), js_obj->GetPrototype()); | 2008 obj, entry, heap_->Proto_symbol(), js_obj->GetPrototype()); |
1998 if (obj->IsJSFunction()) { | 2009 if (obj->IsJSFunction()) { |
1999 JSFunction* js_fun = JSFunction::cast(js_obj); | 2010 JSFunction* js_fun = JSFunction::cast(js_obj); |
(...skipping 624 matching lines...) Loading... | |
2624 | 2635 |
2625 | 2636 |
2626 void V8HeapExplorer::SetRootGcRootsReference() { | 2637 void V8HeapExplorer::SetRootGcRootsReference() { |
2627 filler_->SetIndexedAutoIndexReference( | 2638 filler_->SetIndexedAutoIndexReference( |
2628 HeapGraphEdge::kElement, | 2639 HeapGraphEdge::kElement, |
2629 kInternalRootObject, snapshot_->root(), | 2640 kInternalRootObject, snapshot_->root(), |
2630 kGcRootsObject, snapshot_->gc_roots()); | 2641 kGcRootsObject, snapshot_->gc_roots()); |
2631 } | 2642 } |
2632 | 2643 |
2633 | 2644 |
2634 void V8HeapExplorer::SetWindowReference(Object* child_obj) { | 2645 void V8HeapExplorer::SetUserGlobalReference(Object* child_obj) { |
2635 HeapEntry* child_entry = GetEntry(child_obj); | 2646 HeapEntry* child_entry = GetEntry(child_obj); |
2636 ASSERT(child_entry != NULL); | 2647 ASSERT(child_entry != NULL); |
2637 filler_->SetNamedAutoIndexReference( | 2648 filler_->SetNamedAutoIndexReference( |
2638 HeapGraphEdge::kShortcut, | 2649 HeapGraphEdge::kShortcut, |
2639 kInternalRootObject, snapshot_->root(), | 2650 kInternalRootObject, snapshot_->root(), |
2640 child_obj, child_entry); | 2651 child_obj, child_entry); |
2641 } | 2652 } |
2642 | 2653 |
2643 | 2654 |
2644 void V8HeapExplorer::SetGcRootsReference(VisitorSynchronization::SyncTag tag) { | 2655 void V8HeapExplorer::SetGcRootsReference(VisitorSynchronization::SyncTag tag) { |
(...skipping 1254 matching lines...) Loading... | |
3899 | 3910 |
3900 | 3911 |
3901 void HeapSnapshotJSONSerializer::SortHashMap( | 3912 void HeapSnapshotJSONSerializer::SortHashMap( |
3902 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 3913 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
3903 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 3914 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
3904 sorted_entries->Add(p); | 3915 sorted_entries->Add(p); |
3905 sorted_entries->Sort(SortUsingEntryValue); | 3916 sorted_entries->Sort(SortUsingEntryValue); |
3906 } | 3917 } |
3907 | 3918 |
3908 } } // namespace v8::internal | 3919 } } // namespace v8::internal |
OLD | NEW |