OLD | NEW |
---|---|
1 // Copyright 2009-2010 the V8 project authors. All rights reserved. | 1 // Copyright 2009-2010 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
97 } | 97 } |
98 | 98 |
99 | 99 |
100 v8::RetainedObjectInfo* HeapProfiler::ExecuteWrapperClassCallback( | 100 v8::RetainedObjectInfo* HeapProfiler::ExecuteWrapperClassCallback( |
101 uint16_t class_id, Object** wrapper) { | 101 uint16_t class_id, Object** wrapper) { |
102 if (wrapper_callbacks_.length() <= class_id) return NULL; | 102 if (wrapper_callbacks_.length() <= class_id) return NULL; |
103 return wrapper_callbacks_[class_id]( | 103 return wrapper_callbacks_[class_id]( |
104 class_id, Utils::ToLocal(Handle<Object>(wrapper))); | 104 class_id, Utils::ToLocal(Handle<Object>(wrapper))); |
105 } | 105 } |
106 | 106 |
107 void HeapProfiler::VisitExternalResources(ExternalResourceVisitor* visitor) { | |
108 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask); | |
109 AssertNoAllocation no_allocation; | |
110 HeapIterator iterator; | |
111 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | |
112 if (!obj->IsString()) | |
mnaganov (inactive)
2012/01/11 18:50:23
Why not obj->IsExternalString()?
yurys
2012/01/11 19:50:13
Done.
| |
113 continue; | |
114 String* string= String::cast(obj); | |
115 if (StringShape(string).IsExternal()) | |
116 visitor->VisitExternalString(string); | |
117 } | |
118 } | |
107 | 119 |
108 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(const char* name, | 120 HeapSnapshot* HeapProfiler::TakeSnapshotImpl(const char* name, |
109 int type, | 121 int type, |
110 v8::ActivityControl* control) { | 122 v8::ActivityControl* control) { |
111 HeapSnapshot::Type s_type = static_cast<HeapSnapshot::Type>(type); | 123 HeapSnapshot::Type s_type = static_cast<HeapSnapshot::Type>(type); |
112 HeapSnapshot* result = | 124 HeapSnapshot* result = |
113 snapshots_->NewSnapshot(s_type, name, next_snapshot_uid_++); | 125 snapshots_->NewSnapshot(s_type, name, next_snapshot_uid_++); |
114 bool generation_completed = true; | 126 bool generation_completed = true; |
115 switch (s_type) { | 127 switch (s_type) { |
116 case HeapSnapshot::kFull: { | 128 case HeapSnapshot::kFull: { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 profiler->ResetSnapshots(); | 176 profiler->ResetSnapshots(); |
165 } | 177 } |
166 | 178 |
167 | 179 |
168 void HeapProfiler::ObjectMoveEvent(Address from, Address to) { | 180 void HeapProfiler::ObjectMoveEvent(Address from, Address to) { |
169 snapshots_->ObjectMoveEvent(from, to); | 181 snapshots_->ObjectMoveEvent(from, to); |
170 } | 182 } |
171 | 183 |
172 | 184 |
173 } } // namespace v8::internal | 185 } } // namespace v8::internal |
OLD | NEW |