diff --git a/doc/api/addons.md b/doc/api/addons.md index 80d23a4cf48a..315bcda16424 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -214,7 +214,7 @@ class AddonData { static void Method(const v8::FunctionCallbackInfo& info) { // Retrieve the per-addon-instance data. AddonData* data = - reinterpret_cast(info.Data().As()->Value()); + reinterpret_cast(info.DataV2().As()->Value()); data->call_count++; info.GetReturnValue().Set((double)data->call_count); } @@ -982,7 +982,7 @@ void MyObject::New(const FunctionCallbackInfo& args) { const int argc = 1; Local argv[argc] = { args[0] }; Local cons = - args.Data().As()->GetInternalField(0) + args.DataV2().As().As()->GetInternalField(0) .As().As(); Local result = cons->NewInstance(context, argc, argv).ToLocalChecked(); diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc index 8b769d7ad07b..4cbe652b8b17 100644 --- a/src/js_native_api_v8.cc +++ b/src/js_native_api_v8.cc @@ -402,7 +402,7 @@ class CallbackBundle { return cbdata; } - static CallbackBundle* FromCallbackData(v8::Local data) { + static CallbackBundle* FromCallbackData(v8::Local data) { return reinterpret_cast( data.As()->Value(v8::kExternalPointerTypeTagDefault)); } @@ -491,7 +491,7 @@ class FunctionCallbackWrapper { explicit FunctionCallbackWrapper( const v8::FunctionCallbackInfo& cbinfo) : cbinfo_(cbinfo), - bundle_(CallbackBundle::FromCallbackData(cbinfo.Data())) {} + bundle_(CallbackBundle::FromCallbackData(cbinfo.DataV2())) {} void InvokeCallback() { napi_callback_info cbinfo_wrapper = diff --git a/src/module_wrap.cc b/src/module_wrap.cc index fa4fbcbc42f8..d08e51ea533a 100644 --- a/src/module_wrap.cc +++ b/src/module_wrap.cc @@ -1259,7 +1259,7 @@ static void ImportMetaResolveLazyGetter( // This should be createImportMetaResolve(). The loader argument is already // bound at initialization time. - Local args[] = {info.Data()}; + Local args[] = {info.DataV2().As()}; Local ret; if (!initializer ->Call(context, Undefined(realm->isolate()), arraysize(args), args) @@ -1290,7 +1290,7 @@ static void PathHelpersLazyGetter(Local name, } Environment* env = Environment::GetCurrent(context); - node::Utf8Value url(isolate, info.Data()); + node::Utf8Value url(isolate, info.DataV2().As()); auto file_url = ada::parse(url.ToStringView()); CHECK(file_url); auto file_path = url::FileURLToPath(env, *file_url); diff --git a/src/node_ffi.cc b/src/node_ffi.cc index 49c98053269e..61b78cec5d57 100644 --- a/src/node_ffi.cc +++ b/src/node_ffi.cc @@ -509,7 +509,8 @@ void DynamicLibrary::Close(const FunctionCallbackInfo& args) { void DynamicLibrary::InvokeFunction(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - FFIFunctionInfo* info = Unwrap(args.Data()); + FFIFunctionInfo* info = + Unwrap(args.DataV2().As()); CHECK_NOT_NULL(info); FFIFunction* fn = info->fn.get(); @@ -578,7 +579,8 @@ void DynamicLibrary::InvokeFunction(const FunctionCallbackInfo& args) { void DynamicLibrary::InvokeFunctionSB(const FunctionCallbackInfo& args) { Environment* env = Environment::GetCurrent(args); - FFIFunctionInfo* info = Unwrap(args.Data()); + FFIFunctionInfo* info = + Unwrap(args.DataV2().As()); CHECK_NOT_NULL(info); FFIFunction* fn = info->fn.get(); diff --git a/src/node_locks.cc b/src/node_locks.cc index 9c871569c4d4..50171259dfde 100644 --- a/src/node_locks.cc +++ b/src/node_locks.cc @@ -129,7 +129,7 @@ static void OnLockCallbackFulfilled(const FunctionCallbackInfo& info) { Environment* env = Environment::GetCurrent(info); BaseObjectPtr lock_holder{ - BaseObject::FromJSObject(info.Data())}; + BaseObject::FromJSObject(info.DataV2().As())}; std::shared_ptr lock = lock_holder->lock(); // Release the lock and continue processing the queue. @@ -143,7 +143,7 @@ static void OnLockCallbackRejected(const FunctionCallbackInfo& info) { Environment* env = Environment::GetCurrent(info); BaseObjectPtr lock_holder{ - BaseObject::FromJSObject(info.Data())}; + BaseObject::FromJSObject(info.DataV2().As())}; std::shared_ptr lock = lock_holder->lock(); LockManager::GetCurrent()->ReleaseLockAndProcessQueue( @@ -153,13 +153,13 @@ static void OnLockCallbackRejected(const FunctionCallbackInfo& info) { // Called when the promise returned from the user's callback resolves static void OnIfAvailableFulfill(const FunctionCallbackInfo& info) { HandleScope handle_scope(info.GetIsolate()); - USE(info.Data().As()->Resolve( + USE(info.DataV2().As().As()->Resolve( info.GetIsolate()->GetCurrentContext(), info[0])); } // Called when the promise returned from the user's callback rejects static void OnIfAvailableReject(const FunctionCallbackInfo& info) { - USE(info.Data().As()->Reject( + USE(info.DataV2().As().As()->Reject( info.GetIsolate()->GetCurrentContext(), info[0])); } diff --git a/src/node_util.cc b/src/node_util.cc index ad979ff1c223..4c42d8a6999c 100644 --- a/src/node_util.cc +++ b/src/node_util.cc @@ -379,7 +379,7 @@ static void DefineLazyPropertiesGetter( } Realm* realm = Realm::GetCurrent(context); - Local arg = info.Data(); + Local arg = info.DataV2().As(); Local require_result; if (!realm->builtin_module_require() ->Call(context, Null(isolate), 1, &arg) diff --git a/src/node_wasm_web_api.cc b/src/node_wasm_web_api.cc index a49cab7fb620..d977793eb136 100644 --- a/src/node_wasm_web_api.cc +++ b/src/node_wasm_web_api.cc @@ -157,7 +157,7 @@ void StartStreamingCompilation(const FunctionCallbackInfo& info) { // Create the wrapper object. std::shared_ptr streaming = - WasmStreaming::Unpack(info.GetIsolate(), info.Data()); + WasmStreaming::Unpack(info.GetIsolate(), info.DataV2()); Environment* env = Environment::GetCurrent(info); Local obj; if (!WasmStreamingObject::Create(env, streaming).ToLocal(&obj)) { diff --git a/test/addons/worker-addon-exit/binding.cc b/test/addons/worker-addon-exit/binding.cc index 312534fa4c74..33ab053c2342 100644 --- a/test/addons/worker-addon-exit/binding.cc +++ b/test/addons/worker-addon-exit/binding.cc @@ -72,7 +72,8 @@ void MyObject::New(const FunctionCallbackInfo& args) { // Invoked as plain function `MyObject(...)`, turn into construct call. const int argc = 1; Local argv[argc] = {args[0]}; - Local cons = args.Data() + Local cons = args.DataV2() + .As() .As() ->GetInternalField(0) .As() diff --git a/test/cctest/test_environment.cc b/test/cctest/test_environment.cc index 04e6c18f5cae..c1bbbbaebe3e 100644 --- a/test/cctest/test_environment.cc +++ b/test/cctest/test_environment.cc @@ -415,7 +415,7 @@ TEST_F(EnvironmentTest, RunAndClearNativeImmediatesSkipsEmptyScope) { context, [](const v8::FunctionCallbackInfo& info) { IntVec* callback_calls = - static_cast(info.Data().As()->Value( + static_cast(info.DataV2().As()->Value( v8::kExternalPointerTypeTagDefault)); callback_calls->push_back(info[0].As()->Value()); }, @@ -772,7 +772,7 @@ TEST_F(EnvironmentTest, NestedMicrotaskQueue) { context, [](const v8::FunctionCallbackInfo& info) { IntVec* callback_calls = - static_cast(info.Data().As()->Value( + static_cast(info.DataV2().As()->Value( v8::kExternalPointerTypeTagDefault)); callback_calls->push_back(info[0].As()->Value()); },