From 532062b8794cd0950ac9dd93a90be63be4eb33a0 Mon Sep 17 00:00:00 2001 From: Attila Szegedi Date: Thu, 23 Jan 2025 16:03:46 +0100 Subject: [PATCH] Need to make sure NewNumber is not inlined --- binding.gyp | 1 + bindings/profile-translator.cc | 22 ++++++++++++++++++++++ bindings/profile-translator.hh | 5 +---- 3 files changed, 24 insertions(+), 4 deletions(-) create mode 100644 bindings/profile-translator.cc diff --git a/binding.gyp b/binding.gyp index d059d3c0..db93a543 100644 --- a/binding.gyp +++ b/binding.gyp @@ -15,6 +15,7 @@ "bindings/profilers/heap.cc", "bindings/profilers/wall.cc", "bindings/per-isolate-data.cc", + "bindings/profile-translator.cc", "bindings/thread-cpu-clock.cc", "bindings/translate-heap-profile.cc", "bindings/translate-time-profile.cc", diff --git a/bindings/profile-translator.cc b/bindings/profile-translator.cc new file mode 100644 index 00000000..de2c18b4 --- /dev/null +++ b/bindings/profile-translator.cc @@ -0,0 +1,22 @@ +/* + * Copyright 2025 Datadog, Inc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "profile-translator.hh" +#include + +v8::Local dd::ProfileTranslator::NewNumber(int64_t x) { + return v8::Number::New(isolate, static_cast(x)); +} diff --git a/bindings/profile-translator.hh b/bindings/profile-translator.hh index 78ce070f..54429c72 100644 --- a/bindings/profile-translator.hh +++ b/bindings/profile-translator.hh @@ -33,10 +33,7 @@ class ProfileTranslator { return v8::Boolean::New(isolate, x); } - template - v8::Local NewNumber(T x) { - return v8::Number::New(isolate, x); - } + v8::Local NewNumber(int64_t x); v8::Local NewArray(int length) { return length == 0 ? emptyArray : v8::Array::New(isolate, length);