From b230ac12d99eb797b519663c29836079b5d5ea4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Mon, 26 Apr 2021 15:14:57 +0200 Subject: [PATCH] src: stop using deprecated v8::ApiObject Backport-PR-URL: https://github.com/nodejs/node/pull/39470 PR-URL: https://github.com/nodejs/node/pull/38990 Reviewed-By: Jiawen Geng Reviewed-By: Matteo Collina Reviewed-By: Robert Nagy Reviewed-By: Colin Ihrig --- src/node_process_methods.cc | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/node_process_methods.cc b/src/node_process_methods.cc index 3bb56458d0eb33..e1ff446ac106d3 100644 --- a/src/node_process_methods.cc +++ b/src/node_process_methods.cc @@ -34,7 +34,6 @@ typedef int mode_t; namespace node { -using v8::ApiObject; using v8::Array; using v8::ArrayBuffer; using v8::BackingStore; @@ -478,8 +477,8 @@ class FastHrtime : public BaseObject { SET_MEMORY_INFO_NAME(FastHrtime) SET_SELF_SIZE(FastHrtime) - static FastHrtime* FromV8ApiObject(ApiObject api_object) { - Object* v8_object = reinterpret_cast(&api_object); + static FastHrtime* FromV8Value(Local value) { + Local v8_object = value.As(); return static_cast( v8_object->GetAlignedPointerFromInternalField(BaseObject::kSlot)); } @@ -501,8 +500,8 @@ class FastHrtime : public BaseObject { fields[2] = t % NANOS_PER_SEC; } - static void FastNumber(ApiObject receiver) { - NumberImpl(FromV8ApiObject(receiver)); + static void FastNumber(Local receiver) { + NumberImpl(FromV8Value(receiver)); } static void SlowNumber(const FunctionCallbackInfo& args) { @@ -515,8 +514,8 @@ class FastHrtime : public BaseObject { fields[0] = t; } - static void FastBigInt(ApiObject receiver) { - BigIntImpl(FromV8ApiObject(receiver)); + static void FastBigInt(Local receiver) { + BigIntImpl(FromV8Value(receiver)); } static void SlowBigInt(const FunctionCallbackInfo& args) {