libv8-node 15.14.0.1-x86_64-linux → 17.9.1.0-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) 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/include/cppgc/allocation.h +110 -44
  6. data/vendor/v8/include/cppgc/common.h +9 -6
  7. data/vendor/v8/include/cppgc/cross-thread-persistent.h +465 -0
  8. data/vendor/v8/include/cppgc/custom-space.h +37 -2
  9. data/vendor/v8/include/cppgc/default-platform.h +47 -48
  10. data/vendor/v8/include/cppgc/ephemeron-pair.h +30 -0
  11. data/vendor/v8/include/cppgc/explicit-management.h +82 -0
  12. data/vendor/v8/include/cppgc/garbage-collected.h +4 -3
  13. data/vendor/v8/include/cppgc/heap-consistency.h +253 -0
  14. data/vendor/v8/include/cppgc/heap-state.h +70 -0
  15. data/vendor/v8/include/cppgc/heap-statistics.h +120 -0
  16. data/vendor/v8/include/cppgc/heap.h +68 -6
  17. data/vendor/v8/include/cppgc/internal/api-constants.h +3 -3
  18. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +4 -3
  19. data/vendor/v8/include/cppgc/internal/compiler-specific.h +2 -2
  20. data/vendor/v8/include/cppgc/internal/finalizer-trait.h +2 -0
  21. data/vendor/v8/include/cppgc/internal/gc-info.h +124 -13
  22. data/vendor/v8/include/cppgc/internal/name-trait.h +122 -0
  23. data/vendor/v8/include/cppgc/internal/persistent-node.h +94 -6
  24. data/vendor/v8/include/cppgc/internal/pointer-policies.h +81 -29
  25. data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +1 -1
  26. data/vendor/v8/include/cppgc/internal/write-barrier.h +398 -35
  27. data/vendor/v8/include/cppgc/liveness-broker.h +11 -2
  28. data/vendor/v8/include/cppgc/macros.h +2 -0
  29. data/vendor/v8/include/cppgc/member.h +87 -25
  30. data/vendor/v8/include/cppgc/name-provider.h +65 -0
  31. data/vendor/v8/include/cppgc/object-size-trait.h +58 -0
  32. data/vendor/v8/include/cppgc/persistent.h +41 -11
  33. data/vendor/v8/include/cppgc/platform.h +49 -25
  34. data/vendor/v8/include/cppgc/prefinalizer.h +2 -2
  35. data/vendor/v8/include/cppgc/process-heap-statistics.h +36 -0
  36. data/vendor/v8/include/cppgc/sentinel-pointer.h +32 -0
  37. data/vendor/v8/include/cppgc/source-location.h +2 -1
  38. data/vendor/v8/include/cppgc/testing.h +99 -0
  39. data/vendor/v8/include/cppgc/trace-trait.h +8 -3
  40. data/vendor/v8/include/cppgc/type-traits.h +157 -19
  41. data/vendor/v8/include/cppgc/visitor.h +194 -28
  42. data/vendor/v8/include/libplatform/libplatform.h +11 -0
  43. data/vendor/v8/include/libplatform/v8-tracing.h +2 -0
  44. data/vendor/v8/include/v8-array-buffer.h +433 -0
  45. data/vendor/v8/include/v8-callbacks.h +377 -0
  46. data/vendor/v8/include/v8-container.h +129 -0
  47. data/vendor/v8/include/v8-context.h +418 -0
  48. data/vendor/v8/include/v8-cppgc.h +261 -159
  49. data/vendor/v8/include/v8-data.h +65 -0
  50. data/vendor/v8/include/v8-date.h +43 -0
  51. data/vendor/v8/include/v8-debug.h +151 -0
  52. data/vendor/v8/include/v8-embedder-heap.h +238 -0
  53. data/vendor/v8/include/v8-exception.h +224 -0
  54. data/vendor/v8/include/v8-extension.h +62 -0
  55. data/vendor/v8/include/v8-external.h +37 -0
  56. data/vendor/v8/include/v8-fast-api-calls.h +652 -152
  57. data/vendor/v8/include/v8-forward.h +81 -0
  58. data/vendor/v8/include/v8-function-callback.h +475 -0
  59. data/vendor/v8/include/v8-function.h +122 -0
  60. data/vendor/v8/include/v8-initialization.h +282 -0
  61. data/vendor/v8/include/v8-inspector.h +33 -25
  62. data/vendor/v8/include/v8-internal.h +178 -31
  63. data/vendor/v8/include/v8-isolate.h +1662 -0
  64. data/vendor/v8/include/v8-json.h +47 -0
  65. data/vendor/v8/include/v8-local-handle.h +459 -0
  66. data/vendor/v8/include/v8-locker.h +148 -0
  67. data/vendor/v8/include/v8-maybe.h +137 -0
  68. data/vendor/v8/include/v8-memory-span.h +43 -0
  69. data/vendor/v8/include/v8-message.h +241 -0
  70. data/vendor/v8/include/v8-metrics.h +114 -9
  71. data/vendor/v8/include/v8-microtask-queue.h +152 -0
  72. data/vendor/v8/include/v8-microtask.h +28 -0
  73. data/vendor/v8/include/v8-object.h +770 -0
  74. data/vendor/v8/include/v8-persistent-handle.h +590 -0
  75. data/vendor/v8/include/v8-platform.h +74 -25
  76. data/vendor/v8/include/v8-primitive-object.h +118 -0
  77. data/vendor/v8/include/v8-primitive.h +858 -0
  78. data/vendor/v8/include/v8-profiler.h +72 -9
  79. data/vendor/v8/include/v8-promise.h +174 -0
  80. data/vendor/v8/include/v8-proxy.h +50 -0
  81. data/vendor/v8/include/v8-regexp.h +105 -0
  82. data/vendor/v8/include/v8-script.h +771 -0
  83. data/vendor/v8/include/v8-snapshot.h +198 -0
  84. data/vendor/v8/include/v8-statistics.h +215 -0
  85. data/vendor/v8/include/v8-template.h +1052 -0
  86. data/vendor/v8/include/v8-traced-handle.h +605 -0
  87. data/vendor/v8/include/v8-typed-array.h +282 -0
  88. data/vendor/v8/include/v8-unwinder-state.h +31 -0
  89. data/vendor/v8/include/v8-unwinder.h +129 -0
  90. data/vendor/v8/include/v8-util.h +8 -2
  91. data/vendor/v8/include/v8-value-serializer.h +249 -0
  92. data/vendor/v8/include/v8-value.h +526 -0
  93. data/vendor/v8/include/v8-version.h +3 -3
  94. data/vendor/v8/include/v8-wasm.h +245 -0
  95. data/vendor/v8/include/v8-weak-callback-info.h +73 -0
  96. data/vendor/v8/include/v8.h +41 -12050
  97. data/vendor/v8/include/v8config.h +87 -11
  98. data/vendor/v8/{out.gn → x86_64-linux}/libv8/obj/libv8_monolith.a +0 -0
  99. metadata +60 -6
  100. data/vendor/v8/include/cppgc/internal/process-heap.h +0 -34
@@ -0,0 +1,282 @@
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_INITIALIZATION_H_
6
+ #define INCLUDE_V8_INITIALIZATION_H_
7
+
8
+ #include <stddef.h>
9
+ #include <stdint.h>
10
+
11
+ #include "v8-internal.h" // NOLINT(build/include_directory)
12
+ #include "v8-isolate.h" // NOLINT(build/include_directory)
13
+ #include "v8-platform.h" // NOLINT(build/include_directory)
14
+ #include "v8config.h" // NOLINT(build/include_directory)
15
+
16
+ // We reserve the V8_* prefix for macros defined in V8 public API and
17
+ // assume there are no name conflicts with the embedder's code.
18
+
19
+ /**
20
+ * The v8 JavaScript engine.
21
+ */
22
+ namespace v8 {
23
+
24
+ class PageAllocator;
25
+ class Platform;
26
+ template <class K, class V, class T>
27
+ class PersistentValueMapBase;
28
+
29
+ /**
30
+ * EntropySource is used as a callback function when v8 needs a source
31
+ * of entropy.
32
+ */
33
+ using EntropySource = bool (*)(unsigned char* buffer, size_t length);
34
+
35
+ /**
36
+ * ReturnAddressLocationResolver is used as a callback function when v8 is
37
+ * resolving the location of a return address on the stack. Profilers that
38
+ * change the return address on the stack can use this to resolve the stack
39
+ * location to wherever the profiler stashed the original return address.
40
+ *
41
+ * \param return_addr_location A location on stack where a machine
42
+ * return address resides.
43
+ * \returns Either return_addr_location, or else a pointer to the profiler's
44
+ * copy of the original return address.
45
+ *
46
+ * \note The resolver function must not cause garbage collection.
47
+ */
48
+ using ReturnAddressLocationResolver =
49
+ uintptr_t (*)(uintptr_t return_addr_location);
50
+
51
+ using DcheckErrorCallback = void (*)(const char* file, int line,
52
+ const char* message);
53
+
54
+ /**
55
+ * Container class for static utility functions.
56
+ */
57
+ class V8_EXPORT V8 {
58
+ public:
59
+ /**
60
+ * Hand startup data to V8, in case the embedder has chosen to build
61
+ * V8 with external startup data.
62
+ *
63
+ * Note:
64
+ * - By default the startup data is linked into the V8 library, in which
65
+ * case this function is not meaningful.
66
+ * - If this needs to be called, it needs to be called before V8
67
+ * tries to make use of its built-ins.
68
+ * - To avoid unnecessary copies of data, V8 will point directly into the
69
+ * given data blob, so pretty please keep it around until V8 exit.
70
+ * - Compression of the startup blob might be useful, but needs to
71
+ * handled entirely on the embedders' side.
72
+ * - The call will abort if the data is invalid.
73
+ */
74
+ static void SetSnapshotDataBlob(StartupData* startup_blob);
75
+
76
+ /** Set the callback to invoke in case of Dcheck failures. */
77
+ static void SetDcheckErrorHandler(DcheckErrorCallback that);
78
+
79
+ /**
80
+ * Sets V8 flags from a string.
81
+ */
82
+ static void SetFlagsFromString(const char* str);
83
+ static void SetFlagsFromString(const char* str, size_t length);
84
+
85
+ /**
86
+ * Sets V8 flags from the command line.
87
+ */
88
+ static void SetFlagsFromCommandLine(int* argc, char** argv,
89
+ bool remove_flags);
90
+
91
+ /** Get the version string. */
92
+ static const char* GetVersion();
93
+
94
+ /**
95
+ * Initializes V8. This function needs to be called before the first Isolate
96
+ * is created. It always returns true.
97
+ */
98
+ V8_INLINE static bool Initialize() {
99
+ const int kBuildConfiguration =
100
+ (internal::PointerCompressionIsEnabled() ? kPointerCompression : 0) |
101
+ (internal::SmiValuesAre31Bits() ? k31BitSmis : 0) |
102
+ (internal::HeapSandboxIsEnabled() ? kHeapSandbox : 0) |
103
+ (internal::VirtualMemoryCageIsEnabled() ? kVirtualMemoryCage : 0);
104
+ return Initialize(kBuildConfiguration);
105
+ }
106
+
107
+ /**
108
+ * Allows the host application to provide a callback which can be used
109
+ * as a source of entropy for random number generators.
110
+ */
111
+ static void SetEntropySource(EntropySource source);
112
+
113
+ /**
114
+ * Allows the host application to provide a callback that allows v8 to
115
+ * cooperate with a profiler that rewrites return addresses on stack.
116
+ */
117
+ static void SetReturnAddressLocationResolver(
118
+ ReturnAddressLocationResolver return_address_resolver);
119
+
120
+ /**
121
+ * Releases any resources used by v8 and stops any utility threads
122
+ * that may be running. Note that disposing v8 is permanent, it
123
+ * cannot be reinitialized.
124
+ *
125
+ * It should generally not be necessary to dispose v8 before exiting
126
+ * a process, this should happen automatically. It is only necessary
127
+ * to use if the process needs the resources taken up by v8.
128
+ */
129
+ static bool Dispose();
130
+
131
+ /**
132
+ * Initialize the ICU library bundled with V8. The embedder should only
133
+ * invoke this method when using the bundled ICU. Returns true on success.
134
+ *
135
+ * If V8 was compiled with the ICU data in an external file, the location
136
+ * of the data file has to be provided.
137
+ */
138
+ static bool InitializeICU(const char* icu_data_file = nullptr);
139
+
140
+ /**
141
+ * Initialize the ICU library bundled with V8. The embedder should only
142
+ * invoke this method when using the bundled ICU. If V8 was compiled with
143
+ * the ICU data in an external file and when the default location of that
144
+ * file should be used, a path to the executable must be provided.
145
+ * Returns true on success.
146
+ *
147
+ * The default is a file called icudtl.dat side-by-side with the executable.
148
+ *
149
+ * Optionally, the location of the data file can be provided to override the
150
+ * default.
151
+ */
152
+ static bool InitializeICUDefaultLocation(const char* exec_path,
153
+ const char* icu_data_file = nullptr);
154
+
155
+ /**
156
+ * Initialize the external startup data. The embedder only needs to
157
+ * invoke this method when external startup data was enabled in a build.
158
+ *
159
+ * If V8 was compiled with the startup data in an external file, then
160
+ * V8 needs to be given those external files during startup. There are
161
+ * three ways to do this:
162
+ * - InitializeExternalStartupData(const char*)
163
+ * This will look in the given directory for the file "snapshot_blob.bin".
164
+ * - InitializeExternalStartupDataFromFile(const char*)
165
+ * As above, but will directly use the given file name.
166
+ * - Call SetSnapshotDataBlob.
167
+ * This will read the blobs from the given data structure and will
168
+ * not perform any file IO.
169
+ */
170
+ static void InitializeExternalStartupData(const char* directory_path);
171
+ static void InitializeExternalStartupDataFromFile(const char* snapshot_blob);
172
+
173
+ /**
174
+ * Sets the v8::Platform to use. This should be invoked before V8 is
175
+ * initialized.
176
+ */
177
+ static void InitializePlatform(Platform* platform);
178
+
179
+ /**
180
+ * Clears all references to the v8::Platform. This should be invoked after
181
+ * V8 was disposed.
182
+ */
183
+ static void ShutdownPlatform();
184
+
185
+ #ifdef V8_VIRTUAL_MEMORY_CAGE
186
+ //
187
+ // Virtual Memory Cage related API.
188
+ //
189
+ // This API is not yet stable and subject to changes in the future.
190
+ //
191
+
192
+ /**
193
+ * Initializes the virtual memory cage for V8.
194
+ *
195
+ * This must be invoked after the platform was initialized but before V8 is
196
+ * initialized. The virtual memory cage is torn down during platform shutdown.
197
+ * Returns true on success, false otherwise.
198
+ *
199
+ * TODO(saelo) Once it is no longer optional to create the virtual memory
200
+ * cage when compiling with V8_VIRTUAL_MEMORY_CAGE, the cage initialization
201
+ * will likely happen as part of V8::Initialize, at which point this function
202
+ * should be removed.
203
+ */
204
+ static bool InitializeVirtualMemoryCage();
205
+
206
+ /**
207
+ * Provides access to the virtual memory cage page allocator.
208
+ *
209
+ * This allocator allocates pages inside the virtual memory cage. It can for
210
+ * example be used to obtain virtual memory for ArrayBuffer backing stores,
211
+ * which must be located inside the cage.
212
+ *
213
+ * It should be assumed that an attacker can corrupt data inside the cage,
214
+ * and so in particular the contents of pages returned by this allocator,
215
+ * arbitrarily and concurrently. Due to this, it is recommended to to only
216
+ * place pure data buffers in pages obtained through this allocator.
217
+ *
218
+ * This function must only be called after initializing the virtual memory
219
+ * cage and V8.
220
+ */
221
+ static PageAllocator* GetVirtualMemoryCagePageAllocator();
222
+
223
+ /**
224
+ * Returns the size of the virtual memory cage in bytes.
225
+ *
226
+ * If the cage has not been initialized, or if the initialization failed,
227
+ * this returns zero.
228
+ */
229
+ static size_t GetVirtualMemoryCageSizeInBytes();
230
+ #endif
231
+
232
+ /**
233
+ * Activate trap-based bounds checking for WebAssembly.
234
+ *
235
+ * \param use_v8_signal_handler Whether V8 should install its own signal
236
+ * handler or rely on the embedder's.
237
+ */
238
+ static bool EnableWebAssemblyTrapHandler(bool use_v8_signal_handler);
239
+
240
+ #if defined(V8_OS_WIN)
241
+ /**
242
+ * On Win64, by default V8 does not emit unwinding data for jitted code,
243
+ * which means the OS cannot walk the stack frames and the system Structured
244
+ * Exception Handling (SEH) cannot unwind through V8-generated code:
245
+ * https://code.google.com/p/v8/issues/detail?id=3598.
246
+ *
247
+ * This function allows embedders to register a custom exception handler for
248
+ * exceptions in V8-generated code.
249
+ */
250
+ static void SetUnhandledExceptionCallback(
251
+ UnhandledExceptionCallback unhandled_exception_callback);
252
+ #endif
253
+
254
+ /**
255
+ * Get statistics about the shared memory usage.
256
+ */
257
+ static void GetSharedMemoryStatistics(SharedMemoryStatistics* statistics);
258
+
259
+ private:
260
+ V8();
261
+
262
+ enum BuildConfigurationFeatures {
263
+ kPointerCompression = 1 << 0,
264
+ k31BitSmis = 1 << 1,
265
+ kHeapSandbox = 1 << 2,
266
+ kVirtualMemoryCage = 1 << 3,
267
+ };
268
+
269
+ /**
270
+ * Checks that the embedder build configuration is compatible with
271
+ * the V8 binary and if so initializes V8.
272
+ */
273
+ static bool Initialize(int build_config);
274
+
275
+ friend class Context;
276
+ template <class K, class V, class T>
277
+ friend class PersistentValueMapBase;
278
+ };
279
+
280
+ } // namespace v8
281
+
282
+ #endif // INCLUDE_V8_INITIALIZATION_H_
@@ -6,12 +6,20 @@
6
6
  #define V8_V8_INSPECTOR_H_
7
7
 
8
8
  #include <stdint.h>
9
- #include <cctype>
10
9
 
10
+ #include <cctype>
11
11
  #include <memory>
12
- #include <unordered_map>
13
12
 
14
- #include "v8.h" // NOLINT(build/include_directory)
13
+ #include "v8-isolate.h" // NOLINT(build/include_directory)
14
+ #include "v8-local-handle.h" // NOLINT(build/include_directory)
15
+
16
+ namespace v8 {
17
+ class Context;
18
+ class Name;
19
+ class Object;
20
+ class StackTrace;
21
+ class Value;
22
+ } // namespace v8
15
23
 
16
24
  namespace v8_inspector {
17
25
 
@@ -105,7 +113,9 @@ class V8_EXPORT V8StackTrace {
105
113
  virtual StringView topSourceURL() const = 0;
106
114
  virtual int topLineNumber() const = 0;
107
115
  virtual int topColumnNumber() const = 0;
108
- virtual StringView topScriptId() const = 0;
116
+ virtual int topScriptId() const = 0;
117
+ V8_DEPRECATE_SOON("Use V8::StackTrace::topScriptId() instead.")
118
+ int topScriptIdAsInteger() const { return topScriptId(); }
109
119
  virtual StringView topFunctionName() const = 0;
110
120
 
111
121
  virtual ~V8StackTrace() = default;
@@ -129,6 +139,10 @@ class V8_EXPORT V8InspectorSession {
129
139
  virtual v8::Local<v8::Value> get(v8::Local<v8::Context>) = 0;
130
140
  virtual ~Inspectable() = default;
131
141
  };
142
+ class V8_EXPORT CommandLineAPIScope {
143
+ public:
144
+ virtual ~CommandLineAPIScope() = default;
145
+ };
132
146
  virtual void addInspectedObject(std::unique_ptr<Inspectable>) = 0;
133
147
 
134
148
  // Dispatching protocol messages.
@@ -138,6 +152,9 @@ class V8_EXPORT V8InspectorSession {
138
152
  virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
139
153
  supportedDomains() = 0;
140
154
 
155
+ virtual std::unique_ptr<V8InspectorSession::CommandLineAPIScope>
156
+ initializeCommandLineAPIScope(int executionContextId) = 0;
157
+
141
158
  // Debugger actions.
142
159
  virtual void schedulePauseOnNextStatement(StringView breakReason,
143
160
  StringView breakDetails) = 0;
@@ -161,7 +178,7 @@ class V8_EXPORT V8InspectorSession {
161
178
  v8::Local<v8::Context>*,
162
179
  std::unique_ptr<StringBuffer>* objectGroup) = 0;
163
180
  virtual void releaseObjectGroup(StringView) = 0;
164
- virtual void triggerPreciseCoverageDeltaUpdate(StringView occassion) = 0;
181
+ virtual void triggerPreciseCoverageDeltaUpdate(StringView occasion) = 0;
165
182
  };
166
183
 
167
184
  class V8_EXPORT V8InspectorClient {
@@ -181,8 +198,9 @@ class V8_EXPORT V8InspectorClient {
181
198
  virtual std::unique_ptr<StringBuffer> valueSubtype(v8::Local<v8::Value>) {
182
199
  return nullptr;
183
200
  }
184
- virtual bool formatAccessorsAsProperties(v8::Local<v8::Value>) {
185
- return false;
201
+ virtual std::unique_ptr<StringBuffer> descriptionForValueSubtype(
202
+ v8::Local<v8::Context>, v8::Local<v8::Value>) {
203
+ return nullptr;
186
204
  }
187
205
  virtual bool isInspectableHeapObject(v8::Local<v8::Object>) { return true; }
188
206
 
@@ -224,6 +242,10 @@ class V8_EXPORT V8InspectorClient {
224
242
  const StringView& resourceName) {
225
243
  return nullptr;
226
244
  }
245
+
246
+ // The caller would defer to generating a random 64 bit integer if
247
+ // this method returns 0.
248
+ virtual int64_t generateUniqueId() { return 0; }
227
249
  };
228
250
 
229
251
  // These stack trace ids are intended to be passed between debuggers and be
@@ -284,6 +306,10 @@ class V8_EXPORT V8Inspector {
284
306
  int scriptId) = 0;
285
307
  virtual void exceptionRevoked(v8::Local<v8::Context>, unsigned exceptionId,
286
308
  StringView message) = 0;
309
+ virtual bool associateExceptionData(v8::Local<v8::Context>,
310
+ v8::Local<v8::Value> exception,
311
+ v8::Local<v8::Name> key,
312
+ v8::Local<v8::Value> value) = 0;
287
313
 
288
314
  // Connection.
289
315
  class V8_EXPORT Channel {
@@ -302,24 +328,6 @@ class V8_EXPORT V8Inspector {
302
328
  virtual std::unique_ptr<V8StackTrace> createStackTrace(
303
329
  v8::Local<v8::StackTrace>) = 0;
304
330
  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
331
  };
324
332
 
325
333
  } // namespace v8_inspector