libv8-node 15.14.0.1-aarch64-linux-musl → 18.8.0.0-aarch64-linux-musl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libv8-node/location.rb +1 -1
  3. data/ext/libv8-node/paths.rb +5 -1
  4. data/lib/libv8/node/version.rb +3 -3
  5. data/vendor/v8/{out.gn → aarch64-linux-musl}/libv8/obj/libv8_monolith.a +0 -0
  6. data/vendor/v8/include/cppgc/allocation.h +184 -47
  7. data/vendor/v8/include/cppgc/common.h +9 -6
  8. data/vendor/v8/include/cppgc/cross-thread-persistent.h +465 -0
  9. data/vendor/v8/include/cppgc/custom-space.h +37 -2
  10. data/vendor/v8/include/cppgc/default-platform.h +40 -49
  11. data/vendor/v8/include/cppgc/ephemeron-pair.h +30 -0
  12. data/vendor/v8/include/cppgc/explicit-management.h +100 -0
  13. data/vendor/v8/include/cppgc/garbage-collected.h +19 -29
  14. data/vendor/v8/include/cppgc/heap-consistency.h +266 -0
  15. data/vendor/v8/include/cppgc/heap-state.h +82 -0
  16. data/vendor/v8/include/cppgc/heap-statistics.h +120 -0
  17. data/vendor/v8/include/cppgc/heap.h +73 -6
  18. data/vendor/v8/include/cppgc/internal/api-constants.h +11 -3
  19. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +27 -15
  20. data/vendor/v8/include/cppgc/internal/compiler-specific.h +2 -2
  21. data/vendor/v8/include/cppgc/internal/finalizer-trait.h +4 -1
  22. data/vendor/v8/include/cppgc/internal/gc-info.h +124 -13
  23. data/vendor/v8/include/cppgc/internal/logging.h +3 -3
  24. data/vendor/v8/include/cppgc/internal/name-trait.h +122 -0
  25. data/vendor/v8/include/cppgc/internal/persistent-node.h +116 -16
  26. data/vendor/v8/include/cppgc/internal/pointer-policies.h +84 -32
  27. data/vendor/v8/include/cppgc/internal/write-barrier.h +392 -35
  28. data/vendor/v8/include/cppgc/liveness-broker.h +11 -2
  29. data/vendor/v8/include/cppgc/macros.h +2 -0
  30. data/vendor/v8/include/cppgc/member.h +91 -26
  31. data/vendor/v8/include/cppgc/name-provider.h +65 -0
  32. data/vendor/v8/include/cppgc/object-size-trait.h +58 -0
  33. data/vendor/v8/include/cppgc/persistent.h +70 -41
  34. data/vendor/v8/include/cppgc/platform.h +52 -26
  35. data/vendor/v8/include/cppgc/prefinalizer.h +36 -13
  36. data/vendor/v8/include/cppgc/process-heap-statistics.h +36 -0
  37. data/vendor/v8/include/cppgc/sentinel-pointer.h +32 -0
  38. data/vendor/v8/include/cppgc/source-location.h +2 -1
  39. data/vendor/v8/include/cppgc/testing.h +106 -0
  40. data/vendor/v8/include/cppgc/trace-trait.h +8 -3
  41. data/vendor/v8/include/cppgc/type-traits.h +163 -32
  42. data/vendor/v8/include/cppgc/visitor.h +194 -28
  43. data/vendor/v8/include/libplatform/libplatform.h +11 -11
  44. data/vendor/v8/include/libplatform/v8-tracing.h +2 -1
  45. data/vendor/v8/include/v8-array-buffer.h +445 -0
  46. data/vendor/v8/include/v8-callbacks.h +397 -0
  47. data/vendor/v8/include/v8-container.h +129 -0
  48. data/vendor/v8/include/v8-context.h +407 -0
  49. data/vendor/v8/include/v8-cppgc.h +151 -159
  50. data/vendor/v8/include/v8-data.h +80 -0
  51. data/vendor/v8/include/v8-date.h +43 -0
  52. data/vendor/v8/include/v8-debug.h +168 -0
  53. data/vendor/v8/include/v8-embedder-heap.h +218 -0
  54. data/vendor/v8/include/v8-embedder-state-scope.h +51 -0
  55. data/vendor/v8/include/v8-exception.h +217 -0
  56. data/vendor/v8/include/v8-extension.h +62 -0
  57. data/vendor/v8/include/v8-external.h +37 -0
  58. data/vendor/v8/include/v8-fast-api-calls.h +703 -152
  59. data/vendor/v8/include/v8-forward.h +81 -0
  60. data/vendor/v8/include/v8-function-callback.h +475 -0
  61. data/vendor/v8/include/v8-function.h +125 -0
  62. data/vendor/v8/include/v8-initialization.h +315 -0
  63. data/vendor/v8/include/v8-inspector.h +76 -27
  64. data/vendor/v8/include/v8-internal.h +285 -51
  65. data/vendor/v8/include/v8-isolate.h +1709 -0
  66. data/vendor/v8/include/v8-json.h +47 -0
  67. data/vendor/v8/include/v8-local-handle.h +455 -0
  68. data/vendor/v8/include/v8-locker.h +149 -0
  69. data/vendor/v8/include/v8-maybe.h +137 -0
  70. data/vendor/v8/include/v8-memory-span.h +43 -0
  71. data/vendor/v8/include/v8-message.h +216 -0
  72. data/vendor/v8/include/v8-metrics.h +131 -9
  73. data/vendor/v8/include/v8-microtask-queue.h +152 -0
  74. data/vendor/v8/include/v8-microtask.h +28 -0
  75. data/vendor/v8/include/v8-object.h +775 -0
  76. data/vendor/v8/include/v8-persistent-handle.h +590 -0
  77. data/vendor/v8/include/v8-platform.h +433 -25
  78. data/vendor/v8/include/v8-primitive-object.h +118 -0
  79. data/vendor/v8/include/v8-primitive.h +866 -0
  80. data/vendor/v8/include/v8-profiler.h +149 -10
  81. data/vendor/v8/include/v8-promise.h +174 -0
  82. data/vendor/v8/include/v8-proxy.h +50 -0
  83. data/vendor/v8/include/v8-regexp.h +105 -0
  84. data/vendor/v8/include/v8-script.h +747 -0
  85. data/vendor/v8/include/v8-snapshot.h +196 -0
  86. data/vendor/v8/include/v8-statistics.h +217 -0
  87. data/vendor/v8/include/v8-template.h +1079 -0
  88. data/vendor/v8/include/v8-traced-handle.h +420 -0
  89. data/vendor/v8/include/v8-typed-array.h +282 -0
  90. data/vendor/v8/include/v8-unwinder-state.h +31 -0
  91. data/vendor/v8/include/v8-unwinder.h +132 -0
  92. data/vendor/v8/include/v8-util.h +8 -2
  93. data/vendor/v8/include/v8-value-serializer-version.h +1 -1
  94. data/vendor/v8/include/v8-value-serializer.h +279 -0
  95. data/vendor/v8/include/v8-value.h +526 -0
  96. data/vendor/v8/include/v8-version.h +4 -4
  97. data/vendor/v8/include/v8-wasm.h +257 -0
  98. data/vendor/v8/include/v8-weak-callback-info.h +87 -0
  99. data/vendor/v8/include/v8.h +41 -12051
  100. data/vendor/v8/include/v8config.h +142 -21
  101. metadata +64 -10
  102. data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +0 -30
  103. data/vendor/v8/include/cppgc/internal/process-heap.h +0 -34
@@ -0,0 +1,137 @@
1
+ // Copyright 2021 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_V8_MAYBE_H_
6
+ #define INCLUDE_V8_MAYBE_H_
7
+
8
+ #include "v8-internal.h" // NOLINT(build/include_directory)
9
+ #include "v8config.h" // NOLINT(build/include_directory)
10
+
11
+ namespace v8 {
12
+
13
+ namespace api_internal {
14
+ // Called when ToChecked is called on an empty Maybe.
15
+ V8_EXPORT void FromJustIsNothing();
16
+ } // namespace api_internal
17
+
18
+ /**
19
+ * A simple Maybe type, representing an object which may or may not have a
20
+ * value, see https://hackage.haskell.org/package/base/docs/Data-Maybe.html.
21
+ *
22
+ * If an API method returns a Maybe<>, the API method can potentially fail
23
+ * either because an exception is thrown, or because an exception is pending,
24
+ * e.g. because a previous API call threw an exception that hasn't been caught
25
+ * yet, or because a TerminateExecution exception was thrown. In that case, a
26
+ * "Nothing" value is returned.
27
+ */
28
+ template <class T>
29
+ class Maybe {
30
+ public:
31
+ V8_INLINE bool IsNothing() const { return !has_value_; }
32
+ V8_INLINE bool IsJust() const { return has_value_; }
33
+
34
+ /**
35
+ * An alias for |FromJust|. Will crash if the Maybe<> is nothing.
36
+ */
37
+ V8_INLINE T ToChecked() const { return FromJust(); }
38
+
39
+ /**
40
+ * Short-hand for ToChecked(), which doesn't return a value. To be used, where
41
+ * the actual value of the Maybe is not needed like Object::Set.
42
+ */
43
+ V8_INLINE void Check() const {
44
+ if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
45
+ }
46
+
47
+ /**
48
+ * Converts this Maybe<> to a value of type T. If this Maybe<> is
49
+ * nothing (empty), |false| is returned and |out| is left untouched.
50
+ */
51
+ V8_WARN_UNUSED_RESULT V8_INLINE bool To(T* out) const {
52
+ if (V8_LIKELY(IsJust())) *out = value_;
53
+ return IsJust();
54
+ }
55
+
56
+ /**
57
+ * Converts this Maybe<> to a value of type T. If this Maybe<> is
58
+ * nothing (empty), V8 will crash the process.
59
+ */
60
+ V8_INLINE T FromJust() const {
61
+ if (V8_UNLIKELY(!IsJust())) api_internal::FromJustIsNothing();
62
+ return value_;
63
+ }
64
+
65
+ /**
66
+ * Converts this Maybe<> to a value of type T, using a default value if this
67
+ * Maybe<> is nothing (empty).
68
+ */
69
+ V8_INLINE T FromMaybe(const T& default_value) const {
70
+ return has_value_ ? value_ : default_value;
71
+ }
72
+
73
+ V8_INLINE bool operator==(const Maybe& other) const {
74
+ return (IsJust() == other.IsJust()) &&
75
+ (!IsJust() || FromJust() == other.FromJust());
76
+ }
77
+
78
+ V8_INLINE bool operator!=(const Maybe& other) const {
79
+ return !operator==(other);
80
+ }
81
+
82
+ private:
83
+ Maybe() : has_value_(false) {}
84
+ explicit Maybe(const T& t) : has_value_(true), value_(t) {}
85
+
86
+ bool has_value_;
87
+ T value_;
88
+
89
+ template <class U>
90
+ friend Maybe<U> Nothing();
91
+ template <class U>
92
+ friend Maybe<U> Just(const U& u);
93
+ };
94
+
95
+ template <class T>
96
+ inline Maybe<T> Nothing() {
97
+ return Maybe<T>();
98
+ }
99
+
100
+ template <class T>
101
+ inline Maybe<T> Just(const T& t) {
102
+ return Maybe<T>(t);
103
+ }
104
+
105
+ // A template specialization of Maybe<T> for the case of T = void.
106
+ template <>
107
+ class Maybe<void> {
108
+ public:
109
+ V8_INLINE bool IsNothing() const { return !is_valid_; }
110
+ V8_INLINE bool IsJust() const { return is_valid_; }
111
+
112
+ V8_INLINE bool operator==(const Maybe& other) const {
113
+ return IsJust() == other.IsJust();
114
+ }
115
+
116
+ V8_INLINE bool operator!=(const Maybe& other) const {
117
+ return !operator==(other);
118
+ }
119
+
120
+ private:
121
+ struct JustTag {};
122
+
123
+ Maybe() : is_valid_(false) {}
124
+ explicit Maybe(JustTag) : is_valid_(true) {}
125
+
126
+ bool is_valid_;
127
+
128
+ template <class U>
129
+ friend Maybe<U> Nothing();
130
+ friend Maybe<void> JustVoid();
131
+ };
132
+
133
+ inline Maybe<void> JustVoid() { return Maybe<void>(Maybe<void>::JustTag()); }
134
+
135
+ } // namespace v8
136
+
137
+ #endif // INCLUDE_V8_MAYBE_H_
@@ -0,0 +1,43 @@
1
+ // Copyright 2021 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_V8_MEMORY_SPAN_H_
6
+ #define INCLUDE_V8_MEMORY_SPAN_H_
7
+
8
+ #include <stddef.h>
9
+
10
+ #include "v8config.h" // NOLINT(build/include_directory)
11
+
12
+ namespace v8 {
13
+
14
+ /**
15
+ * Points to an unowned continous buffer holding a known number of elements.
16
+ *
17
+ * This is similar to std::span (under consideration for C++20), but does not
18
+ * require advanced C++ support. In the (far) future, this may be replaced with
19
+ * or aliased to std::span.
20
+ *
21
+ * To facilitate future migration, this class exposes a subset of the interface
22
+ * implemented by std::span.
23
+ */
24
+ template <typename T>
25
+ class V8_EXPORT MemorySpan {
26
+ public:
27
+ /** The default constructor creates an empty span. */
28
+ constexpr MemorySpan() = default;
29
+
30
+ constexpr MemorySpan(T* data, size_t size) : data_(data), size_(size) {}
31
+
32
+ /** Returns a pointer to the beginning of the buffer. */
33
+ constexpr T* data() const { return data_; }
34
+ /** Returns the number of elements that the buffer holds. */
35
+ constexpr size_t size() const { return size_; }
36
+
37
+ private:
38
+ T* data_ = nullptr;
39
+ size_t size_ = 0;
40
+ };
41
+
42
+ } // namespace v8
43
+ #endif // INCLUDE_V8_MEMORY_SPAN_H_
@@ -0,0 +1,216 @@
1
+ // Copyright 2021 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_V8_MESSAGE_H_
6
+ #define INCLUDE_V8_MESSAGE_H_
7
+
8
+ #include <stdio.h>
9
+
10
+ #include <iosfwd>
11
+
12
+ #include "v8-local-handle.h" // NOLINT(build/include_directory)
13
+ #include "v8-maybe.h" // NOLINT(build/include_directory)
14
+ #include "v8-primitive.h" // NOLINT(build/include_directory)
15
+ #include "v8config.h" // NOLINT(build/include_directory)
16
+
17
+ namespace v8 {
18
+
19
+ class Integer;
20
+ class PrimitiveArray;
21
+ class StackTrace;
22
+ class String;
23
+ class Value;
24
+
25
+ /**
26
+ * The optional attributes of ScriptOrigin.
27
+ */
28
+ class ScriptOriginOptions {
29
+ public:
30
+ V8_INLINE ScriptOriginOptions(bool is_shared_cross_origin = false,
31
+ bool is_opaque = false, bool is_wasm = false,
32
+ bool is_module = false)
33
+ : flags_((is_shared_cross_origin ? kIsSharedCrossOrigin : 0) |
34
+ (is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0) |
35
+ (is_module ? kIsModule : 0)) {}
36
+ V8_INLINE ScriptOriginOptions(int flags)
37
+ : flags_(flags &
38
+ (kIsSharedCrossOrigin | kIsOpaque | kIsWasm | kIsModule)) {}
39
+
40
+ bool IsSharedCrossOrigin() const {
41
+ return (flags_ & kIsSharedCrossOrigin) != 0;
42
+ }
43
+ bool IsOpaque() const { return (flags_ & kIsOpaque) != 0; }
44
+ bool IsWasm() const { return (flags_ & kIsWasm) != 0; }
45
+ bool IsModule() const { return (flags_ & kIsModule) != 0; }
46
+
47
+ int Flags() const { return flags_; }
48
+
49
+ private:
50
+ enum {
51
+ kIsSharedCrossOrigin = 1,
52
+ kIsOpaque = 1 << 1,
53
+ kIsWasm = 1 << 2,
54
+ kIsModule = 1 << 3
55
+ };
56
+ const int flags_;
57
+ };
58
+
59
+ /**
60
+ * The origin, within a file, of a script.
61
+ */
62
+ class V8_EXPORT ScriptOrigin {
63
+ public:
64
+ V8_INLINE ScriptOrigin(Isolate* isolate, Local<Value> resource_name,
65
+ int resource_line_offset = 0,
66
+ int resource_column_offset = 0,
67
+ bool resource_is_shared_cross_origin = false,
68
+ int script_id = -1,
69
+ Local<Value> source_map_url = Local<Value>(),
70
+ bool resource_is_opaque = false, bool is_wasm = false,
71
+ bool is_module = false,
72
+ Local<Data> host_defined_options = Local<Data>())
73
+ : isolate_(isolate),
74
+ resource_name_(resource_name),
75
+ resource_line_offset_(resource_line_offset),
76
+ resource_column_offset_(resource_column_offset),
77
+ options_(resource_is_shared_cross_origin, resource_is_opaque, is_wasm,
78
+ is_module),
79
+ script_id_(script_id),
80
+ source_map_url_(source_map_url),
81
+ host_defined_options_(host_defined_options) {
82
+ VerifyHostDefinedOptions();
83
+ }
84
+
85
+ V8_INLINE Local<Value> ResourceName() const;
86
+ V8_INLINE int LineOffset() const;
87
+ V8_INLINE int ColumnOffset() const;
88
+ V8_INLINE int ScriptId() const;
89
+ V8_INLINE Local<Value> SourceMapUrl() const;
90
+ V8_DEPRECATE_SOON("Use GetHostDefinedOptions")
91
+ Local<PrimitiveArray> HostDefinedOptions() const;
92
+ V8_INLINE Local<Data> GetHostDefinedOptions() const;
93
+ V8_INLINE ScriptOriginOptions Options() const { return options_; }
94
+
95
+ private:
96
+ void VerifyHostDefinedOptions() const;
97
+ Isolate* isolate_;
98
+ Local<Value> resource_name_;
99
+ int resource_line_offset_;
100
+ int resource_column_offset_;
101
+ ScriptOriginOptions options_;
102
+ int script_id_;
103
+ Local<Value> source_map_url_;
104
+ Local<Data> host_defined_options_;
105
+ };
106
+
107
+ /**
108
+ * An error message.
109
+ */
110
+ class V8_EXPORT Message {
111
+ public:
112
+ Local<String> Get() const;
113
+
114
+ /**
115
+ * Return the isolate to which the Message belongs.
116
+ */
117
+ Isolate* GetIsolate() const;
118
+
119
+ V8_WARN_UNUSED_RESULT MaybeLocal<String> GetSource(
120
+ Local<Context> context) const;
121
+ V8_WARN_UNUSED_RESULT MaybeLocal<String> GetSourceLine(
122
+ Local<Context> context) const;
123
+
124
+ /**
125
+ * Returns the origin for the script from where the function causing the
126
+ * error originates.
127
+ */
128
+ ScriptOrigin GetScriptOrigin() const;
129
+
130
+ /**
131
+ * Returns the resource name for the script from where the function causing
132
+ * the error originates.
133
+ */
134
+ Local<Value> GetScriptResourceName() const;
135
+
136
+ /**
137
+ * Exception stack trace. By default stack traces are not captured for
138
+ * uncaught exceptions. SetCaptureStackTraceForUncaughtExceptions allows
139
+ * to change this option.
140
+ */
141
+ Local<StackTrace> GetStackTrace() const;
142
+
143
+ /**
144
+ * Returns the number, 1-based, of the line where the error occurred.
145
+ */
146
+ V8_WARN_UNUSED_RESULT Maybe<int> GetLineNumber(Local<Context> context) const;
147
+
148
+ /**
149
+ * Returns the index within the script of the first character where
150
+ * the error occurred.
151
+ */
152
+ int GetStartPosition() const;
153
+
154
+ /**
155
+ * Returns the index within the script of the last character where
156
+ * the error occurred.
157
+ */
158
+ int GetEndPosition() const;
159
+
160
+ /**
161
+ * Returns the Wasm function index where the error occurred. Returns -1 if
162
+ * message is not from a Wasm script.
163
+ */
164
+ int GetWasmFunctionIndex() const;
165
+
166
+ /**
167
+ * Returns the error level of the message.
168
+ */
169
+ int ErrorLevel() const;
170
+
171
+ /**
172
+ * Returns the index within the line of the first character where
173
+ * the error occurred.
174
+ */
175
+ int GetStartColumn() const;
176
+ V8_WARN_UNUSED_RESULT Maybe<int> GetStartColumn(Local<Context> context) const;
177
+
178
+ /**
179
+ * Returns the index within the line of the last character where
180
+ * the error occurred.
181
+ */
182
+ int GetEndColumn() const;
183
+ V8_WARN_UNUSED_RESULT Maybe<int> GetEndColumn(Local<Context> context) const;
184
+
185
+ /**
186
+ * Passes on the value set by the embedder when it fed the script from which
187
+ * this Message was generated to V8.
188
+ */
189
+ bool IsSharedCrossOrigin() const;
190
+ bool IsOpaque() const;
191
+
192
+ static void PrintCurrentStackTrace(Isolate* isolate, std::ostream& out);
193
+
194
+ static const int kNoLineNumberInfo = 0;
195
+ static const int kNoColumnInfo = 0;
196
+ static const int kNoScriptIdInfo = 0;
197
+ static const int kNoWasmFunctionIndexInfo = -1;
198
+ };
199
+
200
+ Local<Value> ScriptOrigin::ResourceName() const { return resource_name_; }
201
+
202
+ Local<Data> ScriptOrigin::GetHostDefinedOptions() const {
203
+ return host_defined_options_;
204
+ }
205
+
206
+ int ScriptOrigin::LineOffset() const { return resource_line_offset_; }
207
+
208
+ int ScriptOrigin::ColumnOffset() const { return resource_column_offset_; }
209
+
210
+ int ScriptOrigin::ScriptId() const { return script_id_; }
211
+
212
+ Local<Value> ScriptOrigin::SourceMapUrl() const { return source_map_url_; }
213
+
214
+ } // namespace v8
215
+
216
+ #endif // INCLUDE_V8_MESSAGE_H_
@@ -5,18 +5,104 @@
5
5
  #ifndef V8_METRICS_H_
6
6
  #define V8_METRICS_H_
7
7
 
8
- #include "v8.h" // NOLINT(build/include_directory)
8
+ #include <stddef.h>
9
+ #include <stdint.h>
10
+
11
+ #include <vector>
12
+
13
+ #include "v8-internal.h" // NOLINT(build/include_directory)
14
+ #include "v8-local-handle.h" // NOLINT(build/include_directory)
9
15
 
10
16
  namespace v8 {
17
+
18
+ class Context;
19
+ class Isolate;
20
+
11
21
  namespace metrics {
12
22
 
23
+ struct GarbageCollectionPhases {
24
+ int64_t total_wall_clock_duration_in_us = -1;
25
+ int64_t compact_wall_clock_duration_in_us = -1;
26
+ int64_t mark_wall_clock_duration_in_us = -1;
27
+ int64_t sweep_wall_clock_duration_in_us = -1;
28
+ int64_t weak_wall_clock_duration_in_us = -1;
29
+ };
30
+
31
+ struct GarbageCollectionSizes {
32
+ int64_t bytes_before = -1;
33
+ int64_t bytes_after = -1;
34
+ int64_t bytes_freed = -1;
35
+ };
36
+
37
+ struct GarbageCollectionFullCycle {
38
+ int reason = -1;
39
+ GarbageCollectionPhases total;
40
+ GarbageCollectionPhases total_cpp;
41
+ GarbageCollectionPhases main_thread;
42
+ GarbageCollectionPhases main_thread_cpp;
43
+ GarbageCollectionPhases main_thread_atomic;
44
+ GarbageCollectionPhases main_thread_atomic_cpp;
45
+ GarbageCollectionPhases main_thread_incremental;
46
+ GarbageCollectionPhases main_thread_incremental_cpp;
47
+ GarbageCollectionSizes objects;
48
+ GarbageCollectionSizes objects_cpp;
49
+ GarbageCollectionSizes memory;
50
+ GarbageCollectionSizes memory_cpp;
51
+ double collection_rate_in_percent = -1.0;
52
+ double collection_rate_cpp_in_percent = -1.0;
53
+ double efficiency_in_bytes_per_us = -1.0;
54
+ double efficiency_cpp_in_bytes_per_us = -1.0;
55
+ double main_thread_efficiency_in_bytes_per_us = -1.0;
56
+ double main_thread_efficiency_cpp_in_bytes_per_us = -1.0;
57
+ };
58
+
59
+ struct GarbageCollectionFullMainThreadIncrementalMark {
60
+ int64_t wall_clock_duration_in_us = -1;
61
+ int64_t cpp_wall_clock_duration_in_us = -1;
62
+ };
63
+
64
+ struct GarbageCollectionFullMainThreadIncrementalSweep {
65
+ int64_t wall_clock_duration_in_us = -1;
66
+ int64_t cpp_wall_clock_duration_in_us = -1;
67
+ };
68
+
69
+ template <typename EventType>
70
+ struct GarbageCollectionBatchedEvents {
71
+ std::vector<EventType> events;
72
+ };
73
+
74
+ using GarbageCollectionFullMainThreadBatchedIncrementalMark =
75
+ GarbageCollectionBatchedEvents<
76
+ GarbageCollectionFullMainThreadIncrementalMark>;
77
+ using GarbageCollectionFullMainThreadBatchedIncrementalSweep =
78
+ GarbageCollectionBatchedEvents<
79
+ GarbageCollectionFullMainThreadIncrementalSweep>;
80
+
81
+ struct GarbageCollectionYoungCycle {
82
+ int reason = -1;
83
+ int64_t total_wall_clock_duration_in_us = -1;
84
+ int64_t main_thread_wall_clock_duration_in_us = -1;
85
+ double collection_rate_in_percent = -1.0;
86
+ double efficiency_in_bytes_per_us = -1.0;
87
+ double main_thread_efficiency_in_bytes_per_us = -1.0;
88
+ #if defined(CPPGC_YOUNG_GENERATION)
89
+ GarbageCollectionPhases total_cpp;
90
+ GarbageCollectionSizes objects_cpp;
91
+ GarbageCollectionSizes memory_cpp;
92
+ double collection_rate_cpp_in_percent = -1.0;
93
+ double efficiency_cpp_in_bytes_per_us = -1.0;
94
+ double main_thread_efficiency_cpp_in_bytes_per_us = -1.0;
95
+ #endif // defined(CPPGC_YOUNG_GENERATION)
96
+ };
97
+
13
98
  struct WasmModuleDecoded {
14
99
  bool async = false;
15
100
  bool streamed = false;
16
101
  bool success = false;
17
102
  size_t module_size_in_bytes = 0;
18
103
  size_t function_count = 0;
19
- int64_t wall_clock_time_in_us = 0;
104
+ int64_t wall_clock_duration_in_us = -1;
105
+ int64_t cpu_duration_in_us = -1;
20
106
  };
21
107
 
22
108
  struct WasmModuleCompiled {
@@ -28,30 +114,38 @@ struct WasmModuleCompiled {
28
114
  bool success = false;
29
115
  size_t code_size_in_bytes = 0;
30
116
  size_t liftoff_bailout_count = 0;
31
- int64_t wall_clock_time_in_us = 0;
117
+ int64_t wall_clock_duration_in_us = -1;
118
+ int64_t cpu_duration_in_us = -1;
32
119
  };
33
120
 
34
121
  struct WasmModuleInstantiated {
35
122
  bool async = false;
36
123
  bool success = false;
37
124
  size_t imported_function_count = 0;
38
- int64_t wall_clock_time_in_us = 0;
125
+ int64_t wall_clock_duration_in_us = -1;
39
126
  };
40
127
 
41
128
  struct WasmModuleTieredUp {
42
129
  bool lazy = false;
43
130
  size_t code_size_in_bytes = 0;
44
- int64_t wall_clock_time_in_us = 0;
131
+ int64_t wall_clock_duration_in_us = -1;
132
+ int64_t cpu_duration_in_us = -1;
45
133
  };
46
134
 
47
135
  struct WasmModulesPerIsolate {
48
136
  size_t count = 0;
49
137
  };
50
138
 
51
- #define V8_MAIN_THREAD_METRICS_EVENTS(V) \
52
- V(WasmModuleDecoded) \
53
- V(WasmModuleCompiled) \
54
- V(WasmModuleInstantiated) \
139
+ #define V8_MAIN_THREAD_METRICS_EVENTS(V) \
140
+ V(GarbageCollectionFullCycle) \
141
+ V(GarbageCollectionFullMainThreadIncrementalMark) \
142
+ V(GarbageCollectionFullMainThreadBatchedIncrementalMark) \
143
+ V(GarbageCollectionFullMainThreadIncrementalSweep) \
144
+ V(GarbageCollectionFullMainThreadBatchedIncrementalSweep) \
145
+ V(GarbageCollectionYoungCycle) \
146
+ V(WasmModuleDecoded) \
147
+ V(WasmModuleCompiled) \
148
+ V(WasmModuleInstantiated) \
55
149
  V(WasmModuleTieredUp)
56
150
 
57
151
  #define V8_THREAD_SAFE_METRICS_EVENTS(V) V(WasmModulesPerIsolate)
@@ -127,6 +221,34 @@ class V8_EXPORT Recorder {
127
221
  static ContextId GetContextId(Local<Context> context);
128
222
  };
129
223
 
224
+ /**
225
+ * Experimental API intended for the LongTasks UKM (crbug.com/1173527).
226
+ * The Reset() method should be called at the start of a potential
227
+ * long task. The Get() method returns durations of V8 work that
228
+ * happened during the task.
229
+ *
230
+ * This API is experimental and may be removed/changed in the future.
231
+ */
232
+ struct V8_EXPORT LongTaskStats {
233
+ /**
234
+ * Resets durations of V8 work for the new task.
235
+ */
236
+ V8_INLINE static void Reset(Isolate* isolate) {
237
+ v8::internal::Internals::IncrementLongTasksStatsCounter(isolate);
238
+ }
239
+
240
+ /**
241
+ * Returns durations of V8 work that happened since the last Reset().
242
+ */
243
+ static LongTaskStats Get(Isolate* isolate);
244
+
245
+ int64_t gc_full_atomic_wall_clock_duration_us = 0;
246
+ int64_t gc_full_incremental_wall_clock_duration_us = 0;
247
+ int64_t gc_young_wall_clock_duration_us = 0;
248
+ // Only collected with --slow-histograms
249
+ int64_t v8_execute_us = 0;
250
+ };
251
+
130
252
  } // namespace metrics
131
253
  } // namespace v8
132
254