libv8-node 15.5.1.0.beta1-x86_64-darwin-21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/ext/libv8-node/.location.yml +2 -0
  3. data/ext/libv8-node/location.rb +91 -0
  4. data/ext/libv8-node/paths.rb +30 -0
  5. data/lib/libv8/node/version.rb +7 -0
  6. data/lib/libv8/node.rb +11 -0
  7. data/lib/libv8-node.rb +1 -0
  8. data/vendor/v8/include/cppgc/allocation.h +173 -0
  9. data/vendor/v8/include/cppgc/common.h +26 -0
  10. data/vendor/v8/include/cppgc/custom-space.h +62 -0
  11. data/vendor/v8/include/cppgc/default-platform.h +76 -0
  12. data/vendor/v8/include/cppgc/garbage-collected.h +116 -0
  13. data/vendor/v8/include/cppgc/heap.h +139 -0
  14. data/vendor/v8/include/cppgc/internal/api-constants.h +47 -0
  15. data/vendor/v8/include/cppgc/internal/atomic-entry-flag.h +48 -0
  16. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +67 -0
  17. data/vendor/v8/include/cppgc/internal/compiler-specific.h +38 -0
  18. data/vendor/v8/include/cppgc/internal/finalizer-trait.h +90 -0
  19. data/vendor/v8/include/cppgc/internal/gc-info.h +45 -0
  20. data/vendor/v8/include/cppgc/internal/logging.h +50 -0
  21. data/vendor/v8/include/cppgc/internal/persistent-node.h +116 -0
  22. data/vendor/v8/include/cppgc/internal/pointer-policies.h +134 -0
  23. data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +30 -0
  24. data/vendor/v8/include/cppgc/internal/process-heap.h +34 -0
  25. data/vendor/v8/include/cppgc/internal/write-barrier.h +78 -0
  26. data/vendor/v8/include/cppgc/liveness-broker.h +68 -0
  27. data/vendor/v8/include/cppgc/macros.h +24 -0
  28. data/vendor/v8/include/cppgc/member.h +226 -0
  29. data/vendor/v8/include/cppgc/persistent.h +341 -0
  30. data/vendor/v8/include/cppgc/platform.h +130 -0
  31. data/vendor/v8/include/cppgc/prefinalizer.h +52 -0
  32. data/vendor/v8/include/cppgc/source-location.h +91 -0
  33. data/vendor/v8/include/cppgc/trace-trait.h +111 -0
  34. data/vendor/v8/include/cppgc/type-traits.h +109 -0
  35. data/vendor/v8/include/cppgc/visitor.h +213 -0
  36. data/vendor/v8/include/libplatform/libplatform-export.h +29 -0
  37. data/vendor/v8/include/libplatform/libplatform.h +106 -0
  38. data/vendor/v8/include/libplatform/v8-tracing.h +332 -0
  39. data/vendor/v8/include/v8-cppgc.h +226 -0
  40. data/vendor/v8/include/v8-fast-api-calls.h +388 -0
  41. data/vendor/v8/include/v8-inspector-protocol.h +13 -0
  42. data/vendor/v8/include/v8-inspector.h +327 -0
  43. data/vendor/v8/include/v8-internal.h +427 -0
  44. data/vendor/v8/include/v8-metrics.h +133 -0
  45. data/vendor/v8/include/v8-platform.h +684 -0
  46. data/vendor/v8/include/v8-profiler.h +1059 -0
  47. data/vendor/v8/include/v8-util.h +652 -0
  48. data/vendor/v8/include/v8-value-serializer-version.h +24 -0
  49. data/vendor/v8/include/v8-version-string.h +38 -0
  50. data/vendor/v8/include/v8-version.h +20 -0
  51. data/vendor/v8/include/v8-wasm-trap-handler-posix.h +31 -0
  52. data/vendor/v8/include/v8-wasm-trap-handler-win.h +28 -0
  53. data/vendor/v8/include/v8.h +12098 -0
  54. data/vendor/v8/include/v8config.h +484 -0
  55. data/vendor/v8/out.gn/libv8/obj/libv8_monolith.a +0 -0
  56. metadata +112 -0
@@ -0,0 +1,327 @@
1
+ // Copyright 2016 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 V8_V8_INSPECTOR_H_
6
+ #define V8_V8_INSPECTOR_H_
7
+
8
+ #include <stdint.h>
9
+ #include <cctype>
10
+
11
+ #include <memory>
12
+ #include <unordered_map>
13
+
14
+ #include "v8.h" // NOLINT(build/include_directory)
15
+
16
+ namespace v8_inspector {
17
+
18
+ namespace protocol {
19
+ namespace Debugger {
20
+ namespace API {
21
+ class SearchMatch;
22
+ }
23
+ }
24
+ namespace Runtime {
25
+ namespace API {
26
+ class RemoteObject;
27
+ class StackTrace;
28
+ class StackTraceId;
29
+ }
30
+ }
31
+ namespace Schema {
32
+ namespace API {
33
+ class Domain;
34
+ }
35
+ }
36
+ } // namespace protocol
37
+
38
+ class V8_EXPORT StringView {
39
+ public:
40
+ StringView() : m_is8Bit(true), m_length(0), m_characters8(nullptr) {}
41
+
42
+ StringView(const uint8_t* characters, size_t length)
43
+ : m_is8Bit(true), m_length(length), m_characters8(characters) {}
44
+
45
+ StringView(const uint16_t* characters, size_t length)
46
+ : m_is8Bit(false), m_length(length), m_characters16(characters) {}
47
+
48
+ bool is8Bit() const { return m_is8Bit; }
49
+ size_t length() const { return m_length; }
50
+
51
+ // TODO(dgozman): add DCHECK(m_is8Bit) to accessors once platform can be used
52
+ // here.
53
+ const uint8_t* characters8() const { return m_characters8; }
54
+ const uint16_t* characters16() const { return m_characters16; }
55
+
56
+ private:
57
+ bool m_is8Bit;
58
+ size_t m_length;
59
+ union {
60
+ const uint8_t* m_characters8;
61
+ const uint16_t* m_characters16;
62
+ };
63
+ };
64
+
65
+ class V8_EXPORT StringBuffer {
66
+ public:
67
+ virtual ~StringBuffer() = default;
68
+ virtual StringView string() const = 0;
69
+ // This method copies contents.
70
+ static std::unique_ptr<StringBuffer> create(StringView);
71
+ };
72
+
73
+ class V8_EXPORT V8ContextInfo {
74
+ public:
75
+ V8ContextInfo(v8::Local<v8::Context> context, int contextGroupId,
76
+ StringView humanReadableName)
77
+ : context(context),
78
+ contextGroupId(contextGroupId),
79
+ humanReadableName(humanReadableName),
80
+ hasMemoryOnConsole(false) {}
81
+
82
+ v8::Local<v8::Context> context;
83
+ // Each v8::Context is a part of a group. The group id must be non-zero.
84
+ int contextGroupId;
85
+ StringView humanReadableName;
86
+ StringView origin;
87
+ StringView auxData;
88
+ bool hasMemoryOnConsole;
89
+
90
+ static int executionContextId(v8::Local<v8::Context> context);
91
+
92
+ // Disallow copying and allocating this one.
93
+ enum NotNullTagEnum { NotNullLiteral };
94
+ void* operator new(size_t) = delete;
95
+ void* operator new(size_t, NotNullTagEnum, void*) = delete;
96
+ void* operator new(size_t, void*) = delete;
97
+ V8ContextInfo(const V8ContextInfo&) = delete;
98
+ V8ContextInfo& operator=(const V8ContextInfo&) = delete;
99
+ };
100
+
101
+ class V8_EXPORT V8StackTrace {
102
+ public:
103
+ virtual StringView firstNonEmptySourceURL() const = 0;
104
+ virtual bool isEmpty() const = 0;
105
+ virtual StringView topSourceURL() const = 0;
106
+ virtual int topLineNumber() const = 0;
107
+ virtual int topColumnNumber() const = 0;
108
+ virtual StringView topScriptId() const = 0;
109
+ virtual StringView topFunctionName() const = 0;
110
+
111
+ virtual ~V8StackTrace() = default;
112
+ virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
113
+ buildInspectorObject() const = 0;
114
+ virtual std::unique_ptr<protocol::Runtime::API::StackTrace>
115
+ buildInspectorObject(int maxAsyncDepth) const = 0;
116
+ virtual std::unique_ptr<StringBuffer> toString() const = 0;
117
+
118
+ // Safe to pass between threads, drops async chain.
119
+ virtual std::unique_ptr<V8StackTrace> clone() = 0;
120
+ };
121
+
122
+ class V8_EXPORT V8InspectorSession {
123
+ public:
124
+ virtual ~V8InspectorSession() = default;
125
+
126
+ // Cross-context inspectable values (DOM nodes in different worlds, etc.).
127
+ class V8_EXPORT Inspectable {
128
+ public:
129
+ virtual v8::Local<v8::Value> get(v8::Local<v8::Context>) = 0;
130
+ virtual ~Inspectable() = default;
131
+ };
132
+ virtual void addInspectedObject(std::unique_ptr<Inspectable>) = 0;
133
+
134
+ // Dispatching protocol messages.
135
+ static bool canDispatchMethod(StringView method);
136
+ virtual void dispatchProtocolMessage(StringView message) = 0;
137
+ virtual std::vector<uint8_t> state() = 0;
138
+ virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
139
+ supportedDomains() = 0;
140
+
141
+ // Debugger actions.
142
+ virtual void schedulePauseOnNextStatement(StringView breakReason,
143
+ StringView breakDetails) = 0;
144
+ virtual void cancelPauseOnNextStatement() = 0;
145
+ virtual void breakProgram(StringView breakReason,
146
+ StringView breakDetails) = 0;
147
+ virtual void setSkipAllPauses(bool) = 0;
148
+ virtual void resume(bool setTerminateOnResume = false) = 0;
149
+ virtual void stepOver() = 0;
150
+ virtual std::vector<std::unique_ptr<protocol::Debugger::API::SearchMatch>>
151
+ searchInTextByLines(StringView text, StringView query, bool caseSensitive,
152
+ bool isRegex) = 0;
153
+
154
+ // Remote objects.
155
+ virtual std::unique_ptr<protocol::Runtime::API::RemoteObject> wrapObject(
156
+ v8::Local<v8::Context>, v8::Local<v8::Value>, StringView groupName,
157
+ bool generatePreview) = 0;
158
+
159
+ virtual bool unwrapObject(std::unique_ptr<StringBuffer>* error,
160
+ StringView objectId, v8::Local<v8::Value>*,
161
+ v8::Local<v8::Context>*,
162
+ std::unique_ptr<StringBuffer>* objectGroup) = 0;
163
+ virtual void releaseObjectGroup(StringView) = 0;
164
+ virtual void triggerPreciseCoverageDeltaUpdate(StringView occassion) = 0;
165
+ };
166
+
167
+ class V8_EXPORT V8InspectorClient {
168
+ public:
169
+ virtual ~V8InspectorClient() = default;
170
+
171
+ virtual void runMessageLoopOnPause(int contextGroupId) {}
172
+ virtual void quitMessageLoopOnPause() {}
173
+ virtual void runIfWaitingForDebugger(int contextGroupId) {}
174
+
175
+ virtual void muteMetrics(int contextGroupId) {}
176
+ virtual void unmuteMetrics(int contextGroupId) {}
177
+
178
+ virtual void beginUserGesture() {}
179
+ virtual void endUserGesture() {}
180
+
181
+ virtual std::unique_ptr<StringBuffer> valueSubtype(v8::Local<v8::Value>) {
182
+ return nullptr;
183
+ }
184
+ virtual bool formatAccessorsAsProperties(v8::Local<v8::Value>) {
185
+ return false;
186
+ }
187
+ virtual bool isInspectableHeapObject(v8::Local<v8::Object>) { return true; }
188
+
189
+ virtual v8::Local<v8::Context> ensureDefaultContextInGroup(
190
+ int contextGroupId) {
191
+ return v8::Local<v8::Context>();
192
+ }
193
+ virtual void beginEnsureAllContextsInGroup(int contextGroupId) {}
194
+ virtual void endEnsureAllContextsInGroup(int contextGroupId) {}
195
+
196
+ virtual void installAdditionalCommandLineAPI(v8::Local<v8::Context>,
197
+ v8::Local<v8::Object>) {}
198
+ virtual void consoleAPIMessage(int contextGroupId,
199
+ v8::Isolate::MessageErrorLevel level,
200
+ const StringView& message,
201
+ const StringView& url, unsigned lineNumber,
202
+ unsigned columnNumber, V8StackTrace*) {}
203
+ virtual v8::MaybeLocal<v8::Value> memoryInfo(v8::Isolate*,
204
+ v8::Local<v8::Context>) {
205
+ return v8::MaybeLocal<v8::Value>();
206
+ }
207
+
208
+ virtual void consoleTime(const StringView& title) {}
209
+ virtual void consoleTimeEnd(const StringView& title) {}
210
+ virtual void consoleTimeStamp(const StringView& title) {}
211
+ virtual void consoleClear(int contextGroupId) {}
212
+ virtual double currentTimeMS() { return 0; }
213
+ typedef void (*TimerCallback)(void*);
214
+ virtual void startRepeatingTimer(double, TimerCallback, void* data) {}
215
+ virtual void cancelTimer(void* data) {}
216
+
217
+ // TODO(dgozman): this was added to support service worker shadow page. We
218
+ // should not connect at all.
219
+ virtual bool canExecuteScripts(int contextGroupId) { return true; }
220
+
221
+ virtual void maxAsyncCallStackDepthChanged(int depth) {}
222
+
223
+ virtual std::unique_ptr<StringBuffer> resourceNameToUrl(
224
+ const StringView& resourceName) {
225
+ return nullptr;
226
+ }
227
+ };
228
+
229
+ // These stack trace ids are intended to be passed between debuggers and be
230
+ // resolved later. This allows to track cross-debugger calls and step between
231
+ // them if a single client connects to multiple debuggers.
232
+ struct V8_EXPORT V8StackTraceId {
233
+ uintptr_t id;
234
+ std::pair<int64_t, int64_t> debugger_id;
235
+ bool should_pause = false;
236
+
237
+ V8StackTraceId();
238
+ V8StackTraceId(const V8StackTraceId&) = default;
239
+ V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id);
240
+ V8StackTraceId(uintptr_t id, const std::pair<int64_t, int64_t> debugger_id,
241
+ bool should_pause);
242
+ explicit V8StackTraceId(StringView);
243
+ V8StackTraceId& operator=(const V8StackTraceId&) = default;
244
+ V8StackTraceId& operator=(V8StackTraceId&&) noexcept = default;
245
+ ~V8StackTraceId() = default;
246
+
247
+ bool IsInvalid() const;
248
+ std::unique_ptr<StringBuffer> ToString();
249
+ };
250
+
251
+ class V8_EXPORT V8Inspector {
252
+ public:
253
+ static std::unique_ptr<V8Inspector> create(v8::Isolate*, V8InspectorClient*);
254
+ virtual ~V8Inspector() = default;
255
+
256
+ // Contexts instrumentation.
257
+ virtual void contextCreated(const V8ContextInfo&) = 0;
258
+ virtual void contextDestroyed(v8::Local<v8::Context>) = 0;
259
+ virtual void resetContextGroup(int contextGroupId) = 0;
260
+ virtual v8::MaybeLocal<v8::Context> contextById(int contextId) = 0;
261
+
262
+ // Various instrumentation.
263
+ virtual void idleStarted() = 0;
264
+ virtual void idleFinished() = 0;
265
+
266
+ // Async stack traces instrumentation.
267
+ virtual void asyncTaskScheduled(StringView taskName, void* task,
268
+ bool recurring) = 0;
269
+ virtual void asyncTaskCanceled(void* task) = 0;
270
+ virtual void asyncTaskStarted(void* task) = 0;
271
+ virtual void asyncTaskFinished(void* task) = 0;
272
+ virtual void allAsyncTasksCanceled() = 0;
273
+
274
+ virtual V8StackTraceId storeCurrentStackTrace(StringView description) = 0;
275
+ virtual void externalAsyncTaskStarted(const V8StackTraceId& parent) = 0;
276
+ virtual void externalAsyncTaskFinished(const V8StackTraceId& parent) = 0;
277
+
278
+ // Exceptions instrumentation.
279
+ virtual unsigned exceptionThrown(v8::Local<v8::Context>, StringView message,
280
+ v8::Local<v8::Value> exception,
281
+ StringView detailedMessage, StringView url,
282
+ unsigned lineNumber, unsigned columnNumber,
283
+ std::unique_ptr<V8StackTrace>,
284
+ int scriptId) = 0;
285
+ virtual void exceptionRevoked(v8::Local<v8::Context>, unsigned exceptionId,
286
+ StringView message) = 0;
287
+
288
+ // Connection.
289
+ class V8_EXPORT Channel {
290
+ public:
291
+ virtual ~Channel() = default;
292
+ virtual void sendResponse(int callId,
293
+ std::unique_ptr<StringBuffer> message) = 0;
294
+ virtual void sendNotification(std::unique_ptr<StringBuffer> message) = 0;
295
+ virtual void flushProtocolNotifications() = 0;
296
+ };
297
+ virtual std::unique_ptr<V8InspectorSession> connect(int contextGroupId,
298
+ Channel*,
299
+ StringView state) = 0;
300
+
301
+ // API methods.
302
+ virtual std::unique_ptr<V8StackTrace> createStackTrace(
303
+ v8::Local<v8::StackTrace>) = 0;
304
+ virtual std::unique_ptr<V8StackTrace> captureStackTrace(bool fullStack) = 0;
305
+
306
+ // Performance counters.
307
+ class V8_EXPORT Counters : public std::enable_shared_from_this<Counters> {
308
+ public:
309
+ explicit Counters(v8::Isolate* isolate);
310
+ ~Counters();
311
+ const std::unordered_map<std::string, int>& getCountersMap() const {
312
+ return m_countersMap;
313
+ }
314
+
315
+ private:
316
+ static int* getCounterPtr(const char* name);
317
+
318
+ v8::Isolate* m_isolate;
319
+ std::unordered_map<std::string, int> m_countersMap;
320
+ };
321
+
322
+ virtual std::shared_ptr<Counters> enableCounters() = 0;
323
+ };
324
+
325
+ } // namespace v8_inspector
326
+
327
+ #endif // V8_V8_INSPECTOR_H_