1 #ifndef SRC_NODE_V8_H_ 2 #define SRC_NODE_V8_H_ 3 4 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 5 6 #include <sstream> 7 #include "aliased_buffer.h" 8 #include "base_object.h" 9 #include "json_utils.h" 10 #include "node_snapshotable.h" 11 #include "util.h" 12 #include "v8.h" 13 14 namespace node { 15 class Environment; 16 struct InternalFieldInfoBase; 17 18 namespace v8_utils { 19 class BindingData : public SnapshotableObject { 20 public: 21 BindingData(Realm* realm, v8::Local<v8::Object> obj); 22 23 using InternalFieldInfo = InternalFieldInfoBase; 24 SERIALIZABLE_OBJECT_METHODS()25 SERIALIZABLE_OBJECT_METHODS() 26 static constexpr FastStringKey type_name{"node::v8::BindingData"}; 27 static constexpr EmbedderObjectType type_int = 28 EmbedderObjectType::k_v8_binding_data; 29 30 AliasedFloat64Array heap_statistics_buffer; 31 AliasedFloat64Array heap_space_statistics_buffer; 32 AliasedFloat64Array heap_code_statistics_buffer; 33 34 void MemoryInfo(MemoryTracker* tracker) const override; 35 SET_SELF_SIZE(BindingData) 36 SET_MEMORY_INFO_NAME(BindingData) 37 }; 38 39 class GCProfiler : public BaseObject { 40 public: 41 enum class GCProfilerState { kInitialized, kStarted, kStopped }; 42 GCProfiler(Environment* env, v8::Local<v8::Object> object); 43 inline ~GCProfiler() override; 44 static void New(const v8::FunctionCallbackInfo<v8::Value>& args); 45 static void Start(const v8::FunctionCallbackInfo<v8::Value>& args); 46 static void Stop(const v8::FunctionCallbackInfo<v8::Value>& args); 47 48 JSONWriter* writer(); 49 50 std::ostringstream* out_stream(); 51 52 SET_NO_MEMORY_INFO() 53 SET_MEMORY_INFO_NAME(GCProfiler) 54 SET_SELF_SIZE(GCProfiler) 55 56 uint64_t start_time; 57 uint8_t current_gc_type; 58 GCProfilerState state; 59 60 private: 61 std::ostringstream out_stream_; 62 JSONWriter writer_; 63 }; 64 65 } // namespace v8_utils 66 67 } // namespace node 68 69 #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 70 71 #endif // SRC_NODE_V8_H_ 72