| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/api.h" | 5 #include "src/api.h" |
| 6 | 6 |
| 7 #include <string.h> // For memcpy, strlen. | 7 #include <string.h> // For memcpy, strlen. |
| 8 #ifdef V8_USE_ADDRESS_SANITIZER | 8 #ifdef V8_USE_ADDRESS_SANITIZER |
| 9 #include <sanitizer/asan_interface.h> | 9 #include <sanitizer/asan_interface.h> |
| 10 #endif // V8_USE_ADDRESS_SANITIZER | 10 #endif // V8_USE_ADDRESS_SANITIZER |
| (...skipping 7604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7615 i::Isolate* isolate = i::Isolate::Current(); | 7615 i::Isolate* isolate = i::Isolate::Current(); |
| 7616 if (isolate->heap_profiler()->GetSnapshotsCount() > 1) { | 7616 if (isolate->heap_profiler()->GetSnapshotsCount() > 1) { |
| 7617 ToInternal(this)->Delete(); | 7617 ToInternal(this)->Delete(); |
| 7618 } else { | 7618 } else { |
| 7619 // If this is the last snapshot, clean up all accessory data as well. | 7619 // If this is the last snapshot, clean up all accessory data as well. |
| 7620 isolate->heap_profiler()->DeleteAllSnapshots(); | 7620 isolate->heap_profiler()->DeleteAllSnapshots(); |
| 7621 } | 7621 } |
| 7622 } | 7622 } |
| 7623 | 7623 |
| 7624 | 7624 |
| 7625 unsigned HeapSnapshot::GetUid() const { | |
| 7626 return ToInternal(this)->uid(); | |
| 7627 } | |
| 7628 | |
| 7629 | |
| 7630 Handle<String> HeapSnapshot::GetTitle() const { | |
| 7631 i::Isolate* isolate = i::Isolate::Current(); | |
| 7632 return ToApiHandle<String>( | |
| 7633 isolate->factory()->InternalizeUtf8String(ToInternal(this)->title())); | |
| 7634 } | |
| 7635 | |
| 7636 | |
| 7637 const HeapGraphNode* HeapSnapshot::GetRoot() const { | 7625 const HeapGraphNode* HeapSnapshot::GetRoot() const { |
| 7638 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root()); | 7626 return reinterpret_cast<const HeapGraphNode*>(ToInternal(this)->root()); |
| 7639 } | 7627 } |
| 7640 | 7628 |
| 7641 | 7629 |
| 7642 const HeapGraphNode* HeapSnapshot::GetNodeById(SnapshotObjectId id) const { | 7630 const HeapGraphNode* HeapSnapshot::GetNodeById(SnapshotObjectId id) const { |
| 7643 return reinterpret_cast<const HeapGraphNode*>( | 7631 return reinterpret_cast<const HeapGraphNode*>( |
| 7644 ToInternal(this)->GetEntryById(id)); | 7632 ToInternal(this)->GetEntryById(id)); |
| 7645 } | 7633 } |
| 7646 | 7634 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7706 | 7694 |
| 7707 void HeapProfiler::ClearObjectIds() { | 7695 void HeapProfiler::ClearObjectIds() { |
| 7708 reinterpret_cast<i::HeapProfiler*>(this)->ClearHeapObjectMap(); | 7696 reinterpret_cast<i::HeapProfiler*>(this)->ClearHeapObjectMap(); |
| 7709 } | 7697 } |
| 7710 | 7698 |
| 7711 | 7699 |
| 7712 const HeapSnapshot* HeapProfiler::TakeHeapSnapshot( | 7700 const HeapSnapshot* HeapProfiler::TakeHeapSnapshot( |
| 7713 Handle<String> title, | 7701 Handle<String> title, |
| 7714 ActivityControl* control, | 7702 ActivityControl* control, |
| 7715 ObjectNameResolver* resolver) { | 7703 ObjectNameResolver* resolver) { |
| 7716 return reinterpret_cast<const HeapSnapshot*>( | 7704 return TakeHeapSnapshot(control, resolver); |
| 7717 reinterpret_cast<i::HeapProfiler*>(this)->TakeSnapshot( | |
| 7718 *Utils::OpenHandle(*title), control, resolver)); | |
| 7719 } | 7705 } |
| 7720 | 7706 |
| 7721 | 7707 |
| 7708 const HeapSnapshot* HeapProfiler::TakeHeapSnapshot( |
| 7709 ActivityControl* control, ObjectNameResolver* resolver) { |
| 7710 return reinterpret_cast<const HeapSnapshot*>( |
| 7711 reinterpret_cast<i::HeapProfiler*>(this) |
| 7712 ->TakeSnapshot(control, resolver)); |
| 7713 } |
| 7714 |
| 7715 |
| 7722 void HeapProfiler::StartTrackingHeapObjects(bool track_allocations) { | 7716 void HeapProfiler::StartTrackingHeapObjects(bool track_allocations) { |
| 7723 reinterpret_cast<i::HeapProfiler*>(this)->StartHeapObjectsTracking( | 7717 reinterpret_cast<i::HeapProfiler*>(this)->StartHeapObjectsTracking( |
| 7724 track_allocations); | 7718 track_allocations); |
| 7725 } | 7719 } |
| 7726 | 7720 |
| 7727 | 7721 |
| 7728 void HeapProfiler::StopTrackingHeapObjects() { | 7722 void HeapProfiler::StopTrackingHeapObjects() { |
| 7729 reinterpret_cast<i::HeapProfiler*>(this)->StopHeapObjectsTracking(); | 7723 reinterpret_cast<i::HeapProfiler*>(this)->StopHeapObjectsTracking(); |
| 7730 } | 7724 } |
| 7731 | 7725 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7991 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); | 7985 Isolate* isolate = reinterpret_cast<Isolate*>(info.GetIsolate()); |
| 7992 Address callback_address = | 7986 Address callback_address = |
| 7993 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); | 7987 reinterpret_cast<Address>(reinterpret_cast<intptr_t>(callback)); |
| 7994 VMState<EXTERNAL> state(isolate); | 7988 VMState<EXTERNAL> state(isolate); |
| 7995 ExternalCallbackScope call_scope(isolate, callback_address); | 7989 ExternalCallbackScope call_scope(isolate, callback_address); |
| 7996 callback(info); | 7990 callback(info); |
| 7997 } | 7991 } |
| 7998 | 7992 |
| 7999 | 7993 |
| 8000 } } // namespace v8::internal | 7994 } } // namespace v8::internal |
| OLD | NEW |