3232namespace node {
3333namespace v8_utils {
3434using v8::Array;
35+ using v8::BigInt;
3536using v8::Context;
3637using v8::FunctionCallbackInfo;
3738using v8::FunctionTemplate;
@@ -238,6 +239,12 @@ void SetFlagsFromString(const FunctionCallbackInfo<Value>& args) {
238239 V8::SetFlagsFromString(*flags, static_cast<size_t>(flags.length()));
239240}
240241
242+ void GetHashSeed(const FunctionCallbackInfo<Value>& args) {
243+ Isolate* isolate = args.GetIsolate();
244+ uint64_t hash_seed = isolate->GetHashSeed();
245+ args.GetReturnValue().Set(BigInt::NewFromUnsigned(isolate, hash_seed));
246+ }
247+
241248static const char* GetGCTypeName(v8::GCType gc_type) {
242249 switch (gc_type) {
243250 case v8::GCType::kGCTypeScavenge:
@@ -478,6 +485,8 @@ void Initialize(Local<Object> target,
478485 // Export symbols used by v8.setFlagsFromString()
479486 SetMethod(context, target, "setFlagsFromString", SetFlagsFromString);
480487
488+ SetMethod(context, target, "getHashSeed", GetHashSeed);
489+
481490 // GCProfiler
482491 Local<FunctionTemplate> t =
483492 NewFunctionTemplate(env->isolate(), GCProfiler::New);
@@ -493,6 +502,7 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
493502 registry->Register(UpdateHeapCodeStatisticsBuffer);
494503 registry->Register(UpdateHeapSpaceStatisticsBuffer);
495504 registry->Register(SetFlagsFromString);
505+ registry->Register(GetHashSeed);
496506 registry->Register(SetHeapSnapshotNearHeapLimit);
497507 registry->Register(GCProfiler::New);
498508 registry->Register(GCProfiler::Start);
0 commit comments