1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_HEAP_HEAP_LAYOUT_TRACER_H_
6#define V8_HEAP_HEAP_LAYOUT_TRACER_H_
7
8#include "include/v8-callbacks.h"
9#include "src/common/globals.h"
10
11namespace v8 {
12namespace internal {
13
14class Heap;
15class BasicMemoryChunk;
16
17class HeapLayoutTracer : AllStatic {
18 public:
19  static void GCProloguePrintHeapLayout(v8::Isolate* isolate,
20                                        v8::GCType gc_type,
21                                        v8::GCCallbackFlags flags, void* data);
22  static void GCEpiloguePrintHeapLayout(v8::Isolate* isolate,
23                                        v8::GCType gc_type,
24                                        v8::GCCallbackFlags flags, void* data);
25
26 private:
27  static void PrintBasicMemoryChunk(std::ostream& os, BasicMemoryChunk* chunk,
28                                    const char* owner_name);
29  static void PrintHeapLayout(std::ostream& os, Heap* heap);
30};
31}  // namespace internal
32}  // namespace v8
33#endif  // V8_HEAP_HEAP_LAYOUT_TRACER_H_
34