| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 // and inspect its longevity while debugging JS code in execution. | 70 // and inspect its longevity while debugging JS code in execution. |
| 71 // | 71 // |
| 72 // The lol comes with utility functions to capture, dump, summarize, and diff | 72 // The lol comes with utility functions to capture, dump, summarize, and diff |
| 73 // captured lols amongst other functionality. These functionality are | 73 // captured lols amongst other functionality. These functionality are |
| 74 // accessible via the v8 debugger interface. | 74 // accessible via the v8 debugger interface. |
| 75 class LiveObjectList { | 75 class LiveObjectList { |
| 76 public: | 76 public: |
| 77 inline static void GCEpilogue(); | 77 inline static void GCEpilogue(); |
| 78 inline static void GCPrologue(); | 78 inline static void GCPrologue(); |
| 79 inline static void IterateElements(ObjectVisitor* v); | 79 inline static void IterateElements(ObjectVisitor* v); |
| 80 inline static void ProcessNonLive(HeapObject *obj); | 80 inline static void ProcessNonLive(HeapObject* obj); |
| 81 inline static void UpdateReferencesForScavengeGC(); | 81 inline static void UpdateReferencesForScavengeGC(); |
| 82 | 82 |
| 83 // Note: LOLs can be listed by calling Dump(0, <lol id>), and 2 LOLs can be | 83 // Note: LOLs can be listed by calling Dump(0, <lol id>), and 2 LOLs can be |
| 84 // compared/diff'ed using Dump(<lol id1>, <lol id2>, ...). This will yield | 84 // compared/diff'ed using Dump(<lol id1>, <lol id2>, ...). This will yield |
| 85 // a verbose dump of all the objects in the resultant lists. | 85 // a verbose dump of all the objects in the resultant lists. |
| 86 // Similarly, a summarized result of a LOL listing or a diff can be | 86 // Similarly, a summarized result of a LOL listing or a diff can be |
| 87 // attained using the Summarize(0, <lol id>) and Summarize(<lol id1, | 87 // attained using the Summarize(0, <lol id>) and Summarize(<lol id1, |
| 88 // <lol id2>, ...) respectively. | 88 // <lol id2>, ...) respectively. |
| 89 | 89 |
| 90 static MaybeObject* Capture(); | 90 static MaybeObject* Capture(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 118 int id_; | 118 int id_; |
| 119 HeapObject* obj_; | 119 HeapObject* obj_; |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 explicit LiveObjectList(LiveObjectList* prev, int capacity); | 122 explicit LiveObjectList(LiveObjectList* prev, int capacity); |
| 123 ~LiveObjectList(); | 123 ~LiveObjectList(); |
| 124 | 124 |
| 125 static void GCEpiloguePrivate(); | 125 static void GCEpiloguePrivate(); |
| 126 static void IterateElementsPrivate(ObjectVisitor* v); | 126 static void IterateElementsPrivate(ObjectVisitor* v); |
| 127 | 127 |
| 128 static void DoProcessNonLive(HeapObject *obj); | 128 static void DoProcessNonLive(HeapObject* obj); |
| 129 | 129 |
| 130 static int CompareElement(const Element* a, const Element* b); | 130 static int CompareElement(const Element* a, const Element* b); |
| 131 | 131 |
| 132 static Object* GetPathPrivate(HeapObject* obj1, HeapObject* obj2); | 132 static Object* GetPathPrivate(HeapObject* obj1, HeapObject* obj2); |
| 133 | 133 |
| 134 static int GetRetainers(Handle<HeapObject> target, | 134 static int GetRetainers(Handle<HeapObject> target, |
| 135 Handle<JSObject> instance_filter, | 135 Handle<JSObject> instance_filter, |
| 136 Handle<FixedArray> retainers_arr, | 136 Handle<FixedArray> retainers_arr, |
| 137 int start, | 137 int start, |
| 138 int dump_limit, | 138 int dump_limit, |
| 139 int* total_count, | 139 int* total_count, |
| 140 LolFilter* filter, | 140 LolFilter* filter, |
| 141 LiveObjectSummary *summary, | 141 LiveObjectSummary* summary, |
| 142 JSFunction* arguments_function, | 142 JSFunction* arguments_function, |
| 143 Handle<Object> error); | 143 Handle<Object> error); |
| 144 | 144 |
| 145 static MaybeObject* DumpPrivate(DumpWriter* writer, | 145 static MaybeObject* DumpPrivate(DumpWriter* writer, |
| 146 int start, | 146 int start, |
| 147 int dump_limit, | 147 int dump_limit, |
| 148 LolFilter* filter); | 148 LolFilter* filter); |
| 149 static MaybeObject* SummarizePrivate(SummaryWriter* writer, | 149 static MaybeObject* SummarizePrivate(SummaryWriter* writer, |
| 150 LolFilter* filter, | 150 LolFilter* filter, |
| 151 bool is_tracking_roots); | 151 bool is_tracking_roots); |
| 152 | 152 |
| 153 static bool NeedLOLProcessing() { return (last() != NULL); } | 153 static bool NeedLOLProcessing() { return (last() != NULL); } |
| 154 static void NullifyNonLivePointer(HeapObject **p) { | 154 static void NullifyNonLivePointer(HeapObject** p) { |
| 155 // Mask out the low bit that marks this as a heap object. We'll use this | 155 // Mask out the low bit that marks this as a heap object. We'll use this |
| 156 // cleared bit as an indicator that this pointer needs to be collected. | 156 // cleared bit as an indicator that this pointer needs to be collected. |
| 157 // | 157 // |
| 158 // Meanwhile, we still preserve its approximate value so that we don't | 158 // Meanwhile, we still preserve its approximate value so that we don't |
| 159 // have to resort the elements list all the time. | 159 // have to resort the elements list all the time. |
| 160 // | 160 // |
| 161 // Note: Doing so also makes this HeapObject* look like an SMI. Hence, | 161 // Note: Doing so also makes this HeapObject* look like an SMI. Hence, |
| 162 // GC pointer updater will ignore it when it gets scanned. | 162 // GC pointer updater will ignore it when it gets scanned. |
| 163 *p = reinterpret_cast<HeapObject*>((*p)->address()); | 163 *p = reinterpret_cast<HeapObject*>((*p)->address()); |
| 164 } | 164 } |
| (...skipping 30 matching lines...) Expand all Loading... |
| 195 | 195 |
| 196 inline static int GetElementId(Element* element); | 196 inline static int GetElementId(Element* element); |
| 197 inline static HeapObject* GetElementObj(Element* element); | 197 inline static HeapObject* GetElementObj(Element* element); |
| 198 | 198 |
| 199 // Instance fields. | 199 // Instance fields. |
| 200 LiveObjectList* prev_; | 200 LiveObjectList* prev_; |
| 201 LiveObjectList* next_; | 201 LiveObjectList* next_; |
| 202 int id_; | 202 int id_; |
| 203 int capacity_; | 203 int capacity_; |
| 204 int obj_count_; | 204 int obj_count_; |
| 205 Element *elements_; | 205 Element* elements_; |
| 206 | 206 |
| 207 // Statics for managing all the lists. | 207 // Statics for managing all the lists. |
| 208 static uint32_t next_element_id_; | 208 static uint32_t next_element_id_; |
| 209 static int list_count_; | 209 static int list_count_; |
| 210 static int last_id_; | 210 static int last_id_; |
| 211 static LiveObjectList* first_; | 211 static LiveObjectList* first_; |
| 212 static LiveObjectList* last_; | 212 static LiveObjectList* last_; |
| 213 | 213 |
| 214 friend class LolIterator; | 214 friend class LolIterator; |
| 215 friend class LolForwardIterator; | 215 friend class LolForwardIterator; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } | 310 } |
| 311 inline static Object* PrintObj(int obj_id) { return HEAP->undefined_value(); } | 311 inline static Object* PrintObj(int obj_id) { return HEAP->undefined_value(); } |
| 312 }; | 312 }; |
| 313 | 313 |
| 314 | 314 |
| 315 #endif // LIVE_OBJECT_LIST | 315 #endif // LIVE_OBJECT_LIST |
| 316 | 316 |
| 317 } } // namespace v8::internal | 317 } } // namespace v8::internal |
| 318 | 318 |
| 319 #endif // V8_LIVEOBJECTLIST_H_ | 319 #endif // V8_LIVEOBJECTLIST_H_ |
| OLD | NEW |