From da9dabbe82b13a8a9a90ad104e00abe1c7b16193 Mon Sep 17 00:00:00 2001 From: Maya Lekova Date: Mon, 20 Jul 2020 11:10:30 +0200 Subject: [PATCH] process: update v8 fast api calls usage This commit removes the WrapperTraits specialization for FastHrtime according to recent changes in the V8 API. Refs: https://github.com/nodejs/node/issues/33374 --- src/node_process_methods.cc | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index aa186185988a0a..8dd1c171578743 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -478,7 +478,10 @@ class FastHrtime : public BaseObject { // broken into the upper/lower 32 bits to be converted back in JS, // because there is no Uint64Array in JS. // The third entry contains the remaining nanosecond part of the value. - static void FastNumber(FastHrtime* receiver) { + static void FastNumber(v8::ApiObject receiver_value) { + v8::Object* receiver_obj = reinterpret_cast(&receiver_value); + FastHrtime* receiver = static_cast( + receiver_obj->GetAlignedPointerFromInternalField(BaseObject::kSlot)); uint64_t t = uv_hrtime(); uint32_t* fields = static_cast(receiver->backing_store_->Data()); fields[0] = (t / NANOS_PER_SEC) >> 32; @@ -490,7 +493,10 @@ class FastHrtime : public BaseObject { FastNumber(FromJSObject(args.Holder())); } - static void FastBigInt(FastHrtime* receiver) { + static void FastBigInt(v8::ApiObject receiver_value) { + v8::Object* receiver_obj = reinterpret_cast(&receiver_value); + FastHrtime* receiver = static_cast( + receiver_obj->GetAlignedPointerFromInternalField(BaseObject::kSlot)); uint64_t t = uv_hrtime(); uint64_t* fields = static_cast(receiver->backing_store_->Data()); fields[0] = t; @@ -544,16 +550,5 @@ static void InitializeProcessMethods(Local target, } // namespace node -namespace v8 { -template <> -class WrapperTraits { - public: - static const void* GetTypeInfo() { - static const int tag = 0; - return reinterpret_cast(&tag); - } -}; -} // namespace v8 - NODE_MODULE_CONTEXT_AWARE_INTERNAL(process_methods, node::InitializeProcessMethods)