| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 | 91 |
| 92 | 92 |
| 93 HeapSnapshot* HeapProfiler::TakeSnapshot( | 93 HeapSnapshot* HeapProfiler::TakeSnapshot( |
| 94 String* name, | 94 String* name, |
| 95 v8::ActivityControl* control, | 95 v8::ActivityControl* control, |
| 96 v8::HeapProfiler::ObjectNameResolver* resolver) { | 96 v8::HeapProfiler::ObjectNameResolver* resolver) { |
| 97 return TakeSnapshot(snapshots_->names()->GetName(name), control, resolver); | 97 return TakeSnapshot(snapshots_->names()->GetName(name), control, resolver); |
| 98 } | 98 } |
| 99 | 99 |
| 100 | 100 |
| 101 void HeapProfiler::StartHeapObjectsTracking() { | 101 void HeapProfiler::StartHeapObjectsTracking(bool track_allocations) { |
| 102 snapshots_->StartHeapObjectsTracking(); | 102 snapshots_->StartHeapObjectsTracking(track_allocations); |
| 103 is_tracking_object_moves_ = true; | 103 is_tracking_object_moves_ = true; |
| 104 ASSERT(!is_tracking_allocations_); |
| 105 if (track_allocations) { |
| 106 heap()->DisableInlineAllocation(); |
| 107 is_tracking_allocations_ = true; |
| 108 } |
| 104 } | 109 } |
| 105 | 110 |
| 106 | 111 |
| 107 SnapshotObjectId HeapProfiler::PushHeapObjectsStats(OutputStream* stream) { | 112 SnapshotObjectId HeapProfiler::PushHeapObjectsStats(OutputStream* stream) { |
| 108 return snapshots_->PushHeapObjectsStats(stream); | 113 return snapshots_->PushHeapObjectsStats(stream); |
| 109 } | 114 } |
| 110 | 115 |
| 111 | 116 |
| 112 void HeapProfiler::StopHeapObjectsTracking() { | 117 void HeapProfiler::StopHeapObjectsTracking() { |
| 113 snapshots_->StopHeapObjectsTracking(); | 118 snapshots_->StopHeapObjectsTracking(); |
| 119 if (is_tracking_allocations_) { |
| 120 heap()->EnableInlineAllocation(); |
| 121 is_tracking_allocations_ = false; |
| 122 } |
| 114 } | 123 } |
| 115 | 124 |
| 116 | 125 |
| 117 size_t HeapProfiler::GetMemorySizeUsedByProfiler() { | 126 size_t HeapProfiler::GetMemorySizeUsedByProfiler() { |
| 118 return snapshots_->GetUsedMemorySize(); | 127 return snapshots_->GetUsedMemorySize(); |
| 119 } | 128 } |
| 120 | 129 |
| 121 | 130 |
| 122 int HeapProfiler::GetSnapshotsCount() { | 131 int HeapProfiler::GetSnapshotsCount() { |
| 123 return snapshots_->snapshots()->length(); | 132 return snapshots_->snapshots()->length(); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 151 } | 160 } |
| 152 | 161 |
| 153 | 162 |
| 154 void HeapProfiler::SetRetainedObjectInfo(UniqueId id, | 163 void HeapProfiler::SetRetainedObjectInfo(UniqueId id, |
| 155 RetainedObjectInfo* info) { | 164 RetainedObjectInfo* info) { |
| 156 // TODO(yurus, marja): Don't route this information through GlobalHandles. | 165 // TODO(yurus, marja): Don't route this information through GlobalHandles. |
| 157 heap()->isolate()->global_handles()->SetRetainedObjectInfo(id, info); | 166 heap()->isolate()->global_handles()->SetRetainedObjectInfo(id, info); |
| 158 } | 167 } |
| 159 | 168 |
| 160 | 169 |
| 161 void HeapProfiler::StartHeapAllocationsRecording() { | |
| 162 StartHeapObjectsTracking(); | |
| 163 heap()->DisableInlineAllocation(); | |
| 164 is_tracking_allocations_ = true; | |
| 165 } | |
| 166 | |
| 167 | |
| 168 void HeapProfiler::StopHeapAllocationsRecording() { | |
| 169 StopHeapObjectsTracking(); | |
| 170 heap()->EnableInlineAllocation(); | |
| 171 is_tracking_allocations_ = false; | |
| 172 } | |
| 173 | |
| 174 | |
| 175 } } // namespace v8::internal | 170 } } // namespace v8::internal |
| OLD | NEW |