|
32 | 32 | namespace node { |
33 | 33 | namespace v8_utils { |
34 | 34 | using v8::Array; |
| 35 | +using v8::BigInt; |
35 | 36 | using v8::CFunction; |
36 | 37 | using v8::Context; |
37 | 38 | using v8::FunctionCallbackInfo; |
@@ -260,6 +261,12 @@ static bool FastIsStringOneByteRepresentation(Local<Value> receiver, |
260 | 261 | CFunction fast_is_string_one_byte_representation_( |
261 | 262 | CFunction::Make(FastIsStringOneByteRepresentation)); |
262 | 263 |
|
| 264 | +void GetHashSeed(const FunctionCallbackInfo<Value>& args) { |
| 265 | + Isolate* isolate = args.GetIsolate(); |
| 266 | + uint64_t hash_seed = isolate->GetHashSeed(); |
| 267 | + args.GetReturnValue().Set(BigInt::NewFromUnsigned(isolate, hash_seed)); |
| 268 | +} |
| 269 | + |
263 | 270 | static const char* GetGCTypeName(v8::GCType gc_type) { |
264 | 271 | switch (gc_type) { |
265 | 272 | case v8::GCType::kGCTypeScavenge: |
@@ -694,6 +701,8 @@ void Initialize(Local<Object> target, |
694 | 701 | IsStringOneByteRepresentation, |
695 | 702 | &fast_is_string_one_byte_representation_); |
696 | 703 |
|
| 704 | + SetMethodNoSideEffect(context, target, "getHashSeed", GetHashSeed); |
| 705 | + |
697 | 706 | // GCProfiler |
698 | 707 | Local<FunctionTemplate> t = |
699 | 708 | NewFunctionTemplate(env->isolate(), GCProfiler::New); |
@@ -721,6 +730,7 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) { |
721 | 730 | registry->Register(UpdateHeapCodeStatisticsBuffer); |
722 | 731 | registry->Register(UpdateHeapSpaceStatisticsBuffer); |
723 | 732 | registry->Register(SetFlagsFromString); |
| 733 | + registry->Register(GetHashSeed); |
724 | 734 | registry->Register(SetHeapSnapshotNearHeapLimit); |
725 | 735 | registry->Register(GCProfiler::New); |
726 | 736 | registry->Register(GCProfiler::Start); |
|
0 commit comments