Skip to content

Commit

Permalink
Need to make sure NewNumber is not inlined
Browse files Browse the repository at this point in the history
  • Loading branch information
szegedi committed Jan 23, 2025
1 parent 42fe99a commit 532062b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
22 changes: 22 additions & 0 deletions bindings/profile-translator.cc
Original file line number Diff line number Diff line change
@@ -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.h>

v8::Local<v8::Number> dd::ProfileTranslator::NewNumber(int64_t x) {
return v8::Number::New(isolate, static_cast<double>(x));
}
5 changes: 1 addition & 4 deletions bindings/profile-translator.hh
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ class ProfileTranslator {
return v8::Boolean::New(isolate, x);
}

template <typename T>
v8::Local<v8::Number> NewNumber(T x) {
return v8::Number::New(isolate, x);
}
v8::Local<v8::Number> NewNumber(int64_t x);

v8::Local<v8::Array> NewArray(int length) {
return length == 0 ? emptyArray : v8::Array::New(isolate, length);
Expand Down

0 comments on commit 532062b

Please sign in to comment.