#include "src/profiler/heap-profiler.h"
#include <fstream>
#include <optional>
#include "include/v8-profiler.h"
#include "src/api/api-inl.h"
#include "src/debug/debug.h"
#include "src/heap/combined-heap.h"
#include "src/heap/heap-inl.h"
#include "src/heap/heap.h"
#include "src/objects/js-array-buffer-inl.h"
#include "src/profiler/allocation-tracker.h"
#include "src/profiler/heap-snapshot-generator-inl.h"
#include "src/profiler/sampling-heap-profiler.h"
namespace v8::internal {
HeapProfiler::HeapProfiler(Heap* heap)
: … { … }
HeapProfiler::~HeapProfiler() = default;
void HeapProfiler::DeleteAllSnapshots() { … }
void HeapProfiler::MaybeClearStringsStorage() { … }
void HeapProfiler::RemoveSnapshot(HeapSnapshot* snapshot) { … }
std::vector<v8::Local<v8::Value>> HeapProfiler::GetDetachedJSWrapperObjects() { … }
void HeapProfiler::AddBuildEmbedderGraphCallback(
v8::HeapProfiler::BuildEmbedderGraphCallback callback, void* data) { … }
void HeapProfiler::RemoveBuildEmbedderGraphCallback(
v8::HeapProfiler::BuildEmbedderGraphCallback callback, void* data) { … }
void HeapProfiler::BuildEmbedderGraph(Isolate* isolate,
v8::EmbedderGraph* graph) { … }
void HeapProfiler::SetGetDetachednessCallback(
v8::HeapProfiler::GetDetachednessCallback callback, void* data) { … }
v8::EmbedderGraph::Node::Detachedness HeapProfiler::GetDetachedness(
const v8::Local<v8::Value> v8_value, uint16_t class_id) { … }
const char* HeapProfiler::CopyNameForHeapSnapshot(const char* name) { … }
HeapSnapshot* HeapProfiler::TakeSnapshot(
const v8::HeapProfiler::HeapSnapshotOptions options) { … }
class FileOutputStream : public v8::OutputStream { … };
void HeapProfiler::WriteSnapshotToDiskAfterGC() { … }
void HeapProfiler::TakeSnapshotToFile(
const v8::HeapProfiler::HeapSnapshotOptions options, std::string filename) { … }
bool HeapProfiler::StartSamplingHeapProfiler(
uint64_t sample_interval, int stack_depth,
v8::HeapProfiler::SamplingFlags flags) { … }
void HeapProfiler::StopSamplingHeapProfiler() { … }
v8::AllocationProfile* HeapProfiler::GetAllocationProfile() { … }
void HeapProfiler::StartHeapObjectsTracking(bool track_allocations) { … }
SnapshotObjectId HeapProfiler::PushHeapObjectsStats(OutputStream* stream,
int64_t* timestamp_us) { … }
void HeapProfiler::StopHeapObjectsTracking() { … }
int HeapProfiler::GetSnapshotsCount() const { … }
bool HeapProfiler::IsTakingSnapshot() const { … }
HeapSnapshot* HeapProfiler::GetSnapshot(int index) { … }
SnapshotObjectId HeapProfiler::GetSnapshotObjectId(DirectHandle<Object> obj) { … }
SnapshotObjectId HeapProfiler::GetSnapshotObjectId(NativeObject obj) { … }
void HeapProfilerNativeMoveListener::ObjectMoveEvent(Address from, Address to,
int size) { … }
void HeapProfiler::ObjectMoveEvent(Address from, Address to, int size,
bool is_native_object) { … }
void HeapProfiler::AllocationEvent(Address addr, int size) { … }
void HeapProfiler::UpdateObjectSizeEvent(Address addr, int size) { … }
Handle<HeapObject> HeapProfiler::FindHeapObjectById(SnapshotObjectId id) { … }
void HeapProfiler::ClearHeapObjectMap() { … }
Heap* HeapProfiler::heap() const { … }
Isolate* HeapProfiler::isolate() const { … }
void HeapProfiler::QueryObjects(DirectHandle<Context> context,
v8::QueryObjectPredicate* predicate,
std::vector<v8::Global<v8::Object>>* objects) { … }
}