node-linux-arm64 20.8.1 → 21.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/CHANGELOG.md +237 -1639
  2. package/README.md +3 -3
  3. package/bin/node +0 -0
  4. package/include/node/common.gypi +3 -3
  5. package/include/node/config.gypi +5 -3
  6. package/include/node/cppgc/internal/api-constants.h +23 -4
  7. package/include/node/cppgc/internal/caged-heap-local-data.h +16 -6
  8. package/include/node/cppgc/internal/caged-heap.h +12 -5
  9. package/include/node/cppgc/internal/gc-info.h +82 -91
  10. package/include/node/cppgc/internal/member-storage.h +16 -8
  11. package/include/node/cppgc/member.h +25 -0
  12. package/include/node/cppgc/persistent.h +4 -0
  13. package/include/node/cppgc/platform.h +6 -1
  14. package/include/node/cppgc/sentinel-pointer.h +7 -0
  15. package/include/node/cppgc/source-location.h +2 -78
  16. package/include/node/cppgc/trace-trait.h +8 -0
  17. package/include/node/cppgc/visitor.h +82 -4
  18. package/include/node/js_native_api.h +11 -1
  19. package/include/node/libplatform/libplatform.h +7 -1
  20. package/include/node/node.h +2 -0
  21. package/include/node/node_api.h +8 -7
  22. package/include/node/node_version.h +8 -7
  23. package/include/node/v8-callbacks.h +52 -8
  24. package/include/node/v8-context.h +10 -13
  25. package/include/node/v8-embedder-heap.h +12 -0
  26. package/include/node/v8-function-callback.h +11 -15
  27. package/include/node/v8-function.h +6 -0
  28. package/include/node/v8-handle-base.h +185 -0
  29. package/include/node/v8-internal.h +109 -77
  30. package/include/node/v8-isolate.h +130 -89
  31. package/include/node/v8-local-handle.h +134 -89
  32. package/include/node/v8-object.h +71 -69
  33. package/include/node/v8-persistent-handle.h +65 -89
  34. package/include/node/v8-platform.h +140 -9
  35. package/include/node/v8-primitive.h +12 -8
  36. package/include/node/v8-profiler.h +16 -2
  37. package/include/node/v8-script.h +9 -7
  38. package/include/node/v8-snapshot.h +4 -1
  39. package/include/node/v8-source-location.h +92 -0
  40. package/include/node/v8-statistics.h +36 -1
  41. package/include/node/v8-traced-handle.h +37 -54
  42. package/include/node/v8-unwinder.h +1 -1
  43. package/include/node/v8-value-serializer.h +14 -0
  44. package/include/node/v8-value.h +14 -0
  45. package/include/node/v8-version.h +3 -3
  46. package/include/node/v8config.h +19 -10
  47. package/package.json +1 -1
  48. package/share/doc/node/gdbinit +60 -6
  49. package/share/doc/node/lldb_commands.py +73 -10
  50. package/share/man/man1/node.1 +12 -0
@@ -11,6 +11,7 @@
11
11
  #include <unordered_set>
12
12
  #include <vector>
13
13
 
14
+ #include "cppgc/common.h" // NOLINT(build/include_directory)
14
15
  #include "v8-local-handle.h" // NOLINT(build/include_directory)
15
16
  #include "v8-message.h" // NOLINT(build/include_directory)
16
17
  #include "v8-persistent-handle.h" // NOLINT(build/include_directory)
@@ -24,7 +25,7 @@ enum class EmbedderStateTag : uint8_t;
24
25
  class HeapGraphNode;
25
26
  struct HeapStatsUpdate;
26
27
  class Object;
27
- enum StateTag : int;
28
+ enum StateTag : uint16_t;
28
29
 
29
30
  using NativeObject = void*;
30
31
  using SnapshotObjectId = uint32_t;
@@ -596,7 +597,6 @@ class V8_EXPORT HeapGraphNode {
596
597
  kBigInt = 13, // BigInt.
597
598
  kObjectShape = 14, // Internal data used for tracking the shapes (or
598
599
  // "hidden classes") of JS objects.
599
- kWasmObject = 15, // A WasmGC struct or array.
600
600
  };
601
601
 
602
602
  /** Returns node type (see HeapGraphNode::Type). */
@@ -883,6 +883,15 @@ class V8_EXPORT EmbedderGraph {
883
883
  */
884
884
  virtual Detachedness GetDetachedness() { return Detachedness::kUnknown; }
885
885
 
886
+ /**
887
+ * Returns the address of the object in the embedder heap, or nullptr to not
888
+ * specify the address. If this address is provided, then V8 can generate
889
+ * consistent IDs for objects across subsequent heap snapshots, which allows
890
+ * devtools to determine which objects were retained from one snapshot to
891
+ * the next. This value is used only if GetNativeObject returns nullptr.
892
+ */
893
+ virtual const void* GetAddress() { return nullptr; }
894
+
886
895
  Node(const Node&) = delete;
887
896
  Node& operator=(const Node&) = delete;
888
897
  };
@@ -1045,6 +1054,11 @@ class V8_EXPORT HeapProfiler {
1045
1054
  * Mode for dealing with numeric values, see `NumericsMode`.
1046
1055
  */
1047
1056
  NumericsMode numerics_mode = NumericsMode::kHideNumericValues;
1057
+ /**
1058
+ * Whether stack is considered as a root set.
1059
+ */
1060
+ cppgc::EmbedderStackState stack_state =
1061
+ cppgc::EmbedderStackState::kMayContainHeapPointers;
1048
1062
  };
1049
1063
 
1050
1064
  /**
@@ -9,6 +9,7 @@
9
9
  #include <stdint.h>
10
10
 
11
11
  #include <memory>
12
+ #include <tuple>
12
13
  #include <vector>
13
14
 
14
15
  #include "v8-callbacks.h" // NOLINT(build/include_directory)
@@ -55,7 +56,7 @@ class V8_EXPORT ScriptOrModule {
55
56
  /**
56
57
  * A compiled JavaScript script, not yet tied to a Context.
57
58
  */
58
- class V8_EXPORT UnboundScript {
59
+ class V8_EXPORT UnboundScript : public Data {
59
60
  public:
60
61
  /**
61
62
  * Binds the script to the currently entered context.
@@ -142,10 +143,9 @@ class V8_EXPORT ModuleRequest : public Data {
142
143
  *
143
144
  * All assertions present in the module request will be supplied in this
144
145
  * list, regardless of whether they are supported by the host. Per
145
- * https://tc39.es/proposal-import-assertions/#sec-hostgetsupportedimportassertions,
146
- * hosts are expected to ignore assertions that they do not support (as
147
- * opposed to, for example, triggering an error if an unsupported assertion is
148
- * present).
146
+ * https://tc39.es/proposal-import-attributes/#sec-hostgetsupportedimportattributes,
147
+ * hosts are expected to throw for assertions that they do not support (as
148
+ * opposed to, for example, ignoring them).
149
149
  */
150
150
  Local<FixedArray> GetImportAssertions() const;
151
151
 
@@ -320,7 +320,7 @@ class V8_EXPORT Module : public Data {
320
320
  * A compiled JavaScript script, tied to a Context which was active when the
321
321
  * script was compiled.
322
322
  */
323
- class V8_EXPORT Script {
323
+ class V8_EXPORT Script : public Data {
324
324
  public:
325
325
  /**
326
326
  * A shorthand for ScriptCompiler::Compile().
@@ -650,7 +650,9 @@ class V8_EXPORT ScriptCompiler {
650
650
  static ScriptStreamingTask* StartStreaming(
651
651
  Isolate* isolate, StreamedSource* source,
652
652
  ScriptType type = ScriptType::kClassic,
653
- CompileOptions options = kNoCompileOptions);
653
+ CompileOptions options = kNoCompileOptions,
654
+ CompileHintCallback compile_hint_callback = nullptr,
655
+ void* compile_hint_callback_data = nullptr);
654
656
 
655
657
  static ConsumeCodeCacheTask* StartConsumingCodeCache(
656
658
  Isolate* isolate, std::unique_ptr<CachedData> source);
@@ -88,10 +88,13 @@ class V8_EXPORT SnapshotCreator {
88
88
  * \param existing_blob existing snapshot from which to create this one.
89
89
  * \param external_references a null-terminated array of external references
90
90
  * that must be equivalent to CreateParams::external_references.
91
+ * \param owns_isolate whether this SnapshotCreator should call
92
+ * v8::Isolate::Dispose() during its destructor.
91
93
  */
92
94
  SnapshotCreator(Isolate* isolate,
93
95
  const intptr_t* external_references = nullptr,
94
- const StartupData* existing_blob = nullptr);
96
+ const StartupData* existing_blob = nullptr,
97
+ bool owns_isolate = true);
95
98
 
96
99
  /**
97
100
  * Create and enter an isolate, and set it up for serialization.
@@ -0,0 +1,92 @@
1
+ // Copyright 2020 the V8 project authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ #ifndef INCLUDE_SOURCE_LOCATION_H_
6
+ #define INCLUDE_SOURCE_LOCATION_H_
7
+
8
+ #include <cstddef>
9
+ #include <string>
10
+
11
+ #include "v8config.h" // NOLINT(build/include_directory)
12
+
13
+ #if defined(__has_builtin)
14
+ #define V8_SUPPORTS_SOURCE_LOCATION \
15
+ (__has_builtin(__builtin_FUNCTION) && __has_builtin(__builtin_FILE) && \
16
+ __has_builtin(__builtin_LINE)) // NOLINT
17
+ #elif defined(V8_CC_GNU) && __GNUC__ >= 7
18
+ #define V8_SUPPORTS_SOURCE_LOCATION 1
19
+ #elif defined(V8_CC_INTEL) && __ICC >= 1800
20
+ #define V8_SUPPORTS_SOURCE_LOCATION 1
21
+ #else
22
+ #define V8_SUPPORTS_SOURCE_LOCATION 0
23
+ #endif
24
+
25
+ namespace v8 {
26
+
27
+ /**
28
+ * Encapsulates source location information. Mimics C++20's
29
+ * `std::source_location`.
30
+ */
31
+ class V8_EXPORT SourceLocation final {
32
+ public:
33
+ /**
34
+ * Construct source location information corresponding to the location of the
35
+ * call site.
36
+ */
37
+ #if V8_SUPPORTS_SOURCE_LOCATION
38
+ static constexpr SourceLocation Current(
39
+ const char* function = __builtin_FUNCTION(),
40
+ const char* file = __builtin_FILE(), size_t line = __builtin_LINE()) {
41
+ return SourceLocation(function, file, line);
42
+ }
43
+ #else
44
+ static constexpr SourceLocation Current() { return SourceLocation(); }
45
+ #endif // V8_SUPPORTS_SOURCE_LOCATION
46
+
47
+ /**
48
+ * Constructs unspecified source location information.
49
+ */
50
+ constexpr SourceLocation() = default;
51
+
52
+ /**
53
+ * Returns the name of the function associated with the position represented
54
+ * by this object, if any.
55
+ *
56
+ * \returns the function name as cstring.
57
+ */
58
+ constexpr const char* Function() const { return function_; }
59
+
60
+ /**
61
+ * Returns the name of the current source file represented by this object.
62
+ *
63
+ * \returns the file name as cstring.
64
+ */
65
+ constexpr const char* FileName() const { return file_; }
66
+
67
+ /**
68
+ * Returns the line number represented by this object.
69
+ *
70
+ * \returns the line number.
71
+ */
72
+ constexpr size_t Line() const { return line_; }
73
+
74
+ /**
75
+ * Returns a human-readable string representing this object.
76
+ *
77
+ * \returns a human-readable string representing source location information.
78
+ */
79
+ std::string ToString() const;
80
+
81
+ private:
82
+ constexpr SourceLocation(const char* function, const char* file, size_t line)
83
+ : function_(function), file_(file), line_(line) {}
84
+
85
+ const char* function_ = nullptr;
86
+ const char* file_ = nullptr;
87
+ size_t line_ = 0u;
88
+ };
89
+
90
+ } // namespace v8
91
+
92
+ #endif // INCLUDE_SOURCE_LOCATION_H_
@@ -46,6 +46,10 @@ enum class MeasureMemoryExecution { kDefault, kEager, kLazy };
46
46
  *
47
47
  * It specifies the contexts that need to be measured and gets called when
48
48
  * the measurement is completed to report the results.
49
+ *
50
+ * Both MeasurementComplete() callbacks will be invoked on completion.
51
+ * Each implementation of this class should hence implement only one of them,
52
+ * and leave the other empty.
49
53
  */
50
54
  class V8_EXPORT MeasureMemoryDelegate {
51
55
  public:
@@ -66,10 +70,41 @@ class V8_EXPORT MeasureMemoryDelegate {
66
70
  * \param unattributed_size_in_bytes total size of objects that were not
67
71
  * attributed to any context (i.e. are likely shared objects).
68
72
  */
73
+ V8_DEPRECATE_SOON("Please use the version that takes a result struct")
69
74
  virtual void MeasurementComplete(
70
75
  const std::vector<std::pair<Local<Context>, size_t>>&
71
76
  context_sizes_in_bytes,
72
- size_t unattributed_size_in_bytes) = 0;
77
+ size_t unattributed_size_in_bytes) {}
78
+
79
+ /** Holds the result of a memory measurement request. */
80
+ struct Result {
81
+ /**
82
+ * a vector of (context, size) pairs that includes each context for
83
+ * which ShouldMeasure returned true and that was not garbage collected
84
+ * while the memory measurement was in progress.
85
+ */
86
+ const std::vector<std::pair<Local<Context>, size_t>>&
87
+ context_sizes_in_bytes;
88
+
89
+ /**
90
+ * total size of objects that were not attributed to any context (i.e. are
91
+ * likely shared objects).
92
+ */
93
+ size_t unattributed_size_in_bytes;
94
+
95
+ /** total size of generated code for Wasm (shared across contexts). */
96
+ size_t wasm_code_size_in_bytes;
97
+
98
+ /** total size of Wasm metadata (except code; shared across contexts). */
99
+ size_t wasm_metadata_size_in_bytes;
100
+ };
101
+
102
+ /**
103
+ * This function is called when memory measurement finishes.
104
+ *
105
+ * \param result the result of the measurement.
106
+ */
107
+ virtual void MeasurementComplete(Result result) {}
73
108
 
74
109
  /**
75
110
  * Returns a default delegate that resolves the given promise when
@@ -33,7 +33,7 @@ enum class GlobalHandleStoreMode {
33
33
  };
34
34
 
35
35
  V8_EXPORT internal::Address* GlobalizeTracedReference(
36
- internal::Isolate* isolate, internal::Address* handle,
36
+ internal::Isolate* isolate, internal::Address value,
37
37
  internal::Address* slot, GlobalHandleStoreMode store_mode);
38
38
  V8_EXPORT void MoveTracedReference(internal::Address** from,
39
39
  internal::Address** to);
@@ -43,14 +43,12 @@ V8_EXPORT void DisposeTracedReference(internal::Address* global_handle);
43
43
 
44
44
  } // namespace internal
45
45
 
46
- class TracedReferenceBase {
46
+ /**
47
+ * An indirect handle, where the indirect pointer points to a GlobalHandles
48
+ * node.
49
+ */
50
+ class TracedReferenceBase : public IndirectHandleBase {
47
51
  public:
48
- /**
49
- * Returns true if the reference is empty, i.e., has not been assigned
50
- * object.
51
- */
52
- bool IsEmpty() const { return val_ == nullptr; }
53
-
54
52
  /**
55
53
  * If non-empty, destroy the underlying storage cell. |IsEmpty| will return
56
54
  * true after this call.
@@ -60,10 +58,9 @@ class TracedReferenceBase {
60
58
  /**
61
59
  * Construct a Local<Value> from this handle.
62
60
  */
63
- V8_INLINE v8::Local<v8::Value> Get(v8::Isolate* isolate) const {
61
+ V8_INLINE Local<Value> Get(Isolate* isolate) const {
64
62
  if (IsEmpty()) return Local<Value>();
65
- return Local<Value>::New(isolate,
66
- internal::ValueHelper::SlotAsValue<Value>(val_));
63
+ return Local<Value>::New(isolate, this->value<Value>());
67
64
  }
68
65
 
69
66
  /**
@@ -86,11 +83,13 @@ class TracedReferenceBase {
86
83
  V8_INLINE uint16_t WrapperClassId() const;
87
84
 
88
85
  protected:
86
+ V8_INLINE TracedReferenceBase() = default;
87
+
89
88
  /**
90
89
  * Update this reference in a thread-safe way.
91
90
  */
92
91
  void SetSlotThreadSafe(void* new_val) {
93
- reinterpret_cast<std::atomic<void*>*>(&val_)->store(
92
+ reinterpret_cast<std::atomic<void*>*>(&slot())->store(
94
93
  new_val, std::memory_order_relaxed);
95
94
  }
96
95
 
@@ -98,19 +97,13 @@ class TracedReferenceBase {
98
97
  * Get this reference in a thread-safe way
99
98
  */
100
99
  const void* GetSlotThreadSafe() const {
101
- return reinterpret_cast<std::atomic<const void*> const*>(&val_)->load(
100
+ return reinterpret_cast<std::atomic<const void*> const*>(&slot())->load(
102
101
  std::memory_order_relaxed);
103
102
  }
104
103
 
105
104
  V8_EXPORT void CheckValue() const;
106
105
 
107
- V8_INLINE internal::Address address() const { return *val_; }
108
-
109
- // val_ points to a GlobalHandles node.
110
- internal::Address* val_ = nullptr;
111
-
112
106
  friend class internal::BasicTracedReferenceExtractor;
113
- friend class internal::HandleHelper;
114
107
  template <typename F>
115
108
  friend class Local;
116
109
  template <typename U>
@@ -139,12 +132,7 @@ class BasicTracedReference : public TracedReferenceBase {
139
132
  /**
140
133
  * Construct a Local<T> from this handle.
141
134
  */
142
- Local<T> Get(Isolate* isolate) const {
143
- #ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING
144
- if (val_ == nullptr) return Local<T>();
145
- #endif
146
- return Local<T>::New(isolate, *this);
147
- }
135
+ Local<T> Get(Isolate* isolate) const { return Local<T>::New(isolate, *this); }
148
136
 
149
137
  template <class S>
150
138
  V8_INLINE BasicTracedReference<S>& As() const {
@@ -152,19 +140,17 @@ class BasicTracedReference : public TracedReferenceBase {
152
140
  const_cast<BasicTracedReference<T>&>(*this));
153
141
  }
154
142
 
155
- T* operator->() const {
143
+ V8_DEPRECATE_SOON("Use Get to convert to Local instead")
144
+ V8_INLINE T* operator->() const {
156
145
  #ifdef V8_ENABLE_CHECKS
157
146
  CheckValue();
158
147
  #endif // V8_ENABLE_CHECKS
159
- return reinterpret_cast<T*>(val_);
160
- }
161
- T* operator*() const {
162
- #ifdef V8_ENABLE_CHECKS
163
- CheckValue();
164
- #endif // V8_ENABLE_CHECKS
165
- return reinterpret_cast<T*>(val_);
148
+ return this->template value<T>();
166
149
  }
167
150
 
151
+ V8_DEPRECATE_SOON("Use Get to convert to Local instead")
152
+ V8_INLINE T* operator*() const { return this->operator->(); }
153
+
168
154
  private:
169
155
  /**
170
156
  * An empty BasicTracedReference without storage cell.
@@ -172,7 +158,7 @@ class BasicTracedReference : public TracedReferenceBase {
172
158
  BasicTracedReference() = default;
173
159
 
174
160
  V8_INLINE static internal::Address* New(
175
- Isolate* isolate, T* that, void* slot,
161
+ Isolate* isolate, T* that, internal::Address** slot,
176
162
  internal::GlobalHandleStoreMode store_mode);
177
163
 
178
164
  template <typename F>
@@ -199,7 +185,7 @@ class TracedReference : public BasicTracedReference<T> {
199
185
  /**
200
186
  * An empty TracedReference without storage cell.
201
187
  */
202
- TracedReference() : BasicTracedReference<T>() {}
188
+ V8_INLINE TracedReference() = default;
203
189
 
204
190
  /**
205
191
  * Construct a TracedReference from a Local.
@@ -209,8 +195,9 @@ class TracedReference : public BasicTracedReference<T> {
209
195
  */
210
196
  template <class S>
211
197
  TracedReference(Isolate* isolate, Local<S> that) : BasicTracedReference<T>() {
212
- this->val_ = this->New(isolate, *that, &this->val_,
213
- internal::GlobalHandleStoreMode::kInitializingStore);
198
+ this->slot() =
199
+ this->New(isolate, *that, &this->slot(),
200
+ internal::GlobalHandleStoreMode::kInitializingStore);
214
201
  static_assert(std::is_base_of<T, S>::value, "type check");
215
202
  }
216
203
 
@@ -291,18 +278,18 @@ class TracedReference : public BasicTracedReference<T> {
291
278
  // --- Implementation ---
292
279
  template <class T>
293
280
  internal::Address* BasicTracedReference<T>::New(
294
- Isolate* isolate, T* that, void* slot,
281
+ Isolate* isolate, T* that, internal::Address** slot,
295
282
  internal::GlobalHandleStoreMode store_mode) {
296
- if (that == internal::ValueHelper::EmptyValue<T>()) return nullptr;
297
- internal::Address* p = reinterpret_cast<internal::Address*>(that);
283
+ if (internal::ValueHelper::IsEmpty(that)) return nullptr;
298
284
  return internal::GlobalizeTracedReference(
299
- reinterpret_cast<internal::Isolate*>(isolate), p,
285
+ reinterpret_cast<internal::Isolate*>(isolate),
286
+ internal::ValueHelper::ValueAsAddress(that),
300
287
  reinterpret_cast<internal::Address*>(slot), store_mode);
301
288
  }
302
289
 
303
290
  void TracedReferenceBase::Reset() {
304
291
  if (IsEmpty()) return;
305
- internal::DisposeTracedReference(reinterpret_cast<internal::Address*>(val_));
292
+ internal::DisposeTracedReference(slot());
306
293
  SetSlotThreadSafe(nullptr);
307
294
  }
308
295
 
@@ -347,7 +334,7 @@ void TracedReference<T>::Reset(Isolate* isolate, const Local<S>& other) {
347
334
  this->Reset();
348
335
  if (other.IsEmpty()) return;
349
336
  this->SetSlotThreadSafe(
350
- this->New(isolate, *other, &this->val_,
337
+ this->New(isolate, *other, &this->slot(),
351
338
  internal::GlobalHandleStoreMode::kAssigningStore));
352
339
  }
353
340
 
@@ -373,9 +360,7 @@ template <class T>
373
360
  TracedReference<T>& TracedReference<T>::operator=(
374
361
  TracedReference&& rhs) noexcept {
375
362
  if (this != &rhs) {
376
- internal::MoveTracedReference(
377
- reinterpret_cast<internal::Address**>(&rhs.val_),
378
- reinterpret_cast<internal::Address**>(&this->val_));
363
+ internal::MoveTracedReference(&rhs.slot(), &this->slot());
379
364
  }
380
365
  return *this;
381
366
  }
@@ -384,10 +369,8 @@ template <class T>
384
369
  TracedReference<T>& TracedReference<T>::operator=(const TracedReference& rhs) {
385
370
  if (this != &rhs) {
386
371
  this->Reset();
387
- if (rhs.val_ != nullptr) {
388
- internal::CopyTracedReference(
389
- reinterpret_cast<const internal::Address* const*>(&rhs.val_),
390
- reinterpret_cast<internal::Address**>(&this->val_));
372
+ if (!rhs.IsEmpty()) {
373
+ internal::CopyTracedReference(&rhs.slot(), &this->slot());
391
374
  }
392
375
  }
393
376
  return *this;
@@ -396,16 +379,16 @@ TracedReference<T>& TracedReference<T>::operator=(const TracedReference& rhs) {
396
379
  void TracedReferenceBase::SetWrapperClassId(uint16_t class_id) {
397
380
  using I = internal::Internals;
398
381
  if (IsEmpty()) return;
399
- internal::Address* obj = reinterpret_cast<internal::Address*>(val_);
400
- uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kTracedNodeClassIdOffset;
382
+ uint8_t* addr =
383
+ reinterpret_cast<uint8_t*>(slot()) + I::kTracedNodeClassIdOffset;
401
384
  *reinterpret_cast<uint16_t*>(addr) = class_id;
402
385
  }
403
386
 
404
387
  uint16_t TracedReferenceBase::WrapperClassId() const {
405
388
  using I = internal::Internals;
406
389
  if (IsEmpty()) return 0;
407
- internal::Address* obj = reinterpret_cast<internal::Address*>(val_);
408
- uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kTracedNodeClassIdOffset;
390
+ uint8_t* addr =
391
+ reinterpret_cast<uint8_t*>(slot()) + I::kTracedNodeClassIdOffset;
409
392
  return *reinterpret_cast<uint16_t*>(addr);
410
393
  }
411
394
 
@@ -33,7 +33,7 @@ struct V8_EXPORT RegisterState {
33
33
  };
34
34
 
35
35
  // A StateTag represents a possible state of the VM.
36
- enum StateTag : int {
36
+ enum StateTag : uint16_t {
37
37
  JS,
38
38
  GC,
39
39
  PARSER,
@@ -75,6 +75,20 @@ class V8_EXPORT ValueSerializer {
75
75
  */
76
76
  virtual void ThrowDataCloneError(Local<String> message) = 0;
77
77
 
78
+ /**
79
+ * The embedder overrides this method to enable custom host object filter
80
+ * with Delegate::IsHostObject.
81
+ *
82
+ * This method is called at most once per serializer.
83
+ */
84
+ virtual bool HasCustomHostObject(Isolate* isolate);
85
+
86
+ /**
87
+ * The embedder overrides this method to determine if an JS object is a
88
+ * host object and needs to be serialized by the host.
89
+ */
90
+ virtual Maybe<bool> IsHostObject(Isolate* isolate, Local<Object> object);
91
+
78
92
  /**
79
93
  * The embedder overrides this method to write some kind of host object, if
80
94
  * possible. If not, a suitable exception should be thrown and
@@ -16,6 +16,8 @@
16
16
  */
17
17
  namespace v8 {
18
18
 
19
+ class Primiitive;
20
+ class Numeric;
19
21
  class BigInt;
20
22
  class Int32;
21
23
  class Integer;
@@ -354,6 +356,18 @@ class V8_EXPORT Value : public Data {
354
356
  */
355
357
  bool IsModuleNamespaceObject() const;
356
358
 
359
+ /**
360
+ * Perform `ToPrimitive(value)` as specified in:
361
+ * https://tc39.es/ecma262/#sec-toprimitive.
362
+ */
363
+ V8_WARN_UNUSED_RESULT MaybeLocal<Primitive> ToPrimitive(
364
+ Local<Context> context) const;
365
+ /**
366
+ * Perform `ToNumeric(value)` as specified in:
367
+ * https://tc39.es/ecma262/#sec-tonumeric.
368
+ */
369
+ V8_WARN_UNUSED_RESULT MaybeLocal<Numeric> ToNumeric(
370
+ Local<Context> context) const;
357
371
  /**
358
372
  * Perform the equivalent of `BigInt(value)` in JS.
359
373
  */
@@ -9,9 +9,9 @@
9
9
  // NOTE these macros are used by some of the tool scripts and the build
10
10
  // system so their names cannot be changed without changing the scripts.
11
11
  #define V8_MAJOR_VERSION 11
12
- #define V8_MINOR_VERSION 3
13
- #define V8_BUILD_NUMBER 244
14
- #define V8_PATCH_LEVEL 8
12
+ #define V8_MINOR_VERSION 8
13
+ #define V8_BUILD_NUMBER 172
14
+ #define V8_PATCH_LEVEL 13
15
15
 
16
16
  // Use 1 for candidates and 0 otherwise.
17
17
  // (Boolean macro values are not supported by all preprocessors.)
@@ -367,6 +367,7 @@ path. Add it with -I<path> to the command line
367
367
  # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
368
368
  # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
369
369
  (__has_attribute(warn_unused_result))
370
+ # define V8_HAS_ATTRIBUTE_WEAK (__has_attribute(weak))
370
371
 
371
372
  # define V8_HAS_CPP_ATTRIBUTE_NODISCARD (V8_HAS_CPP_ATTRIBUTE(nodiscard))
372
373
  # define V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS \
@@ -417,6 +418,7 @@ path. Add it with -I<path> to the command line
417
418
  # define V8_HAS_ATTRIBUTE_UNUSED 1
418
419
  # define V8_HAS_ATTRIBUTE_VISIBILITY 1
419
420
  # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT (!V8_CC_INTEL)
421
+ # define V8_HAS_ATTRIBUTE_WEAK 1
420
422
 
421
423
  // [[nodiscard]] does not work together with with
422
424
  // __attribute__((visibility(""))) on GCC 7.4 which is why there is no define
@@ -462,14 +464,16 @@ path. Add it with -I<path> to the command line
462
464
 
463
465
  #ifdef DEBUG
464
466
  // In debug mode, check assumptions instead of actually adding annotations.
465
- # define V8_ASSUME(condition) DCHECK(condition)
467
+ # define V8_ASSUME DCHECK
466
468
  #elif V8_HAS_BUILTIN_ASSUME
467
- # define V8_ASSUME(condition) __builtin_assume(condition)
469
+ # define V8_ASSUME __builtin_assume
468
470
  #elif V8_HAS_BUILTIN_UNREACHABLE
469
- # define V8_ASSUME(condition) \
470
- do { if (!(condition)) __builtin_unreachable(); } while (false)
471
+ # define V8_ASSUME(condition) \
472
+ do { \
473
+ if (!(condition)) __builtin_unreachable(); \
474
+ } while (false)
471
475
  #else
472
- # define V8_ASSUME(condition)
476
+ # define V8_ASSUME USE
473
477
  #endif
474
478
 
475
479
  #if V8_HAS_BUILTIN_ASSUME_ALIGNED
@@ -525,9 +529,6 @@ path. Add it with -I<path> to the command line
525
529
  // A macro used to change the calling conventions to preserve all registers (no
526
530
  // caller-saved registers). Use this for cold functions called from hot
527
531
  // functions.
528
- // Note: The attribute is considered experimental, so apply with care. Also,
529
- // "preserve_most" is currently not handling the return value correctly, so only
530
- // use it for functions returning void (see https://reviews.llvm.org/D141020).
531
532
  // Use like:
532
533
  // V8_NOINLINE V8_PRESERVE_MOST void UnlikelyMethod();
533
534
  #if V8_HAS_ATTRIBUTE_PRESERVE_MOST
@@ -610,6 +611,14 @@ path. Add it with -I<path> to the command line
610
611
  #endif
611
612
 
612
613
 
614
+ // Annotate functions/variables as weak to allow overriding the symbol.
615
+ #if V8_HAS_ATTRIBUTE_WEAK
616
+ #define V8_WEAK __attribute__((weak))
617
+ #else
618
+ #define V8_WEAK /* NOT SUPPORTED */
619
+ #endif
620
+
621
+
613
622
  // Annotate a class or constructor indicating the caller must assign the
614
623
  // constructed instances.
615
624
  // Apply to the whole class like:
@@ -749,7 +758,7 @@ V8 shared library set USING_V8_SHARED.
749
758
  #elif defined(__mips64)
750
759
  #define V8_HOST_ARCH_MIPS64 1
751
760
  #define V8_HOST_ARCH_64_BIT 1
752
- #elif defined(__loongarch64)
761
+ #elif defined(__loongarch_lp64)
753
762
  #define V8_HOST_ARCH_LOONG64 1
754
763
  #define V8_HOST_ARCH_64_BIT 1
755
764
  #elif defined(__PPC64__) || defined(_ARCH_PPC64)
@@ -799,7 +808,7 @@ V8 shared library set USING_V8_SHARED.
799
808
  #define V8_TARGET_ARCH_ARM 1
800
809
  #elif defined(__mips64)
801
810
  #define V8_TARGET_ARCH_MIPS64 1
802
- #elif defined(__loongarch64)
811
+ #elif defined(__loongarch_lp64)
803
812
  #define V8_TARGET_ARCH_LOONG64 1
804
813
  #elif defined(_ARCH_PPC64)
805
814
  #define V8_TARGET_ARCH_PPC64 1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-linux-arm64",
3
- "version": "v20.8.1",
3
+ "version": "v21.0.0",
4
4
  "description": "node",
5
5
  "bin": {
6
6
  "node": "bin/node"