Coverage Report

Created: 2025-08-28 09:57

/src/node/src/util.h
Line
Count
Source (jump to first uncovered line)
1
// Copyright Joyent, Inc. and other Node contributors.
2
//
3
// Permission is hereby granted, free of charge, to any person obtaining a
4
// copy of this software and associated documentation files (the
5
// "Software"), to deal in the Software without restriction, including
6
// without limitation the rights to use, copy, modify, merge, publish,
7
// distribute, sublicense, and/or sell copies of the Software, and to permit
8
// persons to whom the Software is furnished to do so, subject to the
9
// following conditions:
10
//
11
// The above copyright notice and this permission notice shall be included
12
// in all copies or substantial portions of the Software.
13
//
14
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20
// USE OR OTHER DEALINGS IN THE SOFTWARE.
21
22
#ifndef SRC_UTIL_H_
23
#define SRC_UTIL_H_
24
25
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
26
27
#include "uv.h"
28
#include "v8.h"
29
30
#include "node.h"
31
#include "node_exit_code.h"
32
33
#include <climits>
34
#include <cstddef>
35
#include <cstdio>
36
#include <cstdlib>
37
#include <cstring>
38
39
#include <array>
40
#include <limits>
41
#include <memory>
42
#include <set>
43
#include <string>
44
#include <string_view>
45
#include <type_traits>
46
#include <unordered_map>
47
#include <utility>
48
#include <vector>
49
50
#ifdef __GNUC__
51
#define MUST_USE_RESULT __attribute__((warn_unused_result))
52
#else
53
#define MUST_USE_RESULT
54
#endif
55
56
namespace node {
57
58
// Maybe remove kPathSeparator when cpp17 is ready
59
#ifdef _WIN32
60
    constexpr char kPathSeparator = '\\';
61
/* MAX_PATH is in characters, not bytes. Make sure we have enough headroom. */
62
#define PATH_MAX_BYTES (MAX_PATH * 4)
63
#else
64
    constexpr char kPathSeparator = '/';
65
0
#define PATH_MAX_BYTES (PATH_MAX)
66
#endif
67
68
// These should be used in our code as opposed to the native
69
// versions as they abstract out some platform and or
70
// compiler version specific functionality
71
// malloc(0) and realloc(ptr, 0) have implementation-defined behavior in
72
// that the standard allows them to either return a unique pointer or a
73
// nullptr for zero-sized allocation requests.  Normalize by always using
74
// a nullptr.
75
template <typename T>
76
inline T* UncheckedRealloc(T* pointer, size_t n);
77
template <typename T>
78
inline T* UncheckedMalloc(size_t n);
79
template <typename T>
80
inline T* UncheckedCalloc(size_t n);
81
82
// Same things, but aborts immediately instead of returning nullptr when
83
// no memory is available.
84
template <typename T>
85
inline T* Realloc(T* pointer, size_t n);
86
template <typename T>
87
inline T* Malloc(size_t n);
88
template <typename T>
89
inline T* Calloc(size_t n);
90
91
inline char* Malloc(size_t n);
92
inline char* Calloc(size_t n);
93
inline char* UncheckedMalloc(size_t n);
94
inline char* UncheckedCalloc(size_t n);
95
96
template <typename T>
97
inline T MultiplyWithOverflowCheck(T a, T b);
98
99
namespace per_process {
100
// Tells whether the per-process V8::Initialize() is called and
101
// if it is safe to call v8::Isolate::TryGetCurrent().
102
extern bool v8_initialized;
103
}  // namespace per_process
104
105
// Used by the allocation functions when allocation fails.
106
// Thin wrapper around v8::Isolate::LowMemoryNotification() that checks
107
// whether V8 is initialized.
108
void LowMemoryNotification();
109
110
// The reason that Assert() takes a struct argument instead of individual
111
// const char*s is to ease instruction cache pressure in calls from CHECK.
112
struct AssertionInfo {
113
  const char* file_line;  // filename:line
114
  const char* message;
115
  const char* function;
116
};
117
118
// This indirectly calls backtrace so it can not be marked as [[noreturn]].
119
void NODE_EXTERN_PRIVATE Assert(const AssertionInfo& info);
120
void DumpNativeBacktrace(FILE* fp);
121
void DumpJavaScriptBacktrace(FILE* fp);
122
123
// Windows 8+ does not like abort() in Release mode
124
#ifdef _WIN32
125
#define ABORT_NO_BACKTRACE() _exit(static_cast<int>(node::ExitCode::kAbort))
126
#else
127
0
#define ABORT_NO_BACKTRACE() abort()
128
#endif
129
130
// Caller of this macro must not be marked as [[noreturn]]. Printing of
131
// backtraces may not work correctly in [[noreturn]] functions because
132
// when generating code for them the compiler can choose not to
133
// maintain the frame pointers or link registers that are necessary for
134
// correct backtracing.
135
// `ABORT` must be a macro and not a [[noreturn]] function to make sure the
136
// backtrace is correct.
137
#define ABORT()                                                                \
138
0
  do {                                                                         \
139
0
    node::DumpNativeBacktrace(stderr);                                         \
140
0
    node::DumpJavaScriptBacktrace(stderr);                                     \
141
0
    fflush(stderr);                                                            \
142
0
    ABORT_NO_BACKTRACE();                                                      \
143
0
  } while (0)
144
145
#define ERROR_AND_ABORT(expr)                                                  \
146
0
  do {                                                                         \
147
0
    /* Make sure that this struct does not end up in inline code, but      */  \
148
0
    /* rather in a read-only data section when modifying this code.        */  \
149
0
    static const node::AssertionInfo args = {                                  \
150
0
        __FILE__ ":" STRINGIFY(__LINE__), #expr, PRETTY_FUNCTION_NAME};        \
151
0
    node::Assert(args);                                                        \
152
0
    /* `node::Assert` doesn't return. Add an [[noreturn]] abort() here to  */  \
153
0
    /* make the compiler happy about no return value in the caller         */  \
154
0
    /* function when calling ERROR_AND_ABORT.                              */  \
155
0
    ABORT_NO_BACKTRACE();                                                      \
156
0
  } while (0)
157
158
#ifdef __GNUC__
159
6.38M
#define LIKELY(expr) __builtin_expect(!!(expr), 1)
160
464M
#define UNLIKELY(expr) __builtin_expect(!!(expr), 0)
Unexecuted instantiation: env.cc:node::Environment::InitializeLibuv()::$_0::operator()(uv_async_s*) const
Unexecuted instantiation: agent.cc:node::tracing::Agent::Agent()::$_0::operator()(uv_async_s*) const
Unexecuted instantiation: agent.cc:node::tracing::Agent::Start()::$_0::operator()(void*) const
161
0
#define PRETTY_FUNCTION_NAME __PRETTY_FUNCTION__
162
#else
163
#define LIKELY(expr) expr
164
#define UNLIKELY(expr) expr
165
#define PRETTY_FUNCTION_NAME ""
166
#endif
167
168
0
#define STRINGIFY_(x) #x
169
0
#define STRINGIFY(x) STRINGIFY_(x)
170
171
#define CHECK(expr)                                                           \
172
249M
  do {                                                                        \
173
249M
    if (UNLIKELY(!(expr))) {                                                  \
174
0
      ERROR_AND_ABORT(expr);                                                  \
175
0
    }                                                                         \
176
249M
  } while (0)
177
178
21.1M
#define CHECK_EQ(a, b) CHECK((a) == (b))
179
1.91M
#define CHECK_GE(a, b) CHECK((a) >= (b))
180
2.55M
#define CHECK_GT(a, b) CHECK((a) > (b))
181
36.1M
#define CHECK_LE(a, b) CHECK((a) <= (b))
182
74.9M
#define CHECK_LT(a, b) CHECK((a) < (b))
183
2.28M
#define CHECK_NE(a, b) CHECK((a) != (b))
184
4.35M
#define CHECK_NULL(val) CHECK((val) == nullptr)
185
26.6M
#define CHECK_NOT_NULL(val) CHECK((val) != nullptr)
186
321k
#define CHECK_IMPLIES(a, b) CHECK(!(a) || (b))
187
188
#ifdef DEBUG
189
  #define DCHECK(expr) CHECK(expr)
190
  #define DCHECK_EQ(a, b) CHECK((a) == (b))
191
  #define DCHECK_GE(a, b) CHECK((a) >= (b))
192
  #define DCHECK_GT(a, b) CHECK((a) > (b))
193
  #define DCHECK_LE(a, b) CHECK((a) <= (b))
194
  #define DCHECK_LT(a, b) CHECK((a) < (b))
195
  #define DCHECK_NE(a, b) CHECK((a) != (b))
196
  #define DCHECK_NULL(val) CHECK((val) == nullptr)
197
  #define DCHECK_NOT_NULL(val) CHECK((val) != nullptr)
198
  #define DCHECK_IMPLIES(a, b) CHECK(!(a) || (b))
199
#else
200
  #define DCHECK(expr)
201
  #define DCHECK_EQ(a, b)
202
  #define DCHECK_GE(a, b)
203
  #define DCHECK_GT(a, b)
204
  #define DCHECK_LE(a, b)
205
  #define DCHECK_LT(a, b)
206
  #define DCHECK_NE(a, b)
207
  #define DCHECK_NULL(val)
208
  #define DCHECK_NOT_NULL(val)
209
  #define DCHECK_IMPLIES(a, b)
210
#endif
211
212
213
#define UNREACHABLE(...)                                                      \
214
0
  ERROR_AND_ABORT("Unreachable code reached" __VA_OPT__(": ") __VA_ARGS__)
215
216
// ECMA262 20.1.2.6 Number.MAX_SAFE_INTEGER (2^53-1)
217
constexpr int64_t kMaxSafeJsInteger = 9007199254740991;
218
219
inline bool IsSafeJsInt(v8::Local<v8::Value> v);
220
221
// TAILQ-style intrusive list node.
222
template <typename T>
223
class ListNode;
224
225
// TAILQ-style intrusive list head.
226
template <typename T, ListNode<T> (T::*M)>
227
class ListHead;
228
229
template <typename T>
230
class ListNode {
231
 public:
232
  inline ListNode();
233
  inline ~ListNode();
234
  inline void Remove();
235
  inline bool IsEmpty() const;
236
237
  ListNode(const ListNode&) = delete;
238
  ListNode& operator=(const ListNode&) = delete;
239
240
 private:
241
  template <typename U, ListNode<U> (U::*M)> friend class ListHead;
242
  friend int GenDebugSymbols();
243
  ListNode* prev_;
244
  ListNode* next_;
245
};
246
247
template <typename T, ListNode<T> (T::*M)>
248
class ListHead {
249
 public:
250
  class Iterator {
251
   public:
252
    inline T* operator*() const;
253
    inline const Iterator& operator++();
254
    inline bool operator!=(const Iterator& that) const;
255
256
   private:
257
    friend class ListHead;
258
    inline explicit Iterator(ListNode<T>* node);
259
    ListNode<T>* node_;
260
  };
261
262
244k
  inline ListHead() = default;
node::ListHead<node::HandleWrap, &node::HandleWrap::handle_wrap_queue_>::ListHead()
Line
Count
Source
262
122k
  inline ListHead() = default;
node::ListHead<node::ReqWrapBase, &node::ReqWrapBase::req_wrap_queue_>::ListHead()
Line
Count
Source
262
122k
  inline ListHead() = default;
Unexecuted instantiation: node::ListHead<node::quic::Stream, &node::quic::Stream::stream_queue_>::ListHead()
263
  inline ~ListHead();
264
  inline void PushBack(T* element);
265
  inline void PushFront(T* element);
266
  inline bool IsEmpty() const;
267
  inline T* PopFront();
268
  inline Iterator begin() const;
269
  inline Iterator end() const;
270
271
  ListHead(const ListHead&) = delete;
272
  ListHead& operator=(const ListHead&) = delete;
273
274
 private:
275
  friend int GenDebugSymbols();
276
  ListNode<T> head_;
277
};
278
279
// The helper is for doing safe downcasts from base types to derived types.
280
template <typename Inner, typename Outer>
281
class ContainerOfHelper {
282
 public:
283
  inline ContainerOfHelper(Inner Outer::*field, Inner* pointer);
284
  template <typename TypeName>
285
  inline operator TypeName*() const;
286
 private:
287
  Outer* const pointer_;
288
};
289
290
// Calculate the address of the outer (i.e. embedding) struct from
291
// the interior pointer to a data member.
292
template <typename Inner, typename Outer>
293
constexpr ContainerOfHelper<Inner, Outer> ContainerOf(Inner Outer::*field,
294
                                                      Inner* pointer);
295
296
class KVStore {
297
 public:
298
122k
  KVStore() = default;
299
0
  virtual ~KVStore() = default;
300
  KVStore(const KVStore&) = delete;
301
  KVStore& operator=(const KVStore&) = delete;
302
  KVStore(KVStore&&) = delete;
303
  KVStore& operator=(KVStore&&) = delete;
304
305
  virtual v8::MaybeLocal<v8::String> Get(v8::Isolate* isolate,
306
                                         v8::Local<v8::String> key) const = 0;
307
  virtual v8::Maybe<std::string> Get(const char* key) const = 0;
308
  virtual void Set(v8::Isolate* isolate,
309
                   v8::Local<v8::String> key,
310
                   v8::Local<v8::String> value) = 0;
311
  virtual int32_t Query(v8::Isolate* isolate,
312
                        v8::Local<v8::String> key) const = 0;
313
  virtual int32_t Query(const char* key) const = 0;
314
  virtual void Delete(v8::Isolate* isolate, v8::Local<v8::String> key) = 0;
315
  virtual v8::Local<v8::Array> Enumerate(v8::Isolate* isolate) const = 0;
316
317
  virtual std::shared_ptr<KVStore> Clone(v8::Isolate* isolate) const;
318
  virtual v8::Maybe<bool> AssignFromObject(v8::Local<v8::Context> context,
319
                                           v8::Local<v8::Object> entries);
320
  v8::Maybe<bool> AssignToObject(v8::Isolate* isolate,
321
                                 v8::Local<v8::Context> context,
322
                                 v8::Local<v8::Object> object);
323
324
  static std::shared_ptr<KVStore> CreateMapKVStore();
325
};
326
327
// Convenience wrapper around v8::String::NewFromOneByte().
328
inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate,
329
                                           const char* data,
330
                                           int length = -1);
331
332
// For the people that compile with -funsigned-char.
333
inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate,
334
                                           const signed char* data,
335
                                           int length = -1);
336
337
inline v8::Local<v8::String> OneByteString(v8::Isolate* isolate,
338
                                           const unsigned char* data,
339
                                           int length = -1);
340
341
// Used to be a macro, hence the uppercase name.
342
template <int N>
343
inline v8::Local<v8::String> FIXED_ONE_BYTE_STRING(
344
    v8::Isolate* isolate,
345
93.1M
    const char(&data)[N]) {
346
93.1M
  return OneByteString(isolate, data, N - 1);
347
93.1M
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<33>(v8::Isolate*, char const (&) [33])
Line
Count
Source
345
488k
    const char(&data)[N]) {
346
488k
  return OneByteString(isolate, data, N - 1);
347
488k
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<7>(v8::Isolate*, char const (&) [7])
Line
Count
Source
345
10.9M
    const char(&data)[N]) {
346
10.9M
  return OneByteString(isolate, data, N - 1);
347
10.9M
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<10>(v8::Isolate*, char const (&) [10])
Line
Count
Source
345
2.21M
    const char(&data)[N]) {
346
2.21M
  return OneByteString(isolate, data, N - 1);
347
2.21M
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<5>(v8::Isolate*, char const (&) [5])
Line
Count
Source
345
1.47M
    const char(&data)[N]) {
346
1.47M
  return OneByteString(isolate, data, N - 1);
347
1.47M
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<16>(v8::Isolate*, char const (&) [16])
Line
Count
Source
345
11.7M
    const char(&data)[N]) {
346
11.7M
  return OneByteString(isolate, data, N - 1);
347
11.7M
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<12>(v8::Isolate*, char const (&) [12])
Line
Count
Source
345
13.6M
    const char(&data)[N]) {
346
13.6M
  return OneByteString(isolate, data, N - 1);
347
13.6M
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<6>(v8::Isolate*, char const (&) [6])
Line
Count
Source
345
936k
    const char(&data)[N]) {
346
936k
  return OneByteString(isolate, data, N - 1);
347
936k
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<8>(v8::Isolate*, char const (&) [8])
Line
Count
Source
345
33.7M
    const char(&data)[N]) {
346
33.7M
  return OneByteString(isolate, data, N - 1);
347
33.7M
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<18>(v8::Isolate*, char const (&) [18])
Line
Count
Source
345
1.35M
    const char(&data)[N]) {
346
1.35M
  return OneByteString(isolate, data, N - 1);
347
1.35M
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<26>(v8::Isolate*, char const (&) [26])
Line
Count
Source
345
246k
    const char(&data)[N]) {
346
246k
  return OneByteString(isolate, data, N - 1);
347
246k
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<9>(v8::Isolate*, char const (&) [9])
Line
Count
Source
345
1.67M
    const char(&data)[N]) {
346
1.67M
  return OneByteString(isolate, data, N - 1);
347
1.67M
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<23>(v8::Isolate*, char const (&) [23])
Line
Count
Source
345
490k
    const char(&data)[N]) {
346
490k
  return OneByteString(isolate, data, N - 1);
347
490k
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<28>(v8::Isolate*, char const (&) [28])
Line
Count
Source
345
244k
    const char(&data)[N]) {
346
244k
  return OneByteString(isolate, data, N - 1);
347
244k
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<13>(v8::Isolate*, char const (&) [13])
Line
Count
Source
345
2.53M
    const char(&data)[N]) {
346
2.53M
  return OneByteString(isolate, data, N - 1);
347
2.53M
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<11>(v8::Isolate*, char const (&) [11])
Line
Count
Source
345
2.08M
    const char(&data)[N]) {
346
2.08M
  return OneByteString(isolate, data, N - 1);
347
2.08M
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<19>(v8::Isolate*, char const (&) [19])
Line
Count
Source
345
1.24M
    const char(&data)[N]) {
346
1.24M
  return OneByteString(isolate, data, N - 1);
347
1.24M
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<14>(v8::Isolate*, char const (&) [14])
Line
Count
Source
345
2.09M
    const char(&data)[N]) {
346
2.09M
  return OneByteString(isolate, data, N - 1);
347
2.09M
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<20>(v8::Isolate*, char const (&) [20])
Line
Count
Source
345
453k
    const char(&data)[N]) {
346
453k
  return OneByteString(isolate, data, N - 1);
347
453k
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<15>(v8::Isolate*, char const (&) [15])
Line
Count
Source
345
1.34M
    const char(&data)[N]) {
346
1.34M
  return OneByteString(isolate, data, N - 1);
347
1.34M
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<17>(v8::Isolate*, char const (&) [17])
Line
Count
Source
345
1.09M
    const char(&data)[N]) {
346
1.09M
  return OneByteString(isolate, data, N - 1);
347
1.09M
}
Unexecuted instantiation: v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<3>(v8::Isolate*, char const (&) [3])
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<34>(v8::Isolate*, char const (&) [34])
Line
Count
Source
345
366k
    const char(&data)[N]) {
346
366k
  return OneByteString(isolate, data, N - 1);
347
366k
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<22>(v8::Isolate*, char const (&) [22])
Line
Count
Source
345
131k
    const char(&data)[N]) {
346
131k
  return OneByteString(isolate, data, N - 1);
347
131k
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<21>(v8::Isolate*, char const (&) [21])
Line
Count
Source
345
315k
    const char(&data)[N]) {
346
315k
  return OneByteString(isolate, data, N - 1);
347
315k
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<27>(v8::Isolate*, char const (&) [27])
Line
Count
Source
345
490k
    const char(&data)[N]) {
346
490k
  return OneByteString(isolate, data, N - 1);
347
490k
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<2>(v8::Isolate*, char const (&) [2])
Line
Count
Source
345
141k
    const char(&data)[N]) {
346
141k
  return OneByteString(isolate, data, N - 1);
347
141k
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<25>(v8::Isolate*, char const (&) [25])
Line
Count
Source
345
490k
    const char(&data)[N]) {
346
490k
  return OneByteString(isolate, data, N - 1);
347
490k
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<31>(v8::Isolate*, char const (&) [31])
Line
Count
Source
345
1.82k
    const char(&data)[N]) {
346
1.82k
  return OneByteString(isolate, data, N - 1);
347
1.82k
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<29>(v8::Isolate*, char const (&) [29])
Line
Count
Source
345
246k
    const char(&data)[N]) {
346
246k
  return OneByteString(isolate, data, N - 1);
347
246k
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<4>(v8::Isolate*, char const (&) [4])
Line
Count
Source
345
372k
    const char(&data)[N]) {
346
372k
  return OneByteString(isolate, data, N - 1);
347
372k
}
Unexecuted instantiation: v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<45>(v8::Isolate*, char const (&) [45])
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<35>(v8::Isolate*, char const (&) [35])
Line
Count
Source
345
122k
    const char(&data)[N]) {
346
122k
  return OneByteString(isolate, data, N - 1);
347
122k
}
Unexecuted instantiation: v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<49>(v8::Isolate*, char const (&) [49])
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<39>(v8::Isolate*, char const (&) [39])
Line
Count
Source
345
122k
    const char(&data)[N]) {
346
122k
  return OneByteString(isolate, data, N - 1);
347
122k
}
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<37>(v8::Isolate*, char const (&) [37])
Line
Count
Source
345
122k
    const char(&data)[N]) {
346
122k
  return OneByteString(isolate, data, N - 1);
347
122k
}
Unexecuted instantiation: v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<30>(v8::Isolate*, char const (&) [30])
v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<24>(v8::Isolate*, char const (&) [24])
Line
Count
Source
345
122k
    const char(&data)[N]) {
346
122k
  return OneByteString(isolate, data, N - 1);
347
122k
}
Unexecuted instantiation: v8::Local<v8::String> node::FIXED_ONE_BYTE_STRING<36>(v8::Isolate*, char const (&) [36])
348
349
template <std::size_t N>
350
inline v8::Local<v8::String> FIXED_ONE_BYTE_STRING(
351
    v8::Isolate* isolate,
352
0
    const std::array<char, N>& arr) {
353
0
  return OneByteString(isolate, arr.data(), N - 1);
354
0
}
355
356
357
358
// Swaps bytes in place. nbytes is the number of bytes to swap and must be a
359
// multiple of the word size (checked by function).
360
inline void SwapBytes16(char* data, size_t nbytes);
361
inline void SwapBytes32(char* data, size_t nbytes);
362
inline void SwapBytes64(char* data, size_t nbytes);
363
364
// tolower() is locale-sensitive.  Use ToLower() instead.
365
inline char ToLower(char c);
366
inline std::string ToLower(const std::string& in);
367
368
// toupper() is locale-sensitive.  Use ToUpper() instead.
369
inline char ToUpper(char c);
370
inline std::string ToUpper(const std::string& in);
371
372
// strcasecmp() is locale-sensitive.  Use StringEqualNoCase() instead.
373
inline bool StringEqualNoCase(const char* a, const char* b);
374
375
// strncasecmp() is locale-sensitive.  Use StringEqualNoCaseN() instead.
376
inline bool StringEqualNoCaseN(const char* a, const char* b, size_t length);
377
378
template <typename T, size_t N>
379
23.7M
constexpr size_t arraysize(const T (&)[N]) {
380
23.7M
  return N;
381
23.7M
}
unsigned long node::arraysize<v8::Local<v8::Value>, 2ul>(v8::Local<v8::Value> const (&) [2ul])
Line
Count
Source
379
822k
constexpr size_t arraysize(const T (&)[N]) {
380
822k
  return N;
381
822k
}
unsigned long node::arraysize<v8::Local<v8::Value>, 1024ul>(v8::Local<v8::Value> const (&) [1024ul])
Line
Count
Source
379
1.17k
constexpr size_t arraysize(const T (&)[N]) {
380
1.17k
  return N;
381
1.17k
}
unsigned long node::arraysize<v8::Local<v8::Value>, 3ul>(v8::Local<v8::Value> const (&) [3ul])
Line
Count
Source
379
152k
constexpr size_t arraysize(const T (&)[N]) {
380
152k
  return N;
381
152k
}
unsigned long node::arraysize<v8::Local<v8::Value>, 4ul>(v8::Local<v8::Value> const (&) [4ul])
Line
Count
Source
379
1.06k
constexpr size_t arraysize(const T (&)[N]) {
380
1.06k
  return N;
381
1.06k
}
Unexecuted instantiation: unsigned long node::arraysize<ares_addrttl, 256ul>(ares_addrttl const (&) [256ul])
Unexecuted instantiation: unsigned long node::arraysize<ares_addr6ttl, 256ul>(ares_addr6ttl const (&) [256ul])
unsigned long node::arraysize<v8::Local<v8::Value>, 8ul>(v8::Local<v8::Value> const (&) [8ul])
Line
Count
Source
379
2
constexpr size_t arraysize(const T (&)[N]) {
380
2
  return N;
381
2
}
unsigned long node::arraysize<v8::Local<v8::Value>, 1ul>(v8::Local<v8::Value> const (&) [1ul])
Line
Count
Source
379
162k
constexpr size_t arraysize(const T (&)[N]) {
380
162k
  return N;
381
162k
}
Unexecuted instantiation: unsigned long node::arraysize<v8::Local<v8::Value>, 16ul>(v8::Local<v8::Value> const (&) [16ul])
unsigned long node::arraysize<char, 1024ul>(char const (&) [1024ul])
Line
Count
Source
379
15.3M
constexpr size_t arraysize(const T (&)[N]) {
380
15.3M
  return N;
381
15.3M
}
unsigned long node::arraysize<v8::Local<v8::Value>, 128ul>(v8::Local<v8::Value> const (&) [128ul])
Line
Count
Source
379
4.88M
constexpr size_t arraysize(const T (&)[N]) {
380
4.88M
  return N;
381
4.88M
}
Unexecuted instantiation: unsigned long node::arraysize<unsigned int, 64ul>(unsigned int const (&) [64ul])
Unexecuted instantiation: unsigned long node::arraysize<__user_cap_data_struct, 2ul>(__user_cap_data_struct const (&) [2ul])
unsigned long node::arraysize<char, 64ul>(char const (&) [64ul])
Line
Count
Source
379
3.88k
constexpr size_t arraysize(const T (&)[N]) {
380
3.88k
  return N;
381
3.88k
}
Unexecuted instantiation: unsigned long node::arraysize<v8::Local<v8::Value>, 64ul>(v8::Local<v8::Value> const (&) [64ul])
unsigned long node::arraysize<char, 256ul>(char const (&) [256ul])
Line
Count
Source
379
1.79M
constexpr size_t arraysize(const T (&)[N]) {
380
1.79M
  return N;
381
1.79M
}
Unexecuted instantiation: unsigned long node::arraysize<v8::Local<v8::Value>, 256ul>(v8::Local<v8::Value> const (&) [256ul])
Unexecuted instantiation: unsigned long node::arraysize<char, 70ul>(char const (&) [70ul])
Unexecuted instantiation: unsigned long node::arraysize<uv_buf_t, 1024ul>(uv_buf_t const (&) [1024ul])
Unexecuted instantiation: node_http_parser.cc:unsigned long node::arraysize<node::(anonymous namespace)::StringPtr, 32ul>(node::(anonymous namespace)::StringPtr const (&) [32ul])
Unexecuted instantiation: unsigned long node::arraysize<v8::Local<v8::Value>, 9ul>(v8::Local<v8::Value> const (&) [9ul])
Unexecuted instantiation: unsigned long node::arraysize<v8::Local<v8::Value>, 6ul>(v8::Local<v8::Value> const (&) [6ul])
Unexecuted instantiation: unsigned long node::arraysize<unsigned char, 8ul>(unsigned char const (&) [8ul])
Unexecuted instantiation: unsigned long node::arraysize<v8::Local<v8::Value>, 14ul>(v8::Local<v8::Value> const (&) [14ul])
Unexecuted instantiation: unsigned long node::arraysize<v8::Local<v8::Value>, 5ul>(v8::Local<v8::Value> const (&) [5ul])
Unexecuted instantiation: unsigned long node::arraysize<v8::Local<v8::Value>, 32ul>(v8::Local<v8::Value> const (&) [32ul])
Unexecuted instantiation: unsigned long node::arraysize<uv_buf_t, 32ul>(uv_buf_t const (&) [32ul])
Unexecuted instantiation: unsigned long node::arraysize<char, 3000ul>(char const (&) [3000ul])
Unexecuted instantiation: unsigned long node::arraysize<unsigned char, 1024ul>(unsigned char const (&) [1024ul])
unsigned long node::arraysize<char16_t, 1024ul>(char16_t const (&) [1024ul])
Line
Count
Source
379
369k
constexpr size_t arraysize(const T (&)[N]) {
380
369k
  return N;
381
369k
}
Unexecuted instantiation: unsigned long node::arraysize<char16_t, 256ul>(char16_t const (&) [256ul])
unsigned long node::arraysize<std::__1::pair<std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::basic_string_view<char, std::__1::char_traits<char> > >, 25ul>(std::__1::pair<std::__1::basic_string_view<char, std::__1::char_traits<char> >, std::__1::basic_string_view<char, std::__1::char_traits<char> > > const (&) [25ul])
Line
Count
Source
379
122k
constexpr size_t arraysize(const T (&)[N]) {
380
122k
  return N;
381
122k
}
Unexecuted instantiation: unsigned long node::arraysize<void*, 256ul>(void* const (&) [256ul])
Unexecuted instantiation: node_report.cc:unsigned long node::arraysize<node::report::PrintSystemInformation(node::JSONWriter*)::$_0, 10ul>(node::report::PrintSystemInformation(node::JSONWriter*)::$_0 const (&) [10ul])
Unexecuted instantiation: unsigned long node::arraysize<uv_buf_t, 16ul>(uv_buf_t const (&) [16ul])
Unexecuted instantiation: unsigned long node::arraysize<char, 10ul>(char const (&) [10ul])
Unexecuted instantiation: unsigned long node::arraysize<unsigned short, 1024ul>(unsigned short const (&) [1024ul])
unsigned long node::arraysize<node::per_process::UVError, 84ul>(node::per_process::UVError const (&) [84ul])
Line
Count
Source
379
83.0k
constexpr size_t arraysize(const T (&)[N]) {
380
83.0k
  return N;
381
83.0k
}
unsigned long node::arraysize<char const*, 147ul>(char const* const (&) [147ul])
Line
Count
Source
379
148
constexpr size_t arraysize(const T (&)[N]) {
380
148
  return N;
381
148
}
Unexecuted instantiation: unsigned long node::arraysize<char*, 10ul>(char* const (&) [10ul])
Unexecuted instantiation: unsigned long node::arraysize<char const*, 24ul>(char const* const (&) [24ul])
Unexecuted instantiation: unsigned long node::arraysize<char const*, 5ul>(char const* const (&) [5ul])
Unexecuted instantiation: unsigned long node::arraysize<unsigned int, 3ul>(unsigned int const (&) [3ul])
Unexecuted instantiation: unsigned long node::arraysize<unsigned char, 1200ul>(unsigned char const (&) [1200ul])
Unexecuted instantiation: unsigned long node::arraysize<v8::Local<v8::Value>, 7ul>(v8::Local<v8::Value> const (&) [7ul])
Unexecuted instantiation: unsigned long node::arraysize<ngtcp2_cid, 10ul>(ngtcp2_cid const (&) [10ul])
Unexecuted instantiation: unsigned long node::arraysize<ngtcp2_cid_token, 10ul>(ngtcp2_cid_token const (&) [10ul])
Unexecuted instantiation: unsigned long node::arraysize<ngtcp2_vec, 16ul>(ngtcp2_vec const (&) [16ul])
Unexecuted instantiation: unsigned long node::arraysize<char, 32ul>(char const (&) [32ul])
Unexecuted instantiation: unsigned long node::arraysize<char, 40ul>(char const (&) [40ul])
382
383
template <typename T, size_t N>
384
constexpr size_t strsize(const T (&)[N]) {
385
  return N - 1;
386
}
387
388
// Allocates an array of member type T. For up to kStackStorageSize items,
389
// the stack is used, otherwise malloc().
390
template <typename T, size_t kStackStorageSize = 1024>
391
class MaybeStackBuffer {
392
 public:
393
170k
  const T* out() const {
394
170k
    return buf_;
395
170k
  }
396
397
20.9M
  T* out() {
398
20.9M
    return buf_;
399
20.9M
  }
node::MaybeStackBuffer<char, 1024ul>::out()
Line
Count
Source
397
15.3M
  T* out() {
398
15.3M
    return buf_;
399
15.3M
  }
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 8ul>::out()
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 16ul>::out()
node::MaybeStackBuffer<v8::Local<v8::Value>, 128ul>::out()
Line
Count
Source
397
4.88M
  T* out() {
398
4.88M
    return buf_;
399
4.88M
  }
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 64ul>::out()
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 256ul>::out()
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 32ul>::out()
Unexecuted instantiation: node::MaybeStackBuffer<char, 3000ul>::out()
node::MaybeStackBuffer<char16_t, 1024ul>::out()
Line
Count
Source
397
738k
  T* out() {
398
738k
    return buf_;
399
738k
  }
Unexecuted instantiation: node::MaybeStackBuffer<char16_t, 256ul>::out()
Unexecuted instantiation: node::MaybeStackBuffer<unsigned short, 1024ul>::out()
node::MaybeStackBuffer<v8::Local<v8::Value>, 1024ul>::out()
Line
Count
Source
397
1.17k
  T* out() {
398
1.17k
    return buf_;
399
1.17k
  }
Unexecuted instantiation: node::MaybeStackBuffer<unsigned char, 1200ul>::out()
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid, 10ul>::out()
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid_token, 10ul>::out()
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 5ul>::out()
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_vec, 16ul>::out()
Unexecuted instantiation: node::MaybeStackBuffer<char, 32ul>::out()
400
401
  // operator* for compatibility with `v8::String::(Utf8)Value`
402
17.1M
  T* operator*() {
403
17.1M
    return buf_;
404
17.1M
  }
node::MaybeStackBuffer<char, 1024ul>::operator*()
Line
Count
Source
402
15.1M
  T* operator*() {
403
15.1M
    return buf_;
404
15.1M
  }
Unexecuted instantiation: node::MaybeStackBuffer<unsigned short, 1024ul>::operator*()
Unexecuted instantiation: node::MaybeStackBuffer<unsigned int, 64ul>::operator*()
Unexecuted instantiation: node::MaybeStackBuffer<char, 64ul>::operator*()
node::MaybeStackBuffer<char, 256ul>::operator*()
Line
Count
Source
402
1.91M
  T* operator*() {
403
1.91M
    return buf_;
404
1.91M
  }
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 1024ul>::operator*()
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 32ul>::operator*()
Unexecuted instantiation: node::MaybeStackBuffer<char, 3000ul>::operator*()
Unexecuted instantiation: node::MaybeStackBuffer<unsigned char, 1024ul>::operator*()
Unexecuted instantiation: node::MaybeStackBuffer<char16_t, 1024ul>::operator*()
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 16ul>::operator*()
405
406
3.36k
  const T* operator*() const {
407
3.36k
    return buf_;
408
3.36k
  }
Unexecuted instantiation: node::MaybeStackBuffer<char, 64ul>::operator*() const
Unexecuted instantiation: node::MaybeStackBuffer<char, 3000ul>::operator*() const
node::MaybeStackBuffer<char, 1024ul>::operator*() const
Line
Count
Source
406
3.36k
  const T* operator*() const {
407
3.36k
    return buf_;
408
3.36k
  }
409
410
45.3M
  T& operator[](size_t index) {
411
45.3M
    CHECK_LT(index, length());
412
45.3M
    return buf_[index];
413
45.3M
  }
node::MaybeStackBuffer<v8::Local<v8::Value>, 1024ul>::operator[](unsigned long)
Line
Count
Source
410
1.17k
  T& operator[](size_t index) {
411
1.17k
    CHECK_LT(index, length());
412
1.17k
    return buf_[index];
413
1.17k
  }
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 8ul>::operator[](unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 16ul>::operator[](unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<unsigned short, 1024ul>::operator[](unsigned long)
node::MaybeStackBuffer<v8::Local<v8::Value>, 128ul>::operator[](unsigned long)
Line
Count
Source
410
45.3M
  T& operator[](size_t index) {
411
45.3M
    CHECK_LT(index, length());
412
45.3M
    return buf_[index];
413
45.3M
  }
Unexecuted instantiation: node::MaybeStackBuffer<unsigned int, 64ul>::operator[](unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 64ul>::operator[](unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 256ul>::operator[](unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 1024ul>::operator[](unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 32ul>::operator[](unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 32ul>::operator[](unsigned long)
node::MaybeStackBuffer<char, 1024ul>::operator[](unsigned long)
Line
Count
Source
410
4
  T& operator[](size_t index) {
411
4
    CHECK_LT(index, length());
412
4
    return buf_[index];
413
4
  }
Unexecuted instantiation: node::MaybeStackBuffer<char16_t, 1024ul>::operator[](unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 16ul>::operator[](unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid, 10ul>::operator[](unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid_token, 10ul>::operator[](unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 5ul>::operator[](unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_vec, 16ul>::operator[](unsigned long)
414
415
0
  const T& operator[](size_t index) const {
416
0
    CHECK_LT(index, length());
417
0
    return buf_[index];
418
0
  }
Unexecuted instantiation: node::MaybeStackBuffer<char, 1024ul>::operator[](unsigned long) const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 8ul>::operator[](unsigned long) const
419
420
50.6M
  size_t length() const {
421
50.6M
    return length_;
422
50.6M
  }
node::MaybeStackBuffer<char, 1024ul>::length() const
Line
Count
Source
420
405k
  size_t length() const {
421
405k
    return length_;
422
405k
  }
node::MaybeStackBuffer<v8::Local<v8::Value>, 1024ul>::length() const
Line
Count
Source
420
2.35k
  size_t length() const {
421
2.35k
    return length_;
422
2.35k
  }
node::MaybeStackBuffer<v8::Local<v8::Value>, 8ul>::length() const
Line
Count
Source
420
2
  size_t length() const {
421
2
    return length_;
422
2
  }
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 16ul>::length() const
Unexecuted instantiation: node::MaybeStackBuffer<unsigned short, 1024ul>::length() const
node::MaybeStackBuffer<v8::Local<v8::Value>, 128ul>::length() const
Line
Count
Source
420
50.2M
  size_t length() const {
421
50.2M
    return length_;
422
50.2M
  }
Unexecuted instantiation: node::MaybeStackBuffer<unsigned int, 64ul>::length() const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 64ul>::length() const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 256ul>::length() const
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 1024ul>::length() const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 32ul>::length() const
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 32ul>::length() const
Unexecuted instantiation: node::MaybeStackBuffer<char, 3000ul>::length() const
Unexecuted instantiation: node::MaybeStackBuffer<char16_t, 1024ul>::length() const
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 16ul>::length() const
Unexecuted instantiation: node::MaybeStackBuffer<unsigned char, 1200ul>::length() const
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid, 10ul>::length() const
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid_token, 10ul>::length() const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 5ul>::length() const
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_vec, 16ul>::length() const
Unexecuted instantiation: node::MaybeStackBuffer<char, 32ul>::length() const
423
424
  // Current maximum capacity of the buffer with which SetLength() can be used
425
  // without first calling AllocateSufficientStorage().
426
56.1M
  size_t capacity() const {
427
56.1M
    return capacity_;
428
56.1M
  }
node::MaybeStackBuffer<v8::Local<v8::Value>, 1024ul>::capacity() const
Line
Count
Source
426
1.17k
  size_t capacity() const {
427
1.17k
    return capacity_;
428
1.17k
  }
node::MaybeStackBuffer<char, 1024ul>::capacity() const
Line
Count
Source
426
46.0M
  size_t capacity() const {
427
46.0M
    return capacity_;
428
46.0M
  }
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 8ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 16ul>::capacity() const
node::MaybeStackBuffer<v8::Local<v8::Value>, 128ul>::capacity() const
Line
Count
Source
426
9.77M
  size_t capacity() const {
427
9.77M
    return capacity_;
428
9.77M
  }
Unexecuted instantiation: node::MaybeStackBuffer<unsigned int, 64ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 64ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<char, 64ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<char, 256ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 256ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 1024ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 32ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 32ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<char, 3000ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<unsigned char, 1024ul>::capacity() const
node::MaybeStackBuffer<char16_t, 1024ul>::capacity() const
Line
Count
Source
426
369k
  size_t capacity() const {
427
369k
    return capacity_;
428
369k
  }
Unexecuted instantiation: node::MaybeStackBuffer<char16_t, 256ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 16ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<unsigned short, 1024ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<unsigned char, 1200ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid, 10ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid_token, 10ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 5ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_vec, 16ul>::capacity() const
Unexecuted instantiation: node::MaybeStackBuffer<char, 32ul>::capacity() const
429
430
  // Make sure enough space for `storage` entries is available.
431
  // This method can be called multiple times throughout the lifetime of the
432
  // buffer, but once this has been called Invalidate() cannot be used.
433
  // Content of the buffer in the range [0, length()) is preserved.
434
  void AllocateSufficientStorage(size_t storage);
435
436
20.2M
  void SetLength(size_t length) {
437
    // capacity() returns how much memory is actually available.
438
20.2M
    CHECK_LE(length, capacity());
439
20.2M
    length_ = length;
440
20.2M
  }
node::MaybeStackBuffer<char, 1024ul>::SetLength(unsigned long)
Line
Count
Source
436
15.3M
  void SetLength(size_t length) {
437
    // capacity() returns how much memory is actually available.
438
15.3M
    CHECK_LE(length, capacity());
439
15.3M
    length_ = length;
440
15.3M
  }
node::MaybeStackBuffer<v8::Local<v8::Value>, 128ul>::SetLength(unsigned long)
Line
Count
Source
436
4.88M
  void SetLength(size_t length) {
437
    // capacity() returns how much memory is actually available.
438
4.88M
    CHECK_LE(length, capacity());
439
4.88M
    length_ = length;
440
4.88M
  }
Unexecuted instantiation: node::MaybeStackBuffer<char, 64ul>::SetLength(unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<char16_t, 1024ul>::SetLength(unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<unsigned short, 1024ul>::SetLength(unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<unsigned char, 1200ul>::SetLength(unsigned long)
441
442
15.3M
  void SetLengthAndZeroTerminate(size_t length) {
443
    // capacity() returns how much memory is actually available.
444
15.3M
    CHECK_LE(length + 1, capacity());
445
15.3M
    SetLength(length);
446
447
    // T() is 0 for integer types, nullptr for pointers, etc.
448
15.3M
    buf_[length] = T();
449
15.3M
  }
Unexecuted instantiation: node::MaybeStackBuffer<char, 64ul>::SetLengthAndZeroTerminate(unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<unsigned short, 1024ul>::SetLengthAndZeroTerminate(unsigned long)
node::MaybeStackBuffer<char, 1024ul>::SetLengthAndZeroTerminate(unsigned long)
Line
Count
Source
442
15.3M
  void SetLengthAndZeroTerminate(size_t length) {
443
    // capacity() returns how much memory is actually available.
444
15.3M
    CHECK_LE(length + 1, capacity());
445
15.3M
    SetLength(length);
446
447
    // T() is 0 for integer types, nullptr for pointers, etc.
448
15.3M
    buf_[length] = T();
449
15.3M
  }
450
451
  // Make dereferencing this object return nullptr.
452
  // This method can be called multiple times throughout the lifetime of the
453
  // buffer, but once this has been called AllocateSufficientStorage() cannot
454
  // be used.
455
0
  void Invalidate() {
456
0
    CHECK(!IsAllocated());
457
0
    capacity_ = 0;
458
0
    length_ = 0;
459
0
    buf_ = nullptr;
460
0
  }
461
462
  // If the buffer is stored in the heap rather than on the stack.
463
22.5M
  bool IsAllocated() const {
464
22.5M
    return !IsInvalidated() && buf_ != buf_st_;
465
22.5M
  }
node::MaybeStackBuffer<v8::Local<v8::Value>, 1024ul>::IsAllocated() const
Line
Count
Source
463
1.17k
  bool IsAllocated() const {
464
1.17k
    return !IsInvalidated() && buf_ != buf_st_;
465
1.17k
  }
node::MaybeStackBuffer<char, 1024ul>::IsAllocated() const
Line
Count
Source
463
15.4M
  bool IsAllocated() const {
464
15.4M
    return !IsInvalidated() && buf_ != buf_st_;
465
15.4M
  }
node::MaybeStackBuffer<v8::Local<v8::Value>, 8ul>::IsAllocated() const
Line
Count
Source
463
2
  bool IsAllocated() const {
464
2
    return !IsInvalidated() && buf_ != buf_st_;
465
2
  }
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 16ul>::IsAllocated() const
Unexecuted instantiation: node::MaybeStackBuffer<unsigned short, 1024ul>::IsAllocated() const
node::MaybeStackBuffer<v8::Local<v8::Value>, 128ul>::IsAllocated() const
Line
Count
Source
463
5.00M
  bool IsAllocated() const {
464
5.00M
    return !IsInvalidated() && buf_ != buf_st_;
465
5.00M
  }
Unexecuted instantiation: node::MaybeStackBuffer<unsigned int, 64ul>::IsAllocated() const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 64ul>::IsAllocated() const
node::MaybeStackBuffer<char, 64ul>::IsAllocated() const
Line
Count
Source
463
3.88k
  bool IsAllocated() const {
464
3.88k
    return !IsInvalidated() && buf_ != buf_st_;
465
3.88k
  }
node::MaybeStackBuffer<char, 256ul>::IsAllocated() const
Line
Count
Source
463
1.79M
  bool IsAllocated() const {
464
1.79M
    return !IsInvalidated() && buf_ != buf_st_;
465
1.79M
  }
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 256ul>::IsAllocated() const
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 1024ul>::IsAllocated() const
Unexecuted instantiation: node::MaybeStackBuffer<char, 3000ul>::IsAllocated() const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 32ul>::IsAllocated() const
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 32ul>::IsAllocated() const
Unexecuted instantiation: node::MaybeStackBuffer<unsigned char, 1024ul>::IsAllocated() const
node::MaybeStackBuffer<char16_t, 1024ul>::IsAllocated() const
Line
Count
Source
463
369k
  bool IsAllocated() const {
464
369k
    return !IsInvalidated() && buf_ != buf_st_;
465
369k
  }
Unexecuted instantiation: node::MaybeStackBuffer<char16_t, 256ul>::IsAllocated() const
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 16ul>::IsAllocated() const
Unexecuted instantiation: node::MaybeStackBuffer<unsigned char, 1200ul>::IsAllocated() const
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid, 10ul>::IsAllocated() const
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid_token, 10ul>::IsAllocated() const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 5ul>::IsAllocated() const
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_vec, 16ul>::IsAllocated() const
Unexecuted instantiation: node::MaybeStackBuffer<char, 32ul>::IsAllocated() const
466
467
  // If Invalidate() has been called.
468
43.1M
  bool IsInvalidated() const {
469
43.1M
    return buf_ == nullptr;
470
43.1M
  }
node::MaybeStackBuffer<v8::Local<v8::Value>, 1024ul>::IsInvalidated() const
Line
Count
Source
468
2.35k
  bool IsInvalidated() const {
469
2.35k
    return buf_ == nullptr;
470
2.35k
  }
node::MaybeStackBuffer<char, 1024ul>::IsInvalidated() const
Line
Count
Source
468
30.7M
  bool IsInvalidated() const {
469
30.7M
    return buf_ == nullptr;
470
30.7M
  }
node::MaybeStackBuffer<v8::Local<v8::Value>, 8ul>::IsInvalidated() const
Line
Count
Source
468
2
  bool IsInvalidated() const {
469
2
    return buf_ == nullptr;
470
2
  }
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 16ul>::IsInvalidated() const
Unexecuted instantiation: node::MaybeStackBuffer<unsigned short, 1024ul>::IsInvalidated() const
node::MaybeStackBuffer<v8::Local<v8::Value>, 128ul>::IsInvalidated() const
Line
Count
Source
468
9.89M
  bool IsInvalidated() const {
469
9.89M
    return buf_ == nullptr;
470
9.89M
  }
Unexecuted instantiation: node::MaybeStackBuffer<unsigned int, 64ul>::IsInvalidated() const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 64ul>::IsInvalidated() const
node::MaybeStackBuffer<char, 64ul>::IsInvalidated() const
Line
Count
Source
468
3.88k
  bool IsInvalidated() const {
469
3.88k
    return buf_ == nullptr;
470
3.88k
  }
node::MaybeStackBuffer<char, 256ul>::IsInvalidated() const
Line
Count
Source
468
1.79M
  bool IsInvalidated() const {
469
1.79M
    return buf_ == nullptr;
470
1.79M
  }
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 256ul>::IsInvalidated() const
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 1024ul>::IsInvalidated() const
Unexecuted instantiation: node::MaybeStackBuffer<char, 3000ul>::IsInvalidated() const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 32ul>::IsInvalidated() const
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 32ul>::IsInvalidated() const
Unexecuted instantiation: node::MaybeStackBuffer<unsigned char, 1024ul>::IsInvalidated() const
node::MaybeStackBuffer<char16_t, 1024ul>::IsInvalidated() const
Line
Count
Source
468
738k
  bool IsInvalidated() const {
469
738k
    return buf_ == nullptr;
470
738k
  }
Unexecuted instantiation: node::MaybeStackBuffer<char16_t, 256ul>::IsInvalidated() const
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 16ul>::IsInvalidated() const
Unexecuted instantiation: node::MaybeStackBuffer<unsigned char, 1200ul>::IsInvalidated() const
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid, 10ul>::IsInvalidated() const
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid_token, 10ul>::IsInvalidated() const
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 5ul>::IsInvalidated() const
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_vec, 16ul>::IsInvalidated() const
Unexecuted instantiation: node::MaybeStackBuffer<char, 32ul>::IsInvalidated() const
471
472
  // Release ownership of the malloc'd buffer.
473
  // Note: This does not free the buffer.
474
0
  void Release() {
475
0
    CHECK(IsAllocated());
476
0
    buf_ = buf_st_;
477
0
    length_ = 0;
478
0
    capacity_ = arraysize(buf_st_);
479
0
  }
Unexecuted instantiation: node::MaybeStackBuffer<char, 1024ul>::Release()
Unexecuted instantiation: node::MaybeStackBuffer<char16_t, 1024ul>::Release()
480
481
  MaybeStackBuffer()
482
22.4M
      : length_(0), capacity_(arraysize(buf_st_)), buf_(buf_st_) {
483
    // Default to a zero-length, null-terminated buffer.
484
22.4M
    buf_[0] = T();
485
22.4M
  }
node::MaybeStackBuffer<v8::Local<v8::Value>, 8ul>::MaybeStackBuffer()
Line
Count
Source
482
2
      : length_(0), capacity_(arraysize(buf_st_)), buf_(buf_st_) {
483
    // Default to a zero-length, null-terminated buffer.
484
2
    buf_[0] = T();
485
2
  }
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 16ul>::MaybeStackBuffer()
node::MaybeStackBuffer<char, 1024ul>::MaybeStackBuffer()
Line
Count
Source
482
15.3M
      : length_(0), capacity_(arraysize(buf_st_)), buf_(buf_st_) {
483
    // Default to a zero-length, null-terminated buffer.
484
15.3M
    buf_[0] = T();
485
15.3M
  }
node::MaybeStackBuffer<v8::Local<v8::Value>, 128ul>::MaybeStackBuffer()
Line
Count
Source
482
4.88M
      : length_(0), capacity_(arraysize(buf_st_)), buf_(buf_st_) {
483
    // Default to a zero-length, null-terminated buffer.
484
4.88M
    buf_[0] = T();
485
4.88M
  }
Unexecuted instantiation: node::MaybeStackBuffer<unsigned int, 64ul>::MaybeStackBuffer()
node::MaybeStackBuffer<char, 64ul>::MaybeStackBuffer()
Line
Count
Source
482
3.88k
      : length_(0), capacity_(arraysize(buf_st_)), buf_(buf_st_) {
483
    // Default to a zero-length, null-terminated buffer.
484
3.88k
    buf_[0] = T();
485
3.88k
  }
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 64ul>::MaybeStackBuffer()
node::MaybeStackBuffer<char, 256ul>::MaybeStackBuffer()
Line
Count
Source
482
1.79M
      : length_(0), capacity_(arraysize(buf_st_)), buf_(buf_st_) {
483
    // Default to a zero-length, null-terminated buffer.
484
1.79M
    buf_[0] = T();
485
1.79M
  }
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 256ul>::MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 1024ul>::MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 32ul>::MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 32ul>::MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<char, 3000ul>::MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<unsigned char, 1024ul>::MaybeStackBuffer()
node::MaybeStackBuffer<char16_t, 1024ul>::MaybeStackBuffer()
Line
Count
Source
482
369k
      : length_(0), capacity_(arraysize(buf_st_)), buf_(buf_st_) {
483
    // Default to a zero-length, null-terminated buffer.
484
369k
    buf_[0] = T();
485
369k
  }
Unexecuted instantiation: node::MaybeStackBuffer<char16_t, 256ul>::MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 16ul>::MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<unsigned short, 1024ul>::MaybeStackBuffer()
node::MaybeStackBuffer<v8::Local<v8::Value>, 1024ul>::MaybeStackBuffer()
Line
Count
Source
482
1.17k
      : length_(0), capacity_(arraysize(buf_st_)), buf_(buf_st_) {
483
    // Default to a zero-length, null-terminated buffer.
484
1.17k
    buf_[0] = T();
485
1.17k
  }
Unexecuted instantiation: node::MaybeStackBuffer<unsigned char, 1200ul>::MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid, 10ul>::MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid_token, 10ul>::MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 5ul>::MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_vec, 16ul>::MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<char, 32ul>::MaybeStackBuffer()
486
487
5.25M
  explicit MaybeStackBuffer(size_t storage) : MaybeStackBuffer() {
488
5.25M
    AllocateSufficientStorage(storage);
489
5.25M
  }
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 8ul>::MaybeStackBuffer(unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 16ul>::MaybeStackBuffer(unsigned long)
node::MaybeStackBuffer<v8::Local<v8::Value>, 128ul>::MaybeStackBuffer(unsigned long)
Line
Count
Source
487
4.88M
  explicit MaybeStackBuffer(size_t storage) : MaybeStackBuffer() {
488
4.88M
    AllocateSufficientStorage(storage);
489
4.88M
  }
Unexecuted instantiation: node::MaybeStackBuffer<unsigned int, 64ul>::MaybeStackBuffer(unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 64ul>::MaybeStackBuffer(unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 256ul>::MaybeStackBuffer(unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 1024ul>::MaybeStackBuffer(unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 32ul>::MaybeStackBuffer(unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<unsigned char, 1024ul>::MaybeStackBuffer(unsigned long)
node::MaybeStackBuffer<char16_t, 1024ul>::MaybeStackBuffer(unsigned long)
Line
Count
Source
487
369k
  explicit MaybeStackBuffer(size_t storage) : MaybeStackBuffer() {
488
369k
    AllocateSufficientStorage(storage);
489
369k
  }
Unexecuted instantiation: node::MaybeStackBuffer<char, 1024ul>::MaybeStackBuffer(unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<char16_t, 256ul>::MaybeStackBuffer(unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 16ul>::MaybeStackBuffer(unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid, 10ul>::MaybeStackBuffer(unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid_token, 10ul>::MaybeStackBuffer(unsigned long)
Unexecuted instantiation: node::MaybeStackBuffer<char, 32ul>::MaybeStackBuffer(unsigned long)
490
491
22.4M
  ~MaybeStackBuffer() {
492
22.4M
    if (IsAllocated())
493
180k
      free(buf_);
494
22.4M
  }
node::MaybeStackBuffer<char, 1024ul>::~MaybeStackBuffer()
Line
Count
Source
491
15.3M
  ~MaybeStackBuffer() {
492
15.3M
    if (IsAllocated())
493
58.2k
      free(buf_);
494
15.3M
  }
node::MaybeStackBuffer<v8::Local<v8::Value>, 8ul>::~MaybeStackBuffer()
Line
Count
Source
491
2
  ~MaybeStackBuffer() {
492
2
    if (IsAllocated())
493
0
      free(buf_);
494
2
  }
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 16ul>::~MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<unsigned short, 1024ul>::~MaybeStackBuffer()
node::MaybeStackBuffer<v8::Local<v8::Value>, 128ul>::~MaybeStackBuffer()
Line
Count
Source
491
4.88M
  ~MaybeStackBuffer() {
492
4.88M
    if (IsAllocated())
493
122k
      free(buf_);
494
4.88M
  }
Unexecuted instantiation: node::MaybeStackBuffer<unsigned int, 64ul>::~MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 64ul>::~MaybeStackBuffer()
node::MaybeStackBuffer<char, 256ul>::~MaybeStackBuffer()
Line
Count
Source
491
1.79M
  ~MaybeStackBuffer() {
492
1.79M
    if (IsAllocated())
493
0
      free(buf_);
494
1.79M
  }
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 256ul>::~MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 1024ul>::~MaybeStackBuffer()
node::MaybeStackBuffer<char, 64ul>::~MaybeStackBuffer()
Line
Count
Source
491
3.88k
  ~MaybeStackBuffer() {
492
3.88k
    if (IsAllocated())
493
0
      free(buf_);
494
3.88k
  }
Unexecuted instantiation: node::MaybeStackBuffer<char, 3000ul>::~MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 32ul>::~MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 32ul>::~MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<unsigned char, 1024ul>::~MaybeStackBuffer()
node::MaybeStackBuffer<char16_t, 1024ul>::~MaybeStackBuffer()
Line
Count
Source
491
369k
  ~MaybeStackBuffer() {
492
369k
    if (IsAllocated())
493
0
      free(buf_);
494
369k
  }
Unexecuted instantiation: node::MaybeStackBuffer<char16_t, 256ul>::~MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<uv_buf_t, 16ul>::~MaybeStackBuffer()
node::MaybeStackBuffer<v8::Local<v8::Value>, 1024ul>::~MaybeStackBuffer()
Line
Count
Source
491
1.17k
  ~MaybeStackBuffer() {
492
1.17k
    if (IsAllocated())
493
0
      free(buf_);
494
1.17k
  }
Unexecuted instantiation: node::MaybeStackBuffer<unsigned char, 1200ul>::~MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid, 10ul>::~MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_cid_token, 10ul>::~MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<v8::Local<v8::Value>, 5ul>::~MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<ngtcp2_vec, 16ul>::~MaybeStackBuffer()
Unexecuted instantiation: node::MaybeStackBuffer<char, 32ul>::~MaybeStackBuffer()
495
496
  inline std::basic_string<T> ToString() const { return {out(), length()}; }
497
0
  inline std::basic_string_view<T> ToStringView() const {
498
0
    return {out(), length()};
499
0
  }
500
501
 private:
502
  size_t length_;
503
  // capacity of the malloc'ed buf_
504
  size_t capacity_;
505
  T* buf_;
506
  T buf_st_[kStackStorageSize];
507
};
508
509
// Provides access to an ArrayBufferView's storage, either the original,
510
// or for small data, a copy of it. This object's lifetime is bound to the
511
// original ArrayBufferView's lifetime.
512
template <typename T, size_t kStackStorageSize = 64>
513
class ArrayBufferViewContents {
514
 public:
515
0
  ArrayBufferViewContents() = default;
Unexecuted instantiation: node::ArrayBufferViewContents<unsigned char, 64ul>::ArrayBufferViewContents()
Unexecuted instantiation: node::ArrayBufferViewContents<unsigned char, 8ul>::ArrayBufferViewContents()
516
517
  ArrayBufferViewContents(const ArrayBufferViewContents&) = delete;
518
  void operator=(const ArrayBufferViewContents&) = delete;
519
520
  explicit inline ArrayBufferViewContents(v8::Local<v8::Value> value);
521
  explicit inline ArrayBufferViewContents(v8::Local<v8::Object> value);
522
  explicit inline ArrayBufferViewContents(v8::Local<v8::ArrayBufferView> abv);
523
  inline void Read(v8::Local<v8::ArrayBufferView> abv);
524
  inline void ReadValue(v8::Local<v8::Value> buf);
525
526
0
  inline bool WasDetached() const { return was_detached_; }
527
7.35k
  inline const T* data() const { return data_; }
node::ArrayBufferViewContents<char, 64ul>::data() const
Line
Count
Source
527
6.30k
  inline const T* data() const { return data_; }
node::ArrayBufferViewContents<unsigned char, 64ul>::data() const
Line
Count
Source
527
1.05k
  inline const T* data() const { return data_; }
Unexecuted instantiation: node::ArrayBufferViewContents<unsigned char, 8ul>::data() const
528
15.6k
  inline size_t length() const { return length_; }
node::ArrayBufferViewContents<char, 64ul>::length() const
Line
Count
Source
528
14.6k
  inline size_t length() const { return length_; }
node::ArrayBufferViewContents<unsigned char, 64ul>::length() const
Line
Count
Source
528
1.05k
  inline size_t length() const { return length_; }
Unexecuted instantiation: node::ArrayBufferViewContents<unsigned char, 8ul>::length() const
529
530
 private:
531
  // Declaring operator new and delete as deleted is not spec compliant.
532
  // Therefore, declare them private instead to disable dynamic alloc.
533
  void* operator new(size_t size);
534
  void* operator new[](size_t size);
535
  void operator delete(void*, size_t);
536
  void operator delete[](void*, size_t);
537
538
  T stack_storage_[kStackStorageSize];
539
  T* data_ = nullptr;
540
  size_t length_ = 0;
541
  bool was_detached_ = false;
542
};
543
544
class Utf8Value : public MaybeStackBuffer<char> {
545
 public:
546
  explicit Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> value);
547
548
91.5k
  inline std::string ToString() const { return std::string(out(), length()); }
549
71.5k
  inline std::string_view ToStringView() const {
550
71.5k
    return std::string_view(out(), length());
551
71.5k
  }
552
553
1.51k
  inline bool operator==(const char* a) const { return strcmp(out(), a) == 0; }
554
1.51k
  inline bool operator!=(const char* a) const { return !(*this == a); }
555
};
556
557
class TwoByteValue : public MaybeStackBuffer<uint16_t> {
558
 public:
559
  explicit TwoByteValue(v8::Isolate* isolate, v8::Local<v8::Value> value);
560
};
561
562
class BufferValue : public MaybeStackBuffer<char> {
563
 public:
564
  explicit BufferValue(v8::Isolate* isolate, v8::Local<v8::Value> value);
565
566
0
  inline std::string ToString() const { return std::string(out(), length()); }
567
5.46k
  inline std::string_view ToStringView() const {
568
5.46k
    return std::string_view(out(), length());
569
5.46k
  }
570
};
571
572
#define SPREAD_BUFFER_ARG(val, name)                                           \
573
136k
  CHECK((val)->IsArrayBufferView());                                           \
574
136k
  v8::Local<v8::ArrayBufferView> name = (val).As<v8::ArrayBufferView>();       \
575
136k
  const size_t name##_offset = name->ByteOffset();                             \
576
136k
  const size_t name##_length = name->ByteLength();                             \
577
136k
  char* const name##_data =                                                    \
578
136k
      static_cast<char*>(name->Buffer()->Data()) + name##_offset;              \
579
136k
  if (name##_length > 0) CHECK_NE(name##_data, nullptr);
580
581
// Use this when a variable or parameter is unused in order to explicitly
582
// silence a compiler warning about that.
583
216k
template <typename T> inline void USE(T&&) {}
void node::USE<v8::Maybe<bool> >(v8::Maybe<bool>&&)
Line
Count
Source
583
143k
template <typename T> inline void USE(T&&) {}
void node::USE<v8::MaybeLocal<v8::Value> >(v8::MaybeLocal<v8::Value>&&)
Line
Count
Source
583
1.17k
template <typename T> inline void USE(T&&) {}
void node::USE<node::cares_wrap::GetAddrInfoReqWrap*>(node::cares_wrap::GetAddrInfoReqWrap*&&)
Line
Count
Source
583
758
template <typename T> inline void USE(T&&) {}
Unexecuted instantiation: void node::USE<node::cares_wrap::GetNameInfoReqWrap*>(node::cares_wrap::GetNameInfoReqWrap*&&)
Unexecuted instantiation: void node::USE<node::cares_wrap::QueryWrap<node::cares_wrap::AnyTraits>*>(node::cares_wrap::QueryWrap<node::cares_wrap::AnyTraits>*&&)
Unexecuted instantiation: void node::USE<node::cares_wrap::QueryWrap<node::cares_wrap::ATraits>*>(node::cares_wrap::QueryWrap<node::cares_wrap::ATraits>*&&)
Unexecuted instantiation: void node::USE<node::cares_wrap::QueryWrap<node::cares_wrap::AaaaTraits>*>(node::cares_wrap::QueryWrap<node::cares_wrap::AaaaTraits>*&&)
Unexecuted instantiation: void node::USE<node::cares_wrap::QueryWrap<node::cares_wrap::CaaTraits>*>(node::cares_wrap::QueryWrap<node::cares_wrap::CaaTraits>*&&)
Unexecuted instantiation: void node::USE<node::cares_wrap::QueryWrap<node::cares_wrap::CnameTraits>*>(node::cares_wrap::QueryWrap<node::cares_wrap::CnameTraits>*&&)
Unexecuted instantiation: void node::USE<node::cares_wrap::QueryWrap<node::cares_wrap::MxTraits>*>(node::cares_wrap::QueryWrap<node::cares_wrap::MxTraits>*&&)
Unexecuted instantiation: void node::USE<node::cares_wrap::QueryWrap<node::cares_wrap::NsTraits>*>(node::cares_wrap::QueryWrap<node::cares_wrap::NsTraits>*&&)
Unexecuted instantiation: void node::USE<node::cares_wrap::QueryWrap<node::cares_wrap::TxtTraits>*>(node::cares_wrap::QueryWrap<node::cares_wrap::TxtTraits>*&&)
Unexecuted instantiation: void node::USE<node::cares_wrap::QueryWrap<node::cares_wrap::SrvTraits>*>(node::cares_wrap::QueryWrap<node::cares_wrap::SrvTraits>*&&)
Unexecuted instantiation: void node::USE<node::cares_wrap::QueryWrap<node::cares_wrap::PtrTraits>*>(node::cares_wrap::QueryWrap<node::cares_wrap::PtrTraits>*&&)
Unexecuted instantiation: void node::USE<node::cares_wrap::QueryWrap<node::cares_wrap::NaptrTraits>*>(node::cares_wrap::QueryWrap<node::cares_wrap::NaptrTraits>*&&)
Unexecuted instantiation: void node::USE<node::cares_wrap::QueryWrap<node::cares_wrap::SoaTraits>*>(node::cares_wrap::QueryWrap<node::cares_wrap::SoaTraits>*&&)
Unexecuted instantiation: void node::USE<node::cares_wrap::QueryWrap<node::cares_wrap::ReverseTraits>*>(node::cares_wrap::QueryWrap<node::cares_wrap::ReverseTraits>*&&)
Unexecuted instantiation: void node::USE<bool&>(bool&)
void node::USE<v8::MaybeLocal<v8::Function> >(v8::MaybeLocal<v8::Function>&&)
Line
Count
Source
583
70.7k
template <typename T> inline void USE(T&&) {}
Unexecuted instantiation: void node::USE<bool>(bool&&)
Unexecuted instantiation: void node::USE<simdjson::error_code>(simdjson::error_code&&)
Unexecuted instantiation: void node::USE<v8::Local<v8::Value> >(v8::Local<v8::Value>&&)
Unexecuted instantiation: void node::USE<int>(int&&)
Unexecuted instantiation: void node::USE<v8::MaybeLocal<v8::Map> >(v8::MaybeLocal<v8::Map>&&)
Unexecuted instantiation: void node::USE<unsigned char*>(unsigned char*&&)
void node::USE<node::crypto::MarkPopErrorOnReturn*>(node::crypto::MarkPopErrorOnReturn*&&)
Line
Count
Source
583
5
template <typename T> inline void USE(T&&) {}
Unexecuted instantiation: void node::USE<v8::Local<v8::FunctionTemplate> >(v8::Local<v8::FunctionTemplate>&&)
584
585
template <typename Fn>
586
struct OnScopeLeaveImpl {
587
  Fn fn_;
588
  bool active_;
589
590
211k
  explicit OnScopeLeaveImpl(Fn&& fn) : fn_(std::move(fn)), active_(true) {}
cares_wrap.cc:node::OnScopeLeaveImpl<node::cares_wrap::(anonymous namespace)::AfterGetAddrInfo(uv_getaddrinfo_s*, int, addrinfo*)::$_0>::OnScopeLeaveImpl(node::cares_wrap::(anonymous namespace)::AfterGetAddrInfo(uv_getaddrinfo_s*, int, addrinfo*)::$_0&&)
Line
Count
Source
590
758
  explicit OnScopeLeaveImpl(Fn&& fn) : fn_(std::move(fn)), active_(true) {}
Unexecuted instantiation: cares_wrap.cc:node::OnScopeLeaveImpl<node::cares_wrap::(anonymous namespace)::GetServers(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::OnScopeLeaveImpl(node::cares_wrap::(anonymous namespace)::GetServers(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
Unexecuted instantiation: node.cc:node::OnScopeLeaveImpl<node::StartInternal(int, char**)::$_0>::OnScopeLeaveImpl(node::StartInternal(int, char**)::$_0&&)
Unexecuted instantiation: node_dir.cc:node::OnScopeLeaveImpl<node::fs_dir::OpenDirSync(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::OnScopeLeaveImpl(node::fs_dir::OpenDirSync(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
Unexecuted instantiation: node_dotenv.cc:node::OnScopeLeaveImpl<node::Dotenv::ParsePath(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0>::OnScopeLeaveImpl(node::Dotenv::ParsePath(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0&&)
Unexecuted instantiation: node_dotenv.cc:node::OnScopeLeaveImpl<node::Dotenv::ParsePath(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_1>::OnScopeLeaveImpl(node::Dotenv::ParsePath(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_1&&)
Unexecuted instantiation: node_env_var.cc:node::OnScopeLeaveImpl<node::RealEnvStore::Enumerate(v8::Isolate*) const::$_0>::OnScopeLeaveImpl(node::RealEnvStore::Enumerate(v8::Isolate*) const::$_0&&)
Unexecuted instantiation: node_file.cc:node::OnScopeLeaveImpl<node::fs::GetFormatOfExtensionlessFile(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::OnScopeLeaveImpl(node::fs::GetFormatOfExtensionlessFile(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
Unexecuted instantiation: node_file.cc:node::OnScopeLeaveImpl<node::fs::ExistsSync(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::OnScopeLeaveImpl(node::fs::ExistsSync(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
node_file.cc:node::OnScopeLeaveImpl<node::fs::ReadFileUtf8(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::OnScopeLeaveImpl(node::fs::ReadFileUtf8(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
Line
Count
Source
590
789
  explicit OnScopeLeaveImpl(Fn&& fn) : fn_(std::move(fn)), active_(true) {}
Unexecuted instantiation: node_http_parser.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::Parser::OnStreamRead(long, uv_buf_t const&)::{lambda()#1}>::OnScopeLeaveImpl({lambda()#1}&&)
Unexecuted instantiation: node_i18n.cc:node::OnScopeLeaveImpl<node::i18n::ConverterObject::Decode(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::OnScopeLeaveImpl(node::i18n::ConverterObject::Decode(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
Unexecuted instantiation: node_messaging.cc:node::OnScopeLeaveImpl<node::worker::Message::Deserialize(node::Environment*, v8::Local<v8::Context>, v8::Local<v8::Value>*)::$_0>::OnScopeLeaveImpl(node::worker::Message::Deserialize(node::Environment*, v8::Local<v8::Context>, v8::Local<v8::Value>*)::$_0&&)
node_messaging.cc:node::OnScopeLeaveImpl<node::worker::MessagePort::MessagePort(node::Environment*, v8::Local<v8::Context>, v8::Local<v8::Object>)::$_1>::OnScopeLeaveImpl(node::worker::MessagePort::MessagePort(node::Environment*, v8::Local<v8::Context>, v8::Local<v8::Object>)::$_1&&)
Line
Count
Source
590
4
  explicit OnScopeLeaveImpl(Fn&& fn) : fn_(std::move(fn)), active_(true) {}
node_options.cc:node::OnScopeLeaveImpl<node::options_parser::GetCLIOptions(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::OnScopeLeaveImpl(node::options_parser::GetCLIOptions(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
Line
Count
Source
590
122k
  explicit OnScopeLeaveImpl(Fn&& fn) : fn_(std::move(fn)), active_(true) {}
Unexecuted instantiation: node_os.cc:node::OnScopeLeaveImpl<node::os::GetUserInfo(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::OnScopeLeaveImpl(node::os::GetUserInfo(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
Unexecuted instantiation: node_snapshotable.cc:node::OnScopeLeaveImpl<node::BuildSnapshotWithoutCodeCache(node::SnapshotData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::optional<std::__1::basic_string_view<char, std::__1::char_traits<char> > >, node::SnapshotConfig const&)::$_0>::OnScopeLeaveImpl(node::BuildSnapshotWithoutCodeCache(node::SnapshotData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::optional<std::__1::basic_string_view<char, std::__1::char_traits<char> > >, node::SnapshotConfig const&)::$_0&&)
Unexecuted instantiation: node_snapshotable.cc:node::OnScopeLeaveImpl<node::BuildCodeCacheFromSnapshot(node::SnapshotData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)::$_0>::OnScopeLeaveImpl(node::BuildCodeCacheFromSnapshot(node::SnapshotData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)::$_0&&)
Unexecuted instantiation: node_worker.cc:node::OnScopeLeaveImpl<node::worker::Worker::Run()::$_0>::OnScopeLeaveImpl(node::worker::Worker::Run()::$_0&&)
node_zlib.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::CompressionStream<node::(anonymous namespace)::ZlibContext>::AfterThreadPoolWork(int)::{lambda()#1}>::OnScopeLeaveImpl({lambda()#1}&&)
Line
Count
Source
590
1.19k
  explicit OnScopeLeaveImpl(Fn&& fn) : fn_(std::move(fn)), active_(true) {}
node_zlib.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::CompressionStream<node::(anonymous namespace)::BrotliEncoderContext>::AfterThreadPoolWork(int)::{lambda()#1}>::OnScopeLeaveImpl({lambda()#1}&&)
Line
Count
Source
590
4.33k
  explicit OnScopeLeaveImpl(Fn&& fn) : fn_(std::move(fn)), active_(true) {}
Unexecuted instantiation: node_zlib.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::CompressionStream<node::(anonymous namespace)::BrotliDecoderContext>::AfterThreadPoolWork(int)::{lambda()#1}>::OnScopeLeaveImpl({lambda()#1}&&)
util.cc:node::OnScopeLeaveImpl<node::ReadFileSync(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*)::$_0>::OnScopeLeaveImpl(node::ReadFileSync(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*)::$_0&&)
Line
Count
Source
590
3
  explicit OnScopeLeaveImpl(Fn&& fn) : fn_(std::move(fn)), active_(true) {}
Unexecuted instantiation: util.cc:node::OnScopeLeaveImpl<node::ReadFileSync(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*)::$_1>::OnScopeLeaveImpl(node::ReadFileSync(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*)::$_1&&)
callback.cc:node::OnScopeLeaveImpl<node::InternalCallbackScope::Close()::$_1>::OnScopeLeaveImpl(node::InternalCallbackScope::Close()::$_1&&)
Line
Count
Source
590
40.9k
  explicit OnScopeLeaveImpl(Fn&& fn) : fn_(std::move(fn)), active_(true) {}
callback.cc:node::OnScopeLeaveImpl<node::InternalCallbackScope::Close()::$_2>::OnScopeLeaveImpl(node::InternalCallbackScope::Close()::$_2&&)
Line
Count
Source
590
40.9k
  explicit OnScopeLeaveImpl(Fn&& fn) : fn_(std::move(fn)), active_(true) {}
Unexecuted instantiation: embed_helpers.cc:node::OnScopeLeaveImpl<node::CommonEnvironmentSetup::CommonEnvironmentSetup(node::MultiIsolatePlatform*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*, node::EmbedderSnapshotData const*, unsigned int, std::__1::function<node::Environment* (node::CommonEnvironmentSetup const*)>, node::SnapshotConfig const*)::$_0>::OnScopeLeaveImpl(node::CommonEnvironmentSetup::CommonEnvironmentSetup(node::MultiIsolatePlatform*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*, node::EmbedderSnapshotData const*, unsigned int, std::__1::function<node::Environment* (node::CommonEnvironmentSetup const*)>, node::SnapshotConfig const*)::$_0&&)
Unexecuted instantiation: queue.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::FdEntry::Create(node::Environment*, v8::Local<v8::Value>)::{lambda()#1}>::OnScopeLeaveImpl({lambda()#1}&&)
Unexecuted instantiation: queue.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::FdEntry::ReaderImpl::Create(node::(anonymous namespace)::FdEntry*)::{lambda()#1}>::OnScopeLeaveImpl({lambda()#1}&&)
Unexecuted instantiation: queue.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::FdEntry::CheckModified(node::(anonymous namespace)::FdEntry*, int)::{lambda()#1}>::OnScopeLeaveImpl({lambda()#1}&&)
Unexecuted instantiation: queue.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::FdEntry::ReaderImpl::DequeuePendingPull()::{lambda()#1}>::OnScopeLeaveImpl({lambda()#1}&&)
Unexecuted instantiation: js_native_api_v8.cc:node::OnScopeLeaveImpl<napi_env__::InvokeFinalizerFromGC(v8impl::RefTracker*)::$_0>::OnScopeLeaveImpl(napi_env__::InvokeFinalizerFromGC(v8impl::RefTracker*)::$_0&&)
Unexecuted instantiation: crypto_common.cc:node::OnScopeLeaveImpl<node::crypto::GetX509NameObject<&X509_get_subject_name>(node::Environment*, x509_st*)::{lambda()#1}>::OnScopeLeaveImpl({lambda()#1}&&)
Unexecuted instantiation: crypto_common.cc:node::OnScopeLeaveImpl<node::crypto::GetX509NameObject<&X509_get_issuer_name>(node::Environment*, x509_st*)::{lambda()#1}>::OnScopeLeaveImpl({lambda()#1}&&)
Unexecuted instantiation: node::OnScopeLeaveImpl<node::SocketAddressLRU<node::quic::Endpoint::SocketAddressInfoTraits>::Upsert(node::SocketAddress const&)::{lambda()#1}>::OnScopeLeaveImpl({lambda()#1}&&)
Unexecuted instantiation: session.cc:node::OnScopeLeaveImpl<node::quic::Session::Receive(node::quic::Store&&, node::SocketAddress const&, node::SocketAddress const&)::$_1>::OnScopeLeaveImpl(node::quic::Session::Receive(node::quic::Store&&, node::SocketAddress const&, node::SocketAddress const&)::$_1&&)
Unexecuted instantiation: session.cc:node::OnScopeLeaveImpl<node::quic::Session::SendConnectionClose()::$_0>::OnScopeLeaveImpl(node::quic::Session::SendConnectionClose()::$_0&&)
Unexecuted instantiation: node::OnScopeLeaveImpl<node::quic::Stream::Outbound::Pull(std::__1::function<void (int, ngtcp2_vec const*, unsigned long, std::__1::function<void (unsigned long)>)>, int, ngtcp2_vec*, unsigned long, unsigned long)::{lambda(auto:1, auto:2, auto:3, auto:4)#1}::operator()<int, node::DataQueue::Vec const*, unsigned long, std::__1::function<void (unsigned long)> >(int, node::DataQueue::Vec const*, unsigned long, std::__1::function<void (unsigned long)>) const::{lambda()#1}>::OnScopeLeaveImpl(node::DataQueue::Vec const*&&)
Unexecuted instantiation: tlscontext.cc:node::OnScopeLeaveImpl<node::quic::TLSContext::InitiateKeyUpdate()::$_0>::OnScopeLeaveImpl(node::quic::TLSContext::InitiateKeyUpdate()::$_0&&)
Unexecuted instantiation: preferredaddress.cc:node::OnScopeLeaveImpl<node::quic::PreferredAddress::Use(node::quic::PreferredAddress::AddressInfo const&)::$_0>::OnScopeLeaveImpl(node::quic::PreferredAddress::Use(node::quic::PreferredAddress::AddressInfo const&)::$_0&&)
591
211k
  ~OnScopeLeaveImpl() { if (active_) fn_(); }
cares_wrap.cc:node::OnScopeLeaveImpl<node::cares_wrap::(anonymous namespace)::AfterGetAddrInfo(uv_getaddrinfo_s*, int, addrinfo*)::$_0>::~OnScopeLeaveImpl()
Line
Count
Source
591
758
  ~OnScopeLeaveImpl() { if (active_) fn_(); }
Unexecuted instantiation: cares_wrap.cc:node::OnScopeLeaveImpl<node::cares_wrap::(anonymous namespace)::GetServers(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::~OnScopeLeaveImpl()
Unexecuted instantiation: node.cc:node::OnScopeLeaveImpl<node::StartInternal(int, char**)::$_0>::~OnScopeLeaveImpl()
Unexecuted instantiation: node_dir.cc:node::OnScopeLeaveImpl<node::fs_dir::OpenDirSync(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::~OnScopeLeaveImpl()
Unexecuted instantiation: node_dotenv.cc:node::OnScopeLeaveImpl<node::Dotenv::ParsePath(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0>::~OnScopeLeaveImpl()
Unexecuted instantiation: node_dotenv.cc:node::OnScopeLeaveImpl<node::Dotenv::ParsePath(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_1>::~OnScopeLeaveImpl()
Unexecuted instantiation: node_env_var.cc:node::OnScopeLeaveImpl<node::RealEnvStore::Enumerate(v8::Isolate*) const::$_0>::~OnScopeLeaveImpl()
Unexecuted instantiation: node_file.cc:node::OnScopeLeaveImpl<node::fs::GetFormatOfExtensionlessFile(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::~OnScopeLeaveImpl()
Unexecuted instantiation: node_file.cc:node::OnScopeLeaveImpl<node::fs::ExistsSync(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::~OnScopeLeaveImpl()
node_file.cc:node::OnScopeLeaveImpl<node::fs::ReadFileUtf8(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::~OnScopeLeaveImpl()
Line
Count
Source
591
789
  ~OnScopeLeaveImpl() { if (active_) fn_(); }
Unexecuted instantiation: node_http_parser.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::Parser::OnStreamRead(long, uv_buf_t const&)::{lambda()#1}>::~OnScopeLeaveImpl()
Unexecuted instantiation: node_i18n.cc:node::OnScopeLeaveImpl<node::i18n::ConverterObject::Decode(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::~OnScopeLeaveImpl()
Unexecuted instantiation: node_messaging.cc:node::OnScopeLeaveImpl<node::worker::Message::Deserialize(node::Environment*, v8::Local<v8::Context>, v8::Local<v8::Value>*)::$_0>::~OnScopeLeaveImpl()
node_messaging.cc:node::OnScopeLeaveImpl<node::worker::MessagePort::MessagePort(node::Environment*, v8::Local<v8::Context>, v8::Local<v8::Object>)::$_1>::~OnScopeLeaveImpl()
Line
Count
Source
591
4
  ~OnScopeLeaveImpl() { if (active_) fn_(); }
node_options.cc:node::OnScopeLeaveImpl<node::options_parser::GetCLIOptions(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::~OnScopeLeaveImpl()
Line
Count
Source
591
122k
  ~OnScopeLeaveImpl() { if (active_) fn_(); }
Unexecuted instantiation: node_os.cc:node::OnScopeLeaveImpl<node::os::GetUserInfo(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>::~OnScopeLeaveImpl()
Unexecuted instantiation: node_snapshotable.cc:node::OnScopeLeaveImpl<node::BuildSnapshotWithoutCodeCache(node::SnapshotData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::optional<std::__1::basic_string_view<char, std::__1::char_traits<char> > >, node::SnapshotConfig const&)::$_0>::~OnScopeLeaveImpl()
Unexecuted instantiation: node_snapshotable.cc:node::OnScopeLeaveImpl<node::BuildCodeCacheFromSnapshot(node::SnapshotData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)::$_0>::~OnScopeLeaveImpl()
Unexecuted instantiation: node_worker.cc:node::OnScopeLeaveImpl<node::worker::Worker::Run()::$_0>::~OnScopeLeaveImpl()
node_zlib.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::CompressionStream<node::(anonymous namespace)::ZlibContext>::AfterThreadPoolWork(int)::{lambda()#1}>::~OnScopeLeaveImpl()
Line
Count
Source
591
1.19k
  ~OnScopeLeaveImpl() { if (active_) fn_(); }
node_zlib.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::CompressionStream<node::(anonymous namespace)::BrotliEncoderContext>::AfterThreadPoolWork(int)::{lambda()#1}>::~OnScopeLeaveImpl()
Line
Count
Source
591
4.33k
  ~OnScopeLeaveImpl() { if (active_) fn_(); }
Unexecuted instantiation: node_zlib.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::CompressionStream<node::(anonymous namespace)::BrotliDecoderContext>::AfterThreadPoolWork(int)::{lambda()#1}>::~OnScopeLeaveImpl()
util.cc:node::OnScopeLeaveImpl<node::ReadFileSync(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*)::$_0>::~OnScopeLeaveImpl()
Line
Count
Source
591
3
  ~OnScopeLeaveImpl() { if (active_) fn_(); }
Unexecuted instantiation: util.cc:node::OnScopeLeaveImpl<node::ReadFileSync(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*)::$_1>::~OnScopeLeaveImpl()
callback.cc:node::OnScopeLeaveImpl<node::InternalCallbackScope::Close()::$_1>::~OnScopeLeaveImpl()
Line
Count
Source
591
40.9k
  ~OnScopeLeaveImpl() { if (active_) fn_(); }
callback.cc:node::OnScopeLeaveImpl<node::InternalCallbackScope::Close()::$_2>::~OnScopeLeaveImpl()
Line
Count
Source
591
40.9k
  ~OnScopeLeaveImpl() { if (active_) fn_(); }
Unexecuted instantiation: embed_helpers.cc:node::OnScopeLeaveImpl<node::CommonEnvironmentSetup::CommonEnvironmentSetup(node::MultiIsolatePlatform*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*, node::EmbedderSnapshotData const*, unsigned int, std::__1::function<node::Environment* (node::CommonEnvironmentSetup const*)>, node::SnapshotConfig const*)::$_0>::~OnScopeLeaveImpl()
Unexecuted instantiation: queue.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::FdEntry::CheckModified(node::(anonymous namespace)::FdEntry*, int)::{lambda()#1}>::~OnScopeLeaveImpl()
Unexecuted instantiation: queue.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::FdEntry::ReaderImpl::DequeuePendingPull()::{lambda()#1}>::~OnScopeLeaveImpl()
Unexecuted instantiation: queue.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::FdEntry::ReaderImpl::Create(node::(anonymous namespace)::FdEntry*)::{lambda()#1}>::~OnScopeLeaveImpl()
Unexecuted instantiation: queue.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::FdEntry::Create(node::Environment*, v8::Local<v8::Value>)::{lambda()#1}>::~OnScopeLeaveImpl()
Unexecuted instantiation: js_native_api_v8.cc:node::OnScopeLeaveImpl<napi_env__::InvokeFinalizerFromGC(v8impl::RefTracker*)::$_0>::~OnScopeLeaveImpl()
Unexecuted instantiation: crypto_common.cc:node::OnScopeLeaveImpl<node::crypto::GetX509NameObject<&X509_get_subject_name>(node::Environment*, x509_st*)::{lambda()#1}>::~OnScopeLeaveImpl()
Unexecuted instantiation: crypto_common.cc:node::OnScopeLeaveImpl<node::crypto::GetX509NameObject<&X509_get_issuer_name>(node::Environment*, x509_st*)::{lambda()#1}>::~OnScopeLeaveImpl()
Unexecuted instantiation: node::OnScopeLeaveImpl<node::SocketAddressLRU<node::quic::Endpoint::SocketAddressInfoTraits>::Upsert(node::SocketAddress const&)::{lambda()#1}>::~OnScopeLeaveImpl()
Unexecuted instantiation: session.cc:node::OnScopeLeaveImpl<node::quic::Session::Receive(node::quic::Store&&, node::SocketAddress const&, node::SocketAddress const&)::$_1>::~OnScopeLeaveImpl()
Unexecuted instantiation: session.cc:node::OnScopeLeaveImpl<node::quic::Session::SendConnectionClose()::$_0>::~OnScopeLeaveImpl()
Unexecuted instantiation: node::OnScopeLeaveImpl<node::quic::Stream::Outbound::Pull(std::__1::function<void (int, ngtcp2_vec const*, unsigned long, std::__1::function<void (unsigned long)>)>, int, ngtcp2_vec*, unsigned long, unsigned long)::{lambda(auto:1, auto:2, auto:3, auto:4)#1}::operator()<int, node::DataQueue::Vec const*, unsigned long, std::__1::function<void (unsigned long)> >(int, node::DataQueue::Vec const*, unsigned long, std::__1::function<void (unsigned long)>) const::{lambda()#1}>::~OnScopeLeaveImpl()
Unexecuted instantiation: tlscontext.cc:node::OnScopeLeaveImpl<node::quic::TLSContext::InitiateKeyUpdate()::$_0>::~OnScopeLeaveImpl()
Unexecuted instantiation: preferredaddress.cc:node::OnScopeLeaveImpl<node::quic::PreferredAddress::Use(node::quic::PreferredAddress::AddressInfo const&)::$_0>::~OnScopeLeaveImpl()
592
593
  OnScopeLeaveImpl(const OnScopeLeaveImpl& other) = delete;
594
  OnScopeLeaveImpl& operator=(const OnScopeLeaveImpl& other) = delete;
595
  OnScopeLeaveImpl(OnScopeLeaveImpl&& other)
596
    : fn_(std::move(other.fn_)), active_(other.active_) {
597
    other.active_ = false;
598
  }
599
};
600
601
// Run a function when exiting the current scope. Used like this:
602
// auto on_scope_leave = OnScopeLeave([&] {
603
//   // ... run some code ...
604
// });
605
template <typename Fn>
606
211k
inline MUST_USE_RESULT OnScopeLeaveImpl<Fn> OnScopeLeave(Fn&& fn) {
607
211k
  return OnScopeLeaveImpl<Fn>{std::move(fn)};
608
211k
}
cares_wrap.cc:node::OnScopeLeaveImpl<node::cares_wrap::(anonymous namespace)::AfterGetAddrInfo(uv_getaddrinfo_s*, int, addrinfo*)::$_0> node::OnScopeLeave<node::cares_wrap::(anonymous namespace)::AfterGetAddrInfo(uv_getaddrinfo_s*, int, addrinfo*)::$_0>(node::cares_wrap::(anonymous namespace)::AfterGetAddrInfo(uv_getaddrinfo_s*, int, addrinfo*)::$_0&&)
Line
Count
Source
606
758
inline MUST_USE_RESULT OnScopeLeaveImpl<Fn> OnScopeLeave(Fn&& fn) {
607
758
  return OnScopeLeaveImpl<Fn>{std::move(fn)};
608
758
}
Unexecuted instantiation: cares_wrap.cc:node::OnScopeLeaveImpl<node::cares_wrap::(anonymous namespace)::GetServers(v8::FunctionCallbackInfo<v8::Value> const&)::$_0> node::OnScopeLeave<node::cares_wrap::(anonymous namespace)::GetServers(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>(node::cares_wrap::(anonymous namespace)::GetServers(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
Unexecuted instantiation: node.cc:node::OnScopeLeaveImpl<node::StartInternal(int, char**)::$_0> node::OnScopeLeave<node::StartInternal(int, char**)::$_0>(node::StartInternal(int, char**)::$_0&&)
Unexecuted instantiation: node_dir.cc:node::OnScopeLeaveImpl<node::fs_dir::OpenDirSync(v8::FunctionCallbackInfo<v8::Value> const&)::$_0> node::OnScopeLeave<node::fs_dir::OpenDirSync(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>(node::fs_dir::OpenDirSync(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
Unexecuted instantiation: node_dotenv.cc:node::OnScopeLeaveImpl<node::Dotenv::ParsePath(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0> node::OnScopeLeave<node::Dotenv::ParsePath(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0>(node::Dotenv::ParsePath(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_0&&)
Unexecuted instantiation: node_dotenv.cc:node::OnScopeLeaveImpl<node::Dotenv::ParsePath(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_1> node::OnScopeLeave<node::Dotenv::ParsePath(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_1>(node::Dotenv::ParsePath(std::__1::basic_string_view<char, std::__1::char_traits<char> >)::$_1&&)
Unexecuted instantiation: node_env_var.cc:node::OnScopeLeaveImpl<node::RealEnvStore::Enumerate(v8::Isolate*) const::$_0> node::OnScopeLeave<node::RealEnvStore::Enumerate(v8::Isolate*) const::$_0>(node::RealEnvStore::Enumerate(v8::Isolate*) const::$_0&&)
Unexecuted instantiation: node_file.cc:node::OnScopeLeaveImpl<node::fs::GetFormatOfExtensionlessFile(v8::FunctionCallbackInfo<v8::Value> const&)::$_0> node::OnScopeLeave<node::fs::GetFormatOfExtensionlessFile(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>(node::fs::GetFormatOfExtensionlessFile(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
Unexecuted instantiation: node_file.cc:node::OnScopeLeaveImpl<node::fs::ExistsSync(v8::FunctionCallbackInfo<v8::Value> const&)::$_0> node::OnScopeLeave<node::fs::ExistsSync(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>(node::fs::ExistsSync(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
node_file.cc:node::OnScopeLeaveImpl<node::fs::ReadFileUtf8(v8::FunctionCallbackInfo<v8::Value> const&)::$_0> node::OnScopeLeave<node::fs::ReadFileUtf8(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>(node::fs::ReadFileUtf8(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
Line
Count
Source
606
789
inline MUST_USE_RESULT OnScopeLeaveImpl<Fn> OnScopeLeave(Fn&& fn) {
607
789
  return OnScopeLeaveImpl<Fn>{std::move(fn)};
608
789
}
Unexecuted instantiation: node_http_parser.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::Parser::OnStreamRead(long, uv_buf_t const&)::{lambda()#1}> node::OnScopeLeave<node::(anonymous namespace)::Parser::OnStreamRead(long, uv_buf_t const&)::{lambda()#1}>(node::OnScopeLeaveImpl&&)
Unexecuted instantiation: node_i18n.cc:node::OnScopeLeaveImpl<node::i18n::ConverterObject::Decode(v8::FunctionCallbackInfo<v8::Value> const&)::$_0> node::OnScopeLeave<node::i18n::ConverterObject::Decode(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>(node::i18n::ConverterObject::Decode(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
Unexecuted instantiation: node_messaging.cc:node::OnScopeLeaveImpl<node::worker::Message::Deserialize(node::Environment*, v8::Local<v8::Context>, v8::Local<v8::Value>*)::$_0> node::OnScopeLeave<node::worker::Message::Deserialize(node::Environment*, v8::Local<v8::Context>, v8::Local<v8::Value>*)::$_0>(node::worker::Message::Deserialize(node::Environment*, v8::Local<v8::Context>, v8::Local<v8::Value>*)::$_0&&)
node_messaging.cc:node::OnScopeLeaveImpl<node::worker::MessagePort::MessagePort(node::Environment*, v8::Local<v8::Context>, v8::Local<v8::Object>)::$_1> node::OnScopeLeave<node::worker::MessagePort::MessagePort(node::Environment*, v8::Local<v8::Context>, v8::Local<v8::Object>)::$_1>(node::worker::MessagePort::MessagePort(node::Environment*, v8::Local<v8::Context>, v8::Local<v8::Object>)::$_1&&)
Line
Count
Source
606
4
inline MUST_USE_RESULT OnScopeLeaveImpl<Fn> OnScopeLeave(Fn&& fn) {
607
4
  return OnScopeLeaveImpl<Fn>{std::move(fn)};
608
4
}
node_options.cc:node::OnScopeLeaveImpl<node::options_parser::GetCLIOptions(v8::FunctionCallbackInfo<v8::Value> const&)::$_0> node::OnScopeLeave<node::options_parser::GetCLIOptions(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>(node::options_parser::GetCLIOptions(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
Line
Count
Source
606
122k
inline MUST_USE_RESULT OnScopeLeaveImpl<Fn> OnScopeLeave(Fn&& fn) {
607
122k
  return OnScopeLeaveImpl<Fn>{std::move(fn)};
608
122k
}
Unexecuted instantiation: node_os.cc:node::OnScopeLeaveImpl<node::os::GetUserInfo(v8::FunctionCallbackInfo<v8::Value> const&)::$_0> node::OnScopeLeave<node::os::GetUserInfo(v8::FunctionCallbackInfo<v8::Value> const&)::$_0>(node::os::GetUserInfo(v8::FunctionCallbackInfo<v8::Value> const&)::$_0&&)
Unexecuted instantiation: node_snapshotable.cc:node::OnScopeLeaveImpl<node::BuildSnapshotWithoutCodeCache(node::SnapshotData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::optional<std::__1::basic_string_view<char, std::__1::char_traits<char> > >, node::SnapshotConfig const&)::$_0> node::OnScopeLeave<node::BuildSnapshotWithoutCodeCache(node::SnapshotData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::optional<std::__1::basic_string_view<char, std::__1::char_traits<char> > >, node::SnapshotConfig const&)::$_0>(node::BuildSnapshotWithoutCodeCache(node::SnapshotData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::optional<std::__1::basic_string_view<char, std::__1::char_traits<char> > >, node::SnapshotConfig const&)::$_0&&)
Unexecuted instantiation: node_snapshotable.cc:node::OnScopeLeaveImpl<node::BuildCodeCacheFromSnapshot(node::SnapshotData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)::$_0> node::OnScopeLeave<node::BuildCodeCacheFromSnapshot(node::SnapshotData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)::$_0>(node::BuildCodeCacheFromSnapshot(node::SnapshotData*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)::$_0&&)
Unexecuted instantiation: node_worker.cc:node::OnScopeLeaveImpl<node::worker::Worker::Run()::$_0> node::OnScopeLeave<node::worker::Worker::Run()::$_0>(node::worker::Worker::Run()::$_0&&)
node_zlib.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::CompressionStream<node::(anonymous namespace)::ZlibContext>::AfterThreadPoolWork(int)::{lambda()#1}> node::OnScopeLeave<node::(anonymous namespace)::CompressionStream<node::(anonymous namespace)::ZlibContext>::AfterThreadPoolWork(int)::{lambda()#1}>(node::OnScopeLeaveImpl&&)
Line
Count
Source
606
1.19k
inline MUST_USE_RESULT OnScopeLeaveImpl<Fn> OnScopeLeave(Fn&& fn) {
607
1.19k
  return OnScopeLeaveImpl<Fn>{std::move(fn)};
608
1.19k
}
node_zlib.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::CompressionStream<node::(anonymous namespace)::BrotliEncoderContext>::AfterThreadPoolWork(int)::{lambda()#1}> node::OnScopeLeave<node::(anonymous namespace)::CompressionStream<node::(anonymous namespace)::BrotliEncoderContext>::AfterThreadPoolWork(int)::{lambda()#1}>(node::OnScopeLeaveImpl&&)
Line
Count
Source
606
4.33k
inline MUST_USE_RESULT OnScopeLeaveImpl<Fn> OnScopeLeave(Fn&& fn) {
607
4.33k
  return OnScopeLeaveImpl<Fn>{std::move(fn)};
608
4.33k
}
Unexecuted instantiation: node_zlib.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::CompressionStream<node::(anonymous namespace)::BrotliDecoderContext>::AfterThreadPoolWork(int)::{lambda()#1}> node::OnScopeLeave<node::(anonymous namespace)::CompressionStream<node::(anonymous namespace)::BrotliDecoderContext>::AfterThreadPoolWork(int)::{lambda()#1}>(node::OnScopeLeaveImpl&&)
util.cc:node::OnScopeLeaveImpl<node::ReadFileSync(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*)::$_0> node::OnScopeLeave<node::ReadFileSync(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*)::$_0>(node::ReadFileSync(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*)::$_0&&)
Line
Count
Source
606
3
inline MUST_USE_RESULT OnScopeLeaveImpl<Fn> OnScopeLeave(Fn&& fn) {
607
3
  return OnScopeLeaveImpl<Fn>{std::move(fn)};
608
3
}
Unexecuted instantiation: util.cc:node::OnScopeLeaveImpl<node::ReadFileSync(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*)::$_1> node::OnScopeLeave<node::ReadFileSync(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*)::$_1>(node::ReadFileSync(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, char const*)::$_1&&)
callback.cc:node::OnScopeLeaveImpl<node::InternalCallbackScope::Close()::$_1> node::OnScopeLeave<node::InternalCallbackScope::Close()::$_1>(node::InternalCallbackScope::Close()::$_1&&)
Line
Count
Source
606
40.9k
inline MUST_USE_RESULT OnScopeLeaveImpl<Fn> OnScopeLeave(Fn&& fn) {
607
40.9k
  return OnScopeLeaveImpl<Fn>{std::move(fn)};
608
40.9k
}
callback.cc:node::OnScopeLeaveImpl<node::InternalCallbackScope::Close()::$_2> node::OnScopeLeave<node::InternalCallbackScope::Close()::$_2>(node::InternalCallbackScope::Close()::$_2&&)
Line
Count
Source
606
40.9k
inline MUST_USE_RESULT OnScopeLeaveImpl<Fn> OnScopeLeave(Fn&& fn) {
607
40.9k
  return OnScopeLeaveImpl<Fn>{std::move(fn)};
608
40.9k
}
Unexecuted instantiation: embed_helpers.cc:node::OnScopeLeaveImpl<node::CommonEnvironmentSetup::CommonEnvironmentSetup(node::MultiIsolatePlatform*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*, node::EmbedderSnapshotData const*, unsigned int, std::__1::function<node::Environment* (node::CommonEnvironmentSetup const*)>, node::SnapshotConfig const*)::$_0> node::OnScopeLeave<node::CommonEnvironmentSetup::CommonEnvironmentSetup(node::MultiIsolatePlatform*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*, node::EmbedderSnapshotData const*, unsigned int, std::__1::function<node::Environment* (node::CommonEnvironmentSetup const*)>, node::SnapshotConfig const*)::$_0>(node::CommonEnvironmentSetup::CommonEnvironmentSetup(node::MultiIsolatePlatform*, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*, node::EmbedderSnapshotData const*, unsigned int, std::__1::function<node::Environment* (node::CommonEnvironmentSetup const*)>, node::SnapshotConfig const*)::$_0&&)
Unexecuted instantiation: queue.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::FdEntry::Create(node::Environment*, v8::Local<v8::Value>)::{lambda()#1}> node::OnScopeLeave<node::(anonymous namespace)::FdEntry::Create(node::Environment*, v8::Local<v8::Value>)::{lambda()#1}>(node::OnScopeLeaveImpl&&)
Unexecuted instantiation: queue.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::FdEntry::ReaderImpl::Create(node::(anonymous namespace)::FdEntry*)::{lambda()#1}> node::OnScopeLeave<node::(anonymous namespace)::FdEntry::ReaderImpl::Create(node::(anonymous namespace)::FdEntry*)::{lambda()#1}>(node::OnScopeLeaveImpl&&)
Unexecuted instantiation: queue.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::FdEntry::CheckModified(node::(anonymous namespace)::FdEntry*, int)::{lambda()#1}> node::OnScopeLeave<node::(anonymous namespace)::FdEntry::CheckModified(node::(anonymous namespace)::FdEntry*, int)::{lambda()#1}>(node::OnScopeLeaveImpl&&)
Unexecuted instantiation: queue.cc:node::OnScopeLeaveImpl<node::(anonymous namespace)::FdEntry::ReaderImpl::DequeuePendingPull()::{lambda()#1}> node::OnScopeLeave<node::(anonymous namespace)::FdEntry::ReaderImpl::DequeuePendingPull()::{lambda()#1}>(node::OnScopeLeaveImpl&&)
Unexecuted instantiation: js_native_api_v8.cc:node::OnScopeLeaveImpl<napi_env__::InvokeFinalizerFromGC(v8impl::RefTracker*)::$_0> node::OnScopeLeave<napi_env__::InvokeFinalizerFromGC(v8impl::RefTracker*)::$_0>(napi_env__::InvokeFinalizerFromGC(v8impl::RefTracker*)::$_0&&)
Unexecuted instantiation: crypto_common.cc:node::OnScopeLeaveImpl<node::crypto::GetX509NameObject<&X509_get_subject_name>(node::Environment*, x509_st*)::{lambda()#1}> node::OnScopeLeave<node::crypto::GetX509NameObject<&X509_get_subject_name>(node::Environment*, x509_st*)::{lambda()#1}>(node::OnScopeLeaveImpl&&)
Unexecuted instantiation: crypto_common.cc:node::OnScopeLeaveImpl<node::crypto::GetX509NameObject<&X509_get_issuer_name>(node::Environment*, x509_st*)::{lambda()#1}> node::OnScopeLeave<node::crypto::GetX509NameObject<&X509_get_issuer_name>(node::Environment*, x509_st*)::{lambda()#1}>(node::OnScopeLeaveImpl&&)
Unexecuted instantiation: node::OnScopeLeaveImpl<node::SocketAddressLRU<node::quic::Endpoint::SocketAddressInfoTraits>::Upsert(node::SocketAddress const&)::{lambda()#1}> node::OnScopeLeave<node::SocketAddressLRU<node::quic::Endpoint::SocketAddressInfoTraits>::Upsert(node::SocketAddress const&)::{lambda()#1}>(node::OnScopeLeaveImpl&&)
Unexecuted instantiation: session.cc:node::OnScopeLeaveImpl<node::quic::Session::Receive(node::quic::Store&&, node::SocketAddress const&, node::SocketAddress const&)::$_1> node::OnScopeLeave<node::quic::Session::Receive(node::quic::Store&&, node::SocketAddress const&, node::SocketAddress const&)::$_1>(node::quic::Session::Receive(node::quic::Store&&, node::SocketAddress const&, node::SocketAddress const&)::$_1&&)
Unexecuted instantiation: session.cc:node::OnScopeLeaveImpl<node::quic::Session::SendConnectionClose()::$_0> node::OnScopeLeave<node::quic::Session::SendConnectionClose()::$_0>(node::quic::Session::SendConnectionClose()::$_0&&)
Unexecuted instantiation: node::OnScopeLeaveImpl<node::quic::Stream::Outbound::Pull(std::__1::function<void (int, ngtcp2_vec const*, unsigned long, std::__1::function<void (unsigned long)>)>, int, ngtcp2_vec*, unsigned long, unsigned long)::{lambda(auto:1, auto:2, auto:3, auto:4)#1}::operator()<int, node::DataQueue::Vec const*, unsigned long, std::__1::function<void (unsigned long)> >(int, node::DataQueue::Vec const*, unsigned long, std::__1::function<void (unsigned long)>) const::{lambda()#1}> node::OnScopeLeave<node::quic::Stream::Outbound::Pull(std::__1::function<void (int, ngtcp2_vec const*, unsigned long, std::__1::function<void (unsigned long)>)>, int, ngtcp2_vec*, unsigned long, unsigned long)::{lambda(auto:1, auto:2, auto:3, auto:4)#1}::operator()<int, node::DataQueue::Vec const*, unsigned long, std::__1::function<void (unsigned long)> >(int, node::DataQueue::Vec const*, unsigned long, std::__1::function<void (unsigned long)>) const::{lambda()#1}>(node::quic::Stream::Outbound::Pull(std::__1::function<void (int, ngtcp2_vec const*, unsigned long, std::__1::function<void (unsigned long)>)>, int, ngtcp2_vec*, unsigned long, unsigned long)::{lambda(auto:1, auto:2, auto:3, auto:4)#1}::operator()<int, node::DataQueue::Vec const*, unsigned long, std::__1::function<void (unsigned long)> >(int, node::DataQueue::Vec const*, unsigned long, std::__1::function<void (unsigned long)>) const::{lambda()#1}&&)
Unexecuted instantiation: tlscontext.cc:node::OnScopeLeaveImpl<node::quic::TLSContext::InitiateKeyUpdate()::$_0> node::OnScopeLeave<node::quic::TLSContext::InitiateKeyUpdate()::$_0>(node::quic::TLSContext::InitiateKeyUpdate()::$_0&&)
Unexecuted instantiation: preferredaddress.cc:node::OnScopeLeaveImpl<node::quic::PreferredAddress::Use(node::quic::PreferredAddress::AddressInfo const&)::$_0> node::OnScopeLeave<node::quic::PreferredAddress::Use(node::quic::PreferredAddress::AddressInfo const&)::$_0>(node::quic::PreferredAddress::Use(node::quic::PreferredAddress::AddressInfo const&)::$_0&&)
609
610
// Simple RAII wrapper for contiguous data that uses malloc()/free().
611
template <typename T>
612
struct MallocedBuffer {
613
  T* data;
614
  size_t size;
615
616
  T* release() {
617
    T* ret = data;
618
    data = nullptr;
619
    return ret;
620
  }
621
622
  void Truncate(size_t new_size) {
623
    CHECK_LE(new_size, size);
624
    size = new_size;
625
  }
626
627
  void Realloc(size_t new_size) {
628
    Truncate(new_size);
629
    data = UncheckedRealloc(data, new_size);
630
  }
631
632
2
  bool is_empty() const { return data == nullptr; }
633
634
8
  MallocedBuffer() : data(nullptr), size(0) {}
Unexecuted instantiation: node::MallocedBuffer<unsigned char>::MallocedBuffer()
node::MallocedBuffer<char>::MallocedBuffer()
Line
Count
Source
634
8
  MallocedBuffer() : data(nullptr), size(0) {}
635
  explicit MallocedBuffer(size_t size) : data(Malloc<T>(size)), size(size) {}
636
2
  MallocedBuffer(T* data, size_t size) : data(data), size(size) {}
Unexecuted instantiation: node::MallocedBuffer<unsigned char>::MallocedBuffer(unsigned char*, unsigned long)
node::MallocedBuffer<char>::MallocedBuffer(char*, unsigned long)
Line
Count
Source
636
2
  MallocedBuffer(T* data, size_t size) : data(data), size(size) {}
637
10
  MallocedBuffer(MallocedBuffer&& other) : data(other.data), size(other.size) {
638
10
    other.data = nullptr;
639
10
  }
Unexecuted instantiation: node::MallocedBuffer<unsigned char>::MallocedBuffer(node::MallocedBuffer<unsigned char>&&)
node::MallocedBuffer<char>::MallocedBuffer(node::MallocedBuffer<char>&&)
Line
Count
Source
637
10
  MallocedBuffer(MallocedBuffer&& other) : data(other.data), size(other.size) {
638
10
    other.data = nullptr;
639
10
  }
640
2
  MallocedBuffer& operator=(MallocedBuffer&& other) {
641
2
    this->~MallocedBuffer();
642
2
    return *new(this) MallocedBuffer(std::move(other));
643
2
  }
Unexecuted instantiation: node::MallocedBuffer<unsigned char>::operator=(node::MallocedBuffer<unsigned char>&&)
node::MallocedBuffer<char>::operator=(node::MallocedBuffer<char>&&)
Line
Count
Source
640
2
  MallocedBuffer& operator=(MallocedBuffer&& other) {
641
2
    this->~MallocedBuffer();
642
2
    return *new(this) MallocedBuffer(std::move(other));
643
2
  }
644
20
  ~MallocedBuffer() {
645
20
    free(data);
646
20
  }
Unexecuted instantiation: node::MallocedBuffer<unsigned char>::~MallocedBuffer()
node::MallocedBuffer<char>::~MallocedBuffer()
Line
Count
Source
644
20
  ~MallocedBuffer() {
645
20
    free(data);
646
20
  }
647
  MallocedBuffer(const MallocedBuffer&) = delete;
648
  MallocedBuffer& operator=(const MallocedBuffer&) = delete;
649
};
650
651
template <typename T>
652
class NonCopyableMaybe {
653
 public:
654
1.07k
  NonCopyableMaybe() : empty_(true) {}
node::NonCopyableMaybe<node::crypto::ByteSource>::NonCopyableMaybe()
Line
Count
Source
654
1.07k
  NonCopyableMaybe() : empty_(true) {}
Unexecuted instantiation: node::NonCopyableMaybe<node::crypto::PrivateKeyEncodingConfig>::NonCopyableMaybe()
655
  explicit NonCopyableMaybe(T&& value)
656
1.07k
      : empty_(false),
657
1.07k
        value_(std::move(value)) {}
node::NonCopyableMaybe<node::crypto::ByteSource>::NonCopyableMaybe(node::crypto::ByteSource&&)
Line
Count
Source
656
2
      : empty_(false),
657
2
        value_(std::move(value)) {}
node::NonCopyableMaybe<node::crypto::PrivateKeyEncodingConfig>::NonCopyableMaybe(node::crypto::PrivateKeyEncodingConfig&&)
Line
Count
Source
656
1.07k
      : empty_(false),
657
1.07k
        value_(std::move(value)) {}
658
659
1.07k
  bool IsEmpty() const {
660
1.07k
    return empty_;
661
1.07k
  }
node::NonCopyableMaybe<node::crypto::ByteSource>::IsEmpty() const
Line
Count
Source
659
2
  bool IsEmpty() const {
660
2
    return empty_;
661
2
  }
node::NonCopyableMaybe<node::crypto::PrivateKeyEncodingConfig>::IsEmpty() const
Line
Count
Source
659
1.07k
  bool IsEmpty() const {
660
1.07k
    return empty_;
661
1.07k
  }
662
663
1.06k
  const T* get() const {
664
1.06k
    return empty_ ? nullptr : &value_;
665
1.06k
  }
666
667
4
  const T* operator->() const {
668
4
    CHECK(!empty_);
669
4
    return &value_;
670
4
  }
671
672
1.07k
  T&& Release() {
673
1.07k
    CHECK_EQ(empty_, false);
674
1.07k
    empty_ = true;
675
1.07k
    return std::move(value_);
676
1.07k
  }
677
678
 private:
679
  bool empty_;
680
  T value_;
681
};
682
683
// Test whether some value can be called with ().
684
template <typename T, typename = void>
685
struct is_callable : std::is_function<T> { };
686
687
template <typename T>
688
struct is_callable<T, typename std::enable_if<
689
    std::is_same<decltype(void(&T::operator())), void>::value
690
    >::type> : std::true_type { };
691
692
template <typename T, void (*function)(T*)>
693
struct FunctionDeleter {
694
43.5k
  void operator()(T* pointer) const { function(pointer); }
node::FunctionDeleter<bignum_st, &BN_clear_free>::operator()(bignum_st*) const
Line
Count
Source
694
4
  void operator()(T* pointer) const { function(pointer); }
node::FunctionDeleter<evp_pkey_st, &EVP_PKEY_free>::operator()(evp_pkey_st*) const
Line
Count
Source
694
797
  void operator()(T* pointer) const { function(pointer); }
node::FunctionDeleter<hostent, &ares_free_hostent>::operator()(hostent*) const
Line
Count
Source
694
22
  void operator()(T* pointer) const { function(pointer); }
Unexecuted instantiation: node::FunctionDeleter<hostent, &node::cares_wrap::safe_free_hostent>::operator()(hostent*) const
node::FunctionDeleter<evp_md_st, &EVP_MD_free>::operator()(evp_md_st*) const
Line
Count
Source
694
21.0k
  void operator()(T* pointer) const { function(pointer); }
Unexecuted instantiation: node::FunctionDeleter<v8::HeapSnapshot const, &node::heap::DeleteHeapSnapshot>::operator()(v8::HeapSnapshot const*) const
Unexecuted instantiation: node::FunctionDeleter<node::Environment, &node::FreeEnvironment>::operator()(node::Environment*) const
Unexecuted instantiation: node::FunctionDeleter<node::IsolateData, &node::FreeIsolateData>::operator()(node::IsolateData*) const
node::FunctionDeleter<BrotliEncoderStateStruct, &BrotliEncoderDestroyInstance>::operator()(BrotliEncoderStateStruct*) const
Line
Count
Source
694
4.33k
  void operator()(T* pointer) const { function(pointer); }
Unexecuted instantiation: node::FunctionDeleter<BrotliDecoderStateStruct, &BrotliDecoderDestroyInstance>::operator()(BrotliDecoderStateStruct*) const
Unexecuted instantiation: node::FunctionDeleter<node::inspector::ServerSocket, &node::inspector::InspectorSocketServer::CloseServerSocket>::operator()(node::inspector::ServerSocket*) const
node::FunctionDeleter<bio_st, &BIO_free_all>::operator()(bio_st*) const
Line
Count
Source
694
10.9k
  void operator()(T* pointer) const { function(pointer); }
node::FunctionDeleter<x509_st, &X509_free>::operator()(x509_st*) const
Line
Count
Source
694
1.53k
  void operator()(T* pointer) const { function(pointer); }
node::FunctionDeleter<ssl_ctx_st, &SSL_CTX_free>::operator()(ssl_ctx_st*) const
Line
Count
Source
694
1.51k
  void operator()(T* pointer) const { function(pointer); }
Unexecuted instantiation: node::FunctionDeleter<X509_crl_st, &X509_CRL_free>::operator()(X509_crl_st*) const
node::FunctionDeleter<dh_st, &DH_free>::operator()(dh_st*) const
Line
Count
Source
694
2
  void operator()(T* pointer) const { function(pointer); }
Unexecuted instantiation: node::FunctionDeleter<PKCS12_st, &PKCS12_free>::operator()(PKCS12_st*) const
node::FunctionDeleter<ssl_st, &SSL_free>::operator()(ssl_st*) const
Line
Count
Source
694
757
  void operator()(T* pointer) const { function(pointer); }
Unexecuted instantiation: node::FunctionDeleter<rsa_st, &RSA_free>::operator()(rsa_st*) const
Unexecuted instantiation: node::FunctionDeleter<pkcs8_priv_key_info_st, &PKCS8_PRIV_KEY_INFO_free>::operator()(pkcs8_priv_key_info_st*) const
node::FunctionDeleter<ec_key_st, &EC_KEY_free>::operator()(ec_key_st*) const
Line
Count
Source
694
7
  void operator()(T* pointer) const { function(pointer); }
node::FunctionDeleter<ec_point_st, &EC_POINT_free>::operator()(ec_point_st*) const
Line
Count
Source
694
6
  void operator()(T* pointer) const { function(pointer); }
node::FunctionDeleter<evp_pkey_ctx_st, &EVP_PKEY_CTX_free>::operator()(evp_pkey_ctx_st*) const
Line
Count
Source
694
14
  void operator()(T* pointer) const { function(pointer); }
Unexecuted instantiation: node::FunctionDeleter<ssl_session_st, &SSL_SESSION_free>::operator()(ssl_session_st*) const
Unexecuted instantiation: node::FunctionDeleter<hdr_histogram, &hdr_close>::operator()(hdr_histogram*) const
Unexecuted instantiation: node::FunctionDeleter<node::inspector::TcpHolder, &node::inspector::TcpHolder::DisconnectAndDispose>::operator()(node::inspector::TcpHolder*) const
Unexecuted instantiation: node::FunctionDeleter<node::inspector::ProtocolHandler, &node::inspector::InspectorSocket::Shutdown>::operator()(node::inspector::ProtocolHandler*) const
node::FunctionDeleter<evp_cipher_ctx_st, &EVP_CIPHER_CTX_free>::operator()(evp_cipher_ctx_st*) const
Line
Count
Source
694
9
  void operator()(T* pointer) const { function(pointer); }
node::FunctionDeleter<x509_store_ctx_st, &X509_STORE_CTX_free>::operator()(x509_store_ctx_st*) const
Line
Count
Source
694
757
  void operator()(T* pointer) const { function(pointer); }
Unexecuted instantiation: node::FunctionDeleter<ECDSA_SIG_st, &ECDSA_SIG_free>::operator()(ECDSA_SIG_st*) const
node::FunctionDeleter<evp_md_ctx_st, &EVP_MD_CTX_free>::operator()(evp_md_ctx_st*) const
Line
Count
Source
694
1.83k
  void operator()(T* pointer) const { function(pointer); }
node::FunctionDeleter<ec_group_st, &EC_GROUP_free>::operator()(ec_group_st*) const
Line
Count
Source
694
1
  void operator()(T* pointer) const { function(pointer); }
node::FunctionDeleter<hmac_ctx_st, &HMAC_CTX_free>::operator()(hmac_ctx_st*) const
Line
Count
Source
694
6
  void operator()(T* pointer) const { function(pointer); }
Unexecuted instantiation: node::FunctionDeleter<bignum_ctx, &BN_CTX_free>::operator()(bignum_ctx*) const
Unexecuted instantiation: node::FunctionDeleter<Netscape_spki_st, &NETSCAPE_SPKI_free>::operator()(Netscape_spki_st*) const
Unexecuted instantiation: node::FunctionDeleter<ngtcp2_conn, &ngtcp2_conn_del>::operator()(ngtcp2_conn*) const
Unexecuted instantiation: node::FunctionDeleter<nghttp3_conn, &nghttp3_conn_del>::operator()(nghttp3_conn*) const
695
  typedef std::unique_ptr<T, FunctionDeleter> Pointer;
696
};
697
698
template <typename T, void (*function)(T*)>
699
using DeleteFnPtr = typename FunctionDeleter<T, function>::Pointer;
700
701
// Convert a v8::Array into an std::vector using the callback-based API.
702
// This can be faster than calling Array::Get() repeatedly when the array
703
// has more than 2 entries.
704
// Note that iterating over an array in C++ and performing operations on each
705
// element in a C++ loop is still slower than iterating over the array in JS
706
// and calling into native in the JS loop repeatedly on each element,
707
// as of V8 11.9.
708
inline v8::Maybe<void> FromV8Array(v8::Local<v8::Context> context,
709
                                   v8::Local<v8::Array> js_array,
710
                                   std::vector<v8::Global<v8::Value>>* out);
711
std::vector<std::string_view> SplitString(const std::string_view in,
712
                                          const std::string_view delim);
713
714
inline v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
715
                                           std::string_view str,
716
                                           v8::Isolate* isolate = nullptr);
717
template <typename T, typename test_for_number =
718
    typename std::enable_if<std::numeric_limits<T>::is_specialized, bool>::type>
719
inline v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
720
                                           const T& number,
721
                                           v8::Isolate* isolate = nullptr);
722
template <typename T>
723
inline v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
724
                                           const std::vector<T>& vec,
725
                                           v8::Isolate* isolate = nullptr);
726
template <typename T>
727
inline v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
728
                                           const std::set<T>& set,
729
                                           v8::Isolate* isolate = nullptr);
730
template <typename T, typename U>
731
inline v8::MaybeLocal<v8::Value> ToV8Value(v8::Local<v8::Context> context,
732
                                           const std::unordered_map<T, U>& map,
733
                                           v8::Isolate* isolate = nullptr);
734
735
// These macros expects a `Isolate* isolate` and a `Local<Context> context`
736
// to be in the scope.
737
#define READONLY_PROPERTY(obj, name, value)                                    \
738
3.05M
  do {                                                                         \
739
3.05M
    obj->DefineOwnProperty(                                                    \
740
3.05M
           context, FIXED_ONE_BYTE_STRING(isolate, name), value, v8::ReadOnly) \
741
3.05M
        .Check();                                                              \
742
3.05M
  } while (0)
743
744
#define READONLY_DONT_ENUM_PROPERTY(obj, name, var)                            \
745
  do {                                                                         \
746
    obj->DefineOwnProperty(                                                    \
747
           context,                                                            \
748
           OneByteString(isolate, name),                                       \
749
           var,                                                                \
750
           static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum))    \
751
        .Check();                                                              \
752
  } while (0)
753
754
#define READONLY_FALSE_PROPERTY(obj, name)                                     \
755
244k
  READONLY_PROPERTY(obj, name, v8::False(isolate))
756
757
#define READONLY_TRUE_PROPERTY(obj, name)                                      \
758
854k
  READONLY_PROPERTY(obj, name, v8::True(isolate))
759
760
#define READONLY_STRING_PROPERTY(obj, name, str)                               \
761
488k
  READONLY_PROPERTY(obj, name, ToV8Value(context, str).ToLocalChecked())
762
763
// Variation on NODE_DEFINE_CONSTANT that sets a String value.
764
#define NODE_DEFINE_STRING_CONSTANT(target, name, constant)                    \
765
122k
  do {                                                                         \
766
122k
    v8::Isolate* isolate = target->GetIsolate();                               \
767
122k
    v8::Local<v8::String> constant_name =                                      \
768
122k
        v8::String::NewFromUtf8(isolate, name).ToLocalChecked();               \
769
122k
    v8::Local<v8::String> constant_value =                                     \
770
122k
        v8::String::NewFromUtf8(isolate, constant).ToLocalChecked();           \
771
122k
    v8::PropertyAttribute constant_attributes =                                \
772
122k
        static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontDelete);     \
773
122k
    target                                                                     \
774
122k
        ->DefineOwnProperty(isolate->GetCurrentContext(),                      \
775
122k
                            constant_name,                                     \
776
122k
                            constant_value,                                    \
777
122k
                            constant_attributes)                               \
778
122k
        .Check();                                                              \
779
122k
  } while (0)
780
781
enum class Endianness { LITTLE, BIG };
782
783
1.07k
inline Endianness GetEndianness() {
784
  // Constant-folded by the compiler.
785
1.07k
  const union {
786
1.07k
    uint8_t u8[2];
787
1.07k
    uint16_t u16;
788
1.07k
  } u = {{1, 0}};
789
1.07k
  return u.u16 == 1 ? Endianness::LITTLE : Endianness::BIG;
790
1.07k
}
791
792
0
inline bool IsLittleEndian() {
793
0
  return GetEndianness() == Endianness::LITTLE;
794
0
}
795
796
1.07k
inline bool IsBigEndian() {
797
1.07k
  return GetEndianness() == Endianness::BIG;
798
1.07k
}
799
800
// Round up a to the next highest multiple of b.
801
template <typename T>
802
7
constexpr T RoundUp(T a, T b) {
803
7
  return a % b != 0 ? a + b - (a % b) : a;
804
7
}
805
806
// Align ptr to an `alignment`-bytes boundary.
807
template <typename T, typename U>
808
7
constexpr T* AlignUp(T* ptr, U alignment) {
809
7
  return reinterpret_cast<T*>(
810
7
      RoundUp(reinterpret_cast<uintptr_t>(ptr), alignment));
811
7
}
Unexecuted instantiation: char* node::AlignUp<char, unsigned long>(char*, unsigned long)
unsigned short* node::AlignUp<unsigned short, unsigned long>(unsigned short*, unsigned long)
Line
Count
Source
808
7
constexpr T* AlignUp(T* ptr, U alignment) {
809
7
  return reinterpret_cast<T*>(
810
7
      RoundUp(reinterpret_cast<uintptr_t>(ptr), alignment));
811
7
}
812
813
class SlicedArguments : public MaybeStackBuffer<v8::Local<v8::Value>> {
814
 public:
815
  inline explicit SlicedArguments(
816
      const v8::FunctionCallbackInfo<v8::Value>& args, size_t start = 0);
817
};
818
819
// Convert a v8::PersistentBase, e.g. v8::Global, to a Local, with an extra
820
// optimization for strong persistent handles.
821
class PersistentToLocal {
822
 public:
823
  // If persistent.IsWeak() == false, then do not call persistent.Reset()
824
  // while the returned Local<T> is still in scope, it will destroy the
825
  // reference to the object.
826
  template <class TypeName>
827
  static inline v8::Local<TypeName> Default(
828
      v8::Isolate* isolate,
829
1.30M
      const v8::PersistentBase<TypeName>& persistent) {
830
1.30M
    if (persistent.IsWeak()) {
831
1.01M
      return PersistentToLocal::Weak(isolate, persistent);
832
1.01M
    } else {
833
292k
      return PersistentToLocal::Strong(persistent);
834
292k
    }
835
1.30M
  }
v8::Local<v8::Object> node::PersistentToLocal::Default<v8::Object>(v8::Isolate*, v8::PersistentBase<v8::Object> const&)
Line
Count
Source
829
1.29M
      const v8::PersistentBase<TypeName>& persistent) {
830
1.29M
    if (persistent.IsWeak()) {
831
1.00M
      return PersistentToLocal::Weak(isolate, persistent);
832
1.00M
    } else {
833
292k
      return PersistentToLocal::Strong(persistent);
834
292k
    }
835
1.29M
  }
v8::Local<v8::Context> node::PersistentToLocal::Default<v8::Context>(v8::Isolate*, v8::PersistentBase<v8::Context> const&)
Line
Count
Source
829
12.3k
      const v8::PersistentBase<TypeName>& persistent) {
830
12.3k
    if (persistent.IsWeak()) {
831
12.3k
      return PersistentToLocal::Weak(isolate, persistent);
832
12.3k
    } else {
833
0
      return PersistentToLocal::Strong(persistent);
834
0
    }
835
12.3k
  }
v8::Local<v8::UnboundScript> node::PersistentToLocal::Default<v8::UnboundScript>(v8::Isolate*, v8::PersistentBase<v8::UnboundScript> const&)
Line
Count
Source
829
953
      const v8::PersistentBase<TypeName>& persistent) {
830
953
    if (persistent.IsWeak()) {
831
953
      return PersistentToLocal::Weak(isolate, persistent);
832
953
    } else {
833
0
      return PersistentToLocal::Strong(persistent);
834
0
    }
835
953
  }
Unexecuted instantiation: v8::Local<v8::Function> node::PersistentToLocal::Default<v8::Function>(v8::Isolate*, v8::PersistentBase<v8::Function> const&)
Unexecuted instantiation: v8::Local<v8::ArrayBufferView> node::PersistentToLocal::Default<v8::ArrayBufferView>(v8::Isolate*, v8::PersistentBase<v8::ArrayBufferView> const&)
Unexecuted instantiation: v8::Local<v8::FunctionTemplate> node::PersistentToLocal::Default<v8::FunctionTemplate>(v8::Isolate*, v8::PersistentBase<v8::FunctionTemplate> const&)
836
837
  // Unchecked conversion from a non-weak Persistent<T> to Local<T>,
838
  // use with care!
839
  //
840
  // Do not call persistent.Reset() while the returned Local<T> is still in
841
  // scope, it will destroy the reference to the object.
842
  template <class TypeName>
843
  static inline v8::Local<TypeName> Strong(
844
31.6M
      const v8::PersistentBase<TypeName>& persistent) {
845
31.6M
    DCHECK(!persistent.IsWeak());
846
31.6M
    return *reinterpret_cast<v8::Local<TypeName>*>(
847
31.6M
        const_cast<v8::PersistentBase<TypeName>*>(&persistent));
848
31.6M
  }
v8::Local<v8::Array> node::PersistentToLocal::Strong<v8::Array>(v8::PersistentBase<v8::Array> const&)
Line
Count
Source
844
163k
      const v8::PersistentBase<TypeName>& persistent) {
845
163k
    DCHECK(!persistent.IsWeak());
846
163k
    return *reinterpret_cast<v8::Local<TypeName>*>(
847
163k
        const_cast<v8::PersistentBase<TypeName>*>(&persistent));
848
163k
  }
v8::Local<v8::Object> node::PersistentToLocal::Strong<v8::Object>(v8::PersistentBase<v8::Object> const&)
Line
Count
Source
844
2.46M
      const v8::PersistentBase<TypeName>& persistent) {
845
2.46M
    DCHECK(!persistent.IsWeak());
846
2.46M
    return *reinterpret_cast<v8::Local<TypeName>*>(
847
2.46M
        const_cast<v8::PersistentBase<TypeName>*>(&persistent));
848
2.46M
  }
v8::Local<v8::Function> node::PersistentToLocal::Strong<v8::Function>(v8::PersistentBase<v8::Function> const&)
Line
Count
Source
844
1.91M
      const v8::PersistentBase<TypeName>& persistent) {
845
1.91M
    DCHECK(!persistent.IsWeak());
846
1.91M
    return *reinterpret_cast<v8::Local<TypeName>*>(
847
1.91M
        const_cast<v8::PersistentBase<TypeName>*>(&persistent));
848
1.91M
  }
v8::Local<v8::Context> node::PersistentToLocal::Strong<v8::Context>(v8::PersistentBase<v8::Context> const&)
Line
Count
Source
844
27.1M
      const v8::PersistentBase<TypeName>& persistent) {
845
27.1M
    DCHECK(!persistent.IsWeak());
846
27.1M
    return *reinterpret_cast<v8::Local<TypeName>*>(
847
27.1M
        const_cast<v8::PersistentBase<TypeName>*>(&persistent));
848
27.1M
  }
v8::Local<v8::Value> node::PersistentToLocal::Strong<v8::Value>(v8::PersistentBase<v8::Value> const&)
Line
Count
Source
844
2
      const v8::PersistentBase<TypeName>& persistent) {
845
2
    DCHECK(!persistent.IsWeak());
846
2
    return *reinterpret_cast<v8::Local<TypeName>*>(
847
2
        const_cast<v8::PersistentBase<TypeName>*>(&persistent));
848
2
  }
Unexecuted instantiation: v8::Local<v8::UnboundScript> node::PersistentToLocal::Strong<v8::UnboundScript>(v8::PersistentBase<v8::UnboundScript> const&)
Unexecuted instantiation: v8::Local<v8::ArrayBuffer> node::PersistentToLocal::Strong<v8::ArrayBuffer>(v8::PersistentBase<v8::ArrayBuffer> const&)
Unexecuted instantiation: v8::Local<v8::SharedArrayBuffer> node::PersistentToLocal::Strong<v8::SharedArrayBuffer>(v8::PersistentBase<v8::SharedArrayBuffer> const&)
Unexecuted instantiation: v8::Local<v8::WasmMemoryObject> node::PersistentToLocal::Strong<v8::WasmMemoryObject>(v8::PersistentBase<v8::WasmMemoryObject> const&)
Unexecuted instantiation: v8::Local<v8::ArrayBufferView> node::PersistentToLocal::Strong<v8::ArrayBufferView>(v8::PersistentBase<v8::ArrayBufferView> const&)
Unexecuted instantiation: v8::Local<v8::FunctionTemplate> node::PersistentToLocal::Strong<v8::FunctionTemplate>(v8::PersistentBase<v8::FunctionTemplate> const&)
849
850
  template <class TypeName>
851
  static inline v8::Local<TypeName> Weak(
852
      v8::Isolate* isolate,
853
1.13M
      const v8::PersistentBase<TypeName>& persistent) {
854
1.13M
    return v8::Local<TypeName>::New(isolate, persistent);
855
1.13M
  }
v8::Local<v8::Object> node::PersistentToLocal::Weak<v8::Object>(v8::Isolate*, v8::PersistentBase<v8::Object> const&)
Line
Count
Source
853
1.00M
      const v8::PersistentBase<TypeName>& persistent) {
854
1.00M
    return v8::Local<TypeName>::New(isolate, persistent);
855
1.00M
  }
v8::Local<v8::Context> node::PersistentToLocal::Weak<v8::Context>(v8::Isolate*, v8::PersistentBase<v8::Context> const&)
Line
Count
Source
853
137k
      const v8::PersistentBase<TypeName>& persistent) {
854
137k
    return v8::Local<TypeName>::New(isolate, persistent);
855
137k
  }
v8::Local<v8::UnboundScript> node::PersistentToLocal::Weak<v8::UnboundScript>(v8::Isolate*, v8::PersistentBase<v8::UnboundScript> const&)
Line
Count
Source
853
953
      const v8::PersistentBase<TypeName>& persistent) {
854
953
    return v8::Local<TypeName>::New(isolate, persistent);
855
953
  }
Unexecuted instantiation: v8::Local<v8::Function> node::PersistentToLocal::Weak<v8::Function>(v8::Isolate*, v8::PersistentBase<v8::Function> const&)
Unexecuted instantiation: v8::Local<v8::ArrayBufferView> node::PersistentToLocal::Weak<v8::ArrayBufferView>(v8::Isolate*, v8::PersistentBase<v8::ArrayBufferView> const&)
Unexecuted instantiation: v8::Local<v8::FunctionTemplate> node::PersistentToLocal::Weak<v8::FunctionTemplate>(v8::Isolate*, v8::PersistentBase<v8::FunctionTemplate> const&)
856
};
857
858
// Can be used as a key for std::unordered_map when lookup performance is more
859
// important than size and the keys are statically used to avoid redundant hash
860
// computations.
861
class FastStringKey {
862
 public:
863
  constexpr explicit FastStringKey(std::string_view name);
864
865
  struct Hash {
866
    constexpr size_t operator()(const FastStringKey& key) const;
867
  };
868
  constexpr bool operator==(const FastStringKey& other) const;
869
870
  constexpr std::string_view as_string_view() const;
871
872
 private:
873
  static constexpr size_t HashImpl(std::string_view str);
874
875
  const std::string_view name_;
876
  const size_t cached_hash_;
877
};
878
879
// Like std::static_pointer_cast but for unique_ptr with the default deleter.
880
template <typename T, typename U>
881
0
std::unique_ptr<T> static_unique_pointer_cast(std::unique_ptr<U>&& ptr) {
882
0
  return std::unique_ptr<T>(static_cast<T*>(ptr.release()));
883
0
}
884
885
2.80M
#define MAYBE_FIELD_PTR(ptr, field) ptr == nullptr ? nullptr : &(ptr->field)
886
887
// Returns a non-zero code if it fails to open or read the file,
888
// aborts if it fails to close the file.
889
int ReadFileSync(std::string* result, const char* path);
890
// Reads all contents of a FILE*, aborts if it fails.
891
std::vector<char> ReadFileSync(FILE* fp);
892
893
v8::Local<v8::FunctionTemplate> NewFunctionTemplate(
894
    v8::Isolate* isolate,
895
    v8::FunctionCallback callback,
896
    v8::Local<v8::Signature> signature = v8::Local<v8::Signature>(),
897
    v8::ConstructorBehavior behavior = v8::ConstructorBehavior::kAllow,
898
    v8::SideEffectType side_effect = v8::SideEffectType::kHasSideEffect,
899
    const v8::CFunction* c_function = nullptr);
900
901
// Convenience methods for NewFunctionTemplate().
902
void SetMethod(v8::Local<v8::Context> context,
903
               v8::Local<v8::Object> that,
904
               const std::string_view name,
905
               v8::FunctionCallback callback);
906
// Similar to SetProtoMethod but without receiver signature checks.
907
void SetMethod(v8::Isolate* isolate,
908
               v8::Local<v8::Template> that,
909
               const std::string_view name,
910
               v8::FunctionCallback callback);
911
912
void SetFastMethod(v8::Isolate* isolate,
913
                   v8::Local<v8::Template> that,
914
                   const std::string_view name,
915
                   v8::FunctionCallback slow_callback,
916
                   const v8::CFunction* c_function);
917
void SetFastMethod(v8::Local<v8::Context> context,
918
                   v8::Local<v8::Object> that,
919
                   const std::string_view name,
920
                   v8::FunctionCallback slow_callback,
921
                   const v8::CFunction* c_function);
922
void SetFastMethod(v8::Isolate* isolate,
923
                   v8::Local<v8::Template> that,
924
                   const std::string_view name,
925
                   v8::FunctionCallback slow_callback,
926
                   const v8::MemorySpan<const v8::CFunction>& methods);
927
void SetFastMethodNoSideEffect(v8::Isolate* isolate,
928
                               v8::Local<v8::Template> that,
929
                               const std::string_view name,
930
                               v8::FunctionCallback slow_callback,
931
                               const v8::CFunction* c_function);
932
void SetFastMethodNoSideEffect(v8::Local<v8::Context> context,
933
                               v8::Local<v8::Object> that,
934
                               const std::string_view name,
935
                               v8::FunctionCallback slow_callback,
936
                               const v8::CFunction* c_function);
937
void SetFastMethodNoSideEffect(
938
    v8::Isolate* isolate,
939
    v8::Local<v8::Template> that,
940
    const std::string_view name,
941
    v8::FunctionCallback slow_callback,
942
    const v8::MemorySpan<const v8::CFunction>& methods);
943
void SetProtoMethod(v8::Isolate* isolate,
944
                    v8::Local<v8::FunctionTemplate> that,
945
                    const std::string_view name,
946
                    v8::FunctionCallback callback);
947
948
void SetInstanceMethod(v8::Isolate* isolate,
949
                       v8::Local<v8::FunctionTemplate> that,
950
                       const std::string_view name,
951
                       v8::FunctionCallback callback);
952
953
// Safe variants denote the function has no side effects.
954
void SetMethodNoSideEffect(v8::Local<v8::Context> context,
955
                           v8::Local<v8::Object> that,
956
                           const std::string_view name,
957
                           v8::FunctionCallback callback);
958
void SetProtoMethodNoSideEffect(v8::Isolate* isolate,
959
                                v8::Local<v8::FunctionTemplate> that,
960
                                const std::string_view name,
961
                                v8::FunctionCallback callback);
962
void SetMethodNoSideEffect(v8::Isolate* isolate,
963
                           v8::Local<v8::Template> that,
964
                           const std::string_view name,
965
                           v8::FunctionCallback callback);
966
967
enum class SetConstructorFunctionFlag {
968
  NONE,
969
  SET_CLASS_NAME,
970
};
971
972
void SetConstructorFunction(v8::Local<v8::Context> context,
973
                            v8::Local<v8::Object> that,
974
                            const char* name,
975
                            v8::Local<v8::FunctionTemplate> tmpl,
976
                            SetConstructorFunctionFlag flag =
977
                                SetConstructorFunctionFlag::SET_CLASS_NAME);
978
979
void SetConstructorFunction(v8::Local<v8::Context> context,
980
                            v8::Local<v8::Object> that,
981
                            v8::Local<v8::String> name,
982
                            v8::Local<v8::FunctionTemplate> tmpl,
983
                            SetConstructorFunctionFlag flag =
984
                                SetConstructorFunctionFlag::SET_CLASS_NAME);
985
986
void SetConstructorFunction(v8::Isolate* isolate,
987
                            v8::Local<v8::Template> that,
988
                            const char* name,
989
                            v8::Local<v8::FunctionTemplate> tmpl,
990
                            SetConstructorFunctionFlag flag =
991
                                SetConstructorFunctionFlag::SET_CLASS_NAME);
992
993
void SetConstructorFunction(v8::Isolate* isolate,
994
                            v8::Local<v8::Template> that,
995
                            v8::Local<v8::String> name,
996
                            v8::Local<v8::FunctionTemplate> tmpl,
997
                            SetConstructorFunctionFlag flag =
998
                                SetConstructorFunctionFlag::SET_CLASS_NAME);
999
1000
// Like RAIIIsolate, except doesn't enter the isolate while it's in scope.
1001
class RAIIIsolateWithoutEntering {
1002
 public:
1003
  explicit RAIIIsolateWithoutEntering(const SnapshotData* data = nullptr);
1004
  ~RAIIIsolateWithoutEntering();
1005
1006
0
  v8::Isolate* get() const { return isolate_; }
1007
1008
 private:
1009
  std::unique_ptr<v8::ArrayBuffer::Allocator> allocator_;
1010
  v8::Isolate* isolate_;
1011
};
1012
1013
// Simple RAII class to spin up a v8::Isolate instance and enter it
1014
// immediately.
1015
class RAIIIsolate {
1016
 public:
1017
  explicit RAIIIsolate(const SnapshotData* data = nullptr);
1018
  ~RAIIIsolate();
1019
1020
0
  v8::Isolate* get() const { return isolate_.get(); }
1021
1022
 private:
1023
  RAIIIsolateWithoutEntering isolate_;
1024
  v8::Isolate::Scope isolate_scope_;
1025
};
1026
1027
std::string DetermineSpecificErrorType(Environment* env,
1028
                                       v8::Local<v8::Value> input);
1029
1030
v8::Maybe<int32_t> GetValidatedFd(Environment* env, v8::Local<v8::Value> input);
1031
v8::Maybe<int> GetValidFileMode(Environment* env,
1032
                                v8::Local<v8::Value> input,
1033
                                uv_fs_type type);
1034
1035
}  // namespace node
1036
1037
#endif  // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
1038
1039
#endif  // SRC_UTIL_H_