libv8-node 16.10.0.0-aarch64-linux → 18.8.0.0-aarch64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libv8-node/paths.rb +5 -1
  3. data/lib/libv8/node/version.rb +3 -3
  4. data/vendor/v8/aarch64-linux/libv8/obj/libv8_monolith.a +0 -0
  5. data/vendor/v8/include/cppgc/allocation.h +100 -22
  6. data/vendor/v8/include/cppgc/cross-thread-persistent.h +114 -33
  7. data/vendor/v8/include/cppgc/default-platform.h +2 -10
  8. data/vendor/v8/include/cppgc/explicit-management.h +22 -4
  9. data/vendor/v8/include/cppgc/garbage-collected.h +15 -26
  10. data/vendor/v8/include/cppgc/heap-consistency.h +30 -0
  11. data/vendor/v8/include/cppgc/heap-state.h +12 -0
  12. data/vendor/v8/include/cppgc/heap.h +7 -2
  13. data/vendor/v8/include/cppgc/internal/api-constants.h +8 -0
  14. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +25 -14
  15. data/vendor/v8/include/cppgc/internal/finalizer-trait.h +4 -1
  16. data/vendor/v8/include/cppgc/internal/gc-info.h +90 -10
  17. data/vendor/v8/include/cppgc/internal/logging.h +3 -3
  18. data/vendor/v8/include/cppgc/internal/name-trait.h +11 -0
  19. data/vendor/v8/include/cppgc/internal/persistent-node.h +73 -29
  20. data/vendor/v8/include/cppgc/internal/pointer-policies.h +26 -15
  21. data/vendor/v8/include/cppgc/internal/write-barrier.h +62 -23
  22. data/vendor/v8/include/cppgc/liveness-broker.h +4 -1
  23. data/vendor/v8/include/cppgc/member.h +7 -2
  24. data/vendor/v8/include/cppgc/persistent.h +38 -33
  25. data/vendor/v8/include/cppgc/platform.h +4 -1
  26. data/vendor/v8/include/cppgc/prefinalizer.h +35 -12
  27. data/vendor/v8/include/cppgc/testing.h +9 -2
  28. data/vendor/v8/include/cppgc/type-traits.h +6 -13
  29. data/vendor/v8/include/cppgc/visitor.h +9 -7
  30. data/vendor/v8/include/libplatform/libplatform.h +0 -11
  31. data/vendor/v8/include/libplatform/v8-tracing.h +0 -1
  32. data/vendor/v8/include/v8-array-buffer.h +445 -0
  33. data/vendor/v8/include/v8-callbacks.h +397 -0
  34. data/vendor/v8/include/v8-container.h +129 -0
  35. data/vendor/v8/include/v8-context.h +407 -0
  36. data/vendor/v8/include/v8-cppgc.h +21 -128
  37. data/vendor/v8/include/v8-data.h +80 -0
  38. data/vendor/v8/include/v8-date.h +43 -0
  39. data/vendor/v8/include/v8-debug.h +168 -0
  40. data/vendor/v8/include/v8-embedder-heap.h +218 -0
  41. data/vendor/v8/include/v8-embedder-state-scope.h +51 -0
  42. data/vendor/v8/include/v8-exception.h +217 -0
  43. data/vendor/v8/include/v8-extension.h +62 -0
  44. data/vendor/v8/include/v8-external.h +37 -0
  45. data/vendor/v8/include/v8-fast-api-calls.h +172 -24
  46. data/vendor/v8/include/v8-forward.h +81 -0
  47. data/vendor/v8/include/v8-function-callback.h +475 -0
  48. data/vendor/v8/include/v8-function.h +125 -0
  49. data/vendor/v8/include/v8-initialization.h +315 -0
  50. data/vendor/v8/include/v8-inspector.h +56 -28
  51. data/vendor/v8/include/v8-internal.h +217 -55
  52. data/vendor/v8/include/v8-isolate.h +1709 -0
  53. data/vendor/v8/include/v8-json.h +47 -0
  54. data/vendor/v8/include/v8-local-handle.h +455 -0
  55. data/vendor/v8/include/v8-locker.h +149 -0
  56. data/vendor/v8/include/v8-maybe.h +137 -0
  57. data/vendor/v8/include/v8-memory-span.h +43 -0
  58. data/vendor/v8/include/v8-message.h +216 -0
  59. data/vendor/v8/include/v8-metrics.h +69 -16
  60. data/vendor/v8/include/v8-microtask-queue.h +152 -0
  61. data/vendor/v8/include/v8-microtask.h +28 -0
  62. data/vendor/v8/include/v8-object.h +775 -0
  63. data/vendor/v8/include/v8-persistent-handle.h +590 -0
  64. data/vendor/v8/include/v8-platform.h +400 -17
  65. data/vendor/v8/include/v8-primitive-object.h +118 -0
  66. data/vendor/v8/include/v8-primitive.h +866 -0
  67. data/vendor/v8/include/v8-profiler.h +88 -13
  68. data/vendor/v8/include/v8-promise.h +174 -0
  69. data/vendor/v8/include/v8-proxy.h +50 -0
  70. data/vendor/v8/include/v8-regexp.h +105 -0
  71. data/vendor/v8/include/v8-script.h +747 -0
  72. data/vendor/v8/include/v8-snapshot.h +196 -0
  73. data/vendor/v8/include/v8-statistics.h +217 -0
  74. data/vendor/v8/include/v8-template.h +1079 -0
  75. data/vendor/v8/include/v8-traced-handle.h +420 -0
  76. data/vendor/v8/include/v8-typed-array.h +282 -0
  77. data/vendor/v8/include/v8-unwinder-state.h +4 -3
  78. data/vendor/v8/include/v8-unwinder.h +132 -0
  79. data/vendor/v8/include/v8-util.h +7 -1
  80. data/vendor/v8/include/v8-value-serializer-version.h +1 -1
  81. data/vendor/v8/include/v8-value-serializer.h +279 -0
  82. data/vendor/v8/include/v8-value.h +526 -0
  83. data/vendor/v8/include/v8-version.h +4 -4
  84. data/vendor/v8/include/v8-wasm.h +257 -0
  85. data/vendor/v8/include/v8-weak-callback-info.h +87 -0
  86. data/vendor/v8/include/v8.h +41 -12601
  87. data/vendor/v8/include/v8config.h +102 -12
  88. metadata +47 -5
  89. data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +0 -30
@@ -11,18 +11,24 @@
11
11
  #include <unordered_set>
12
12
  #include <vector>
13
13
 
14
- #include "v8.h" // NOLINT(build/include_directory)
14
+ #include "v8-local-handle.h" // NOLINT(build/include_directory)
15
+ #include "v8-message.h" // NOLINT(build/include_directory)
16
+ #include "v8-persistent-handle.h" // NOLINT(build/include_directory)
15
17
 
16
18
  /**
17
19
  * Profiler support for the V8 JavaScript engine.
18
20
  */
19
21
  namespace v8 {
20
22
 
23
+ enum class EmbedderStateTag : uint8_t;
21
24
  class HeapGraphNode;
22
25
  struct HeapStatsUpdate;
26
+ class Object;
27
+ enum StateTag : int;
23
28
 
24
29
  using NativeObject = void*;
25
30
  using SnapshotObjectId = uint32_t;
31
+ using ProfilerId = uint32_t;
26
32
 
27
33
  struct CpuProfileDeoptFrame {
28
34
  int script_id;
@@ -207,6 +213,16 @@ class V8_EXPORT CpuProfile {
207
213
  */
208
214
  int64_t GetStartTime() const;
209
215
 
216
+ /**
217
+ * Returns state of the vm when sample was captured.
218
+ */
219
+ StateTag GetSampleState(int index) const;
220
+
221
+ /**
222
+ * Returns state of the embedder when sample was captured.
223
+ */
224
+ EmbedderStateTag GetSampleEmbedderState(int index) const;
225
+
210
226
  /**
211
227
  * Returns time when the profile recording was stopped (in microseconds)
212
228
  * since some unspecified starting point.
@@ -258,15 +274,33 @@ enum class CpuProfilingStatus {
258
274
  kErrorTooManyProfilers
259
275
  };
260
276
 
277
+ /**
278
+ * Result from StartProfiling returning the Profiling Status, and
279
+ * id of the started profiler, or 0 if profiler is not started
280
+ */
281
+ struct CpuProfilingResult {
282
+ const ProfilerId id;
283
+ const CpuProfilingStatus status;
284
+ };
285
+
261
286
  /**
262
287
  * Delegate for when max samples reached and samples are discarded.
263
288
  */
264
289
  class V8_EXPORT DiscardedSamplesDelegate {
265
290
  public:
266
- DiscardedSamplesDelegate() {}
291
+ DiscardedSamplesDelegate() = default;
267
292
 
268
293
  virtual ~DiscardedSamplesDelegate() = default;
269
294
  virtual void Notify() = 0;
295
+
296
+ ProfilerId GetId() const { return profiler_id_; }
297
+
298
+ private:
299
+ friend internal::CpuProfile;
300
+
301
+ void SetId(ProfilerId id) { profiler_id_ = id; }
302
+
303
+ ProfilerId profiler_id_;
270
304
  };
271
305
 
272
306
  /**
@@ -289,8 +323,8 @@ class V8_EXPORT CpuProfilingOptions {
289
323
  * interval, set via SetSamplingInterval(). If
290
324
  * zero, the sampling interval will be equal to
291
325
  * the profiler's sampling interval.
292
- * \param filter_context Deprecated option to filter by context, currently a
293
- * no-op.
326
+ * \param filter_context If specified, profiles will only contain frames
327
+ * using this context. Other frames will be elided.
294
328
  */
295
329
  CpuProfilingOptions(
296
330
  CpuProfilingMode mode = kLeafNodeLineNumbers,
@@ -304,9 +338,13 @@ class V8_EXPORT CpuProfilingOptions {
304
338
  private:
305
339
  friend class internal::CpuProfile;
306
340
 
341
+ bool has_filter_context() const { return !filter_context_.IsEmpty(); }
342
+ void* raw_filter_context() const;
343
+
307
344
  CpuProfilingMode mode_;
308
345
  unsigned max_samples_;
309
346
  int sampling_interval_us_;
347
+ CopyablePersistentTraits<Context>::CopyablePersistent filter_context_;
310
348
  };
311
349
 
312
350
  /**
@@ -352,6 +390,45 @@ class V8_EXPORT CpuProfiler {
352
390
  */
353
391
  void SetUsePreciseSampling(bool);
354
392
 
393
+ /**
394
+ * Starts collecting a CPU profile. Several profiles may be collected at once.
395
+ * Generates an anonymous profiler, without a String identifier.
396
+ */
397
+ CpuProfilingResult Start(
398
+ CpuProfilingOptions options,
399
+ std::unique_ptr<DiscardedSamplesDelegate> delegate = nullptr);
400
+
401
+ /**
402
+ * Starts collecting a CPU profile. Title may be an empty string. Several
403
+ * profiles may be collected at once. Attempts to start collecting several
404
+ * profiles with the same title are silently ignored.
405
+ */
406
+ CpuProfilingResult Start(
407
+ Local<String> title, CpuProfilingOptions options,
408
+ std::unique_ptr<DiscardedSamplesDelegate> delegate = nullptr);
409
+
410
+ /**
411
+ * Starts profiling with the same semantics as above, except with expanded
412
+ * parameters.
413
+ *
414
+ * |record_samples| parameter controls whether individual samples should
415
+ * be recorded in addition to the aggregated tree.
416
+ *
417
+ * |max_samples| controls the maximum number of samples that should be
418
+ * recorded by the profiler. Samples obtained after this limit will be
419
+ * discarded.
420
+ */
421
+ CpuProfilingResult Start(
422
+ Local<String> title, CpuProfilingMode mode, bool record_samples = false,
423
+ unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
424
+
425
+ /**
426
+ * The same as StartProfiling above, but the CpuProfilingMode defaults to
427
+ * kLeafNodeLineNumbers mode, which was the previous default behavior of the
428
+ * profiler.
429
+ */
430
+ CpuProfilingResult Start(Local<String> title, bool record_samples = false);
431
+
355
432
  /**
356
433
  * Starts collecting a CPU profile. Title may be an empty string. Several
357
434
  * profiles may be collected at once. Attempts to start collecting several
@@ -375,6 +452,7 @@ class V8_EXPORT CpuProfiler {
375
452
  CpuProfilingStatus StartProfiling(
376
453
  Local<String> title, CpuProfilingMode mode, bool record_samples = false,
377
454
  unsigned max_samples = CpuProfilingOptions::kNoSampleLimit);
455
+
378
456
  /**
379
457
  * The same as StartProfiling above, but the CpuProfilingMode defaults to
380
458
  * kLeafNodeLineNumbers mode, which was the previous default behavior of the
@@ -383,6 +461,11 @@ class V8_EXPORT CpuProfiler {
383
461
  CpuProfilingStatus StartProfiling(Local<String> title,
384
462
  bool record_samples = false);
385
463
 
464
+ /**
465
+ * Stops collecting CPU profile with a given id and returns it.
466
+ */
467
+ CpuProfile* Stop(ProfilerId id);
468
+
386
469
  /**
387
470
  * Stops collecting CPU profile with a given title and returns it.
388
471
  * If the title given is empty, finishes the last profile started.
@@ -596,7 +679,7 @@ class V8_EXPORT ActivityControl {
596
679
  * Notify about current progress. The activity can be stopped by
597
680
  * returning kAbort as the callback result.
598
681
  */
599
- virtual ControlOption ReportProgressValue(int done, int total) = 0;
682
+ virtual ControlOption ReportProgressValue(uint32_t done, uint32_t total) = 0;
600
683
  };
601
684
 
602
685
  /**
@@ -896,14 +979,6 @@ class V8_EXPORT HeapProfiler {
896
979
  * Takes a heap snapshot and returns it.
897
980
  */
898
981
  const HeapSnapshot* TakeHeapSnapshot(
899
- ActivityControl* control = nullptr,
900
- ObjectNameResolver* global_object_name_resolver = nullptr,
901
- bool treat_global_objects_as_roots = true);
902
-
903
- /**
904
- * Takes a heap snapshot and returns it.
905
- */
906
- const HeapSnapshot* TakeHeapSnapshotV8_92(
907
982
  ActivityControl* control = nullptr,
908
983
  ObjectNameResolver* global_object_name_resolver = nullptr,
909
984
  bool treat_global_objects_as_roots = true,
@@ -0,0 +1,174 @@
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_PROMISE_H_
6
+ #define INCLUDE_V8_PROMISE_H_
7
+
8
+ #include "v8-local-handle.h" // NOLINT(build/include_directory)
9
+ #include "v8-object.h" // NOLINT(build/include_directory)
10
+ #include "v8config.h" // NOLINT(build/include_directory)
11
+
12
+ namespace v8 {
13
+
14
+ class Context;
15
+
16
+ #ifndef V8_PROMISE_INTERNAL_FIELD_COUNT
17
+ // The number of required internal fields can be defined by embedder.
18
+ #define V8_PROMISE_INTERNAL_FIELD_COUNT 0
19
+ #endif
20
+
21
+ /**
22
+ * An instance of the built-in Promise constructor (ES6 draft).
23
+ */
24
+ class V8_EXPORT Promise : public Object {
25
+ public:
26
+ /**
27
+ * State of the promise. Each value corresponds to one of the possible values
28
+ * of the [[PromiseState]] field.
29
+ */
30
+ enum PromiseState { kPending, kFulfilled, kRejected };
31
+
32
+ class V8_EXPORT Resolver : public Object {
33
+ public:
34
+ /**
35
+ * Create a new resolver, along with an associated promise in pending state.
36
+ */
37
+ static V8_WARN_UNUSED_RESULT MaybeLocal<Resolver> New(
38
+ Local<Context> context);
39
+
40
+ /**
41
+ * Extract the associated promise.
42
+ */
43
+ Local<Promise> GetPromise();
44
+
45
+ /**
46
+ * Resolve/reject the associated promise with a given value.
47
+ * Ignored if the promise is no longer pending.
48
+ */
49
+ V8_WARN_UNUSED_RESULT Maybe<bool> Resolve(Local<Context> context,
50
+ Local<Value> value);
51
+
52
+ V8_WARN_UNUSED_RESULT Maybe<bool> Reject(Local<Context> context,
53
+ Local<Value> value);
54
+
55
+ V8_INLINE static Resolver* Cast(Value* value) {
56
+ #ifdef V8_ENABLE_CHECKS
57
+ CheckCast(value);
58
+ #endif
59
+ return static_cast<Promise::Resolver*>(value);
60
+ }
61
+
62
+ private:
63
+ Resolver();
64
+ static void CheckCast(Value* obj);
65
+ };
66
+
67
+ /**
68
+ * Register a resolution/rejection handler with a promise.
69
+ * The handler is given the respective resolution/rejection value as
70
+ * an argument. If the promise is already resolved/rejected, the handler is
71
+ * invoked at the end of turn.
72
+ */
73
+ V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Catch(Local<Context> context,
74
+ Local<Function> handler);
75
+
76
+ V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Then(Local<Context> context,
77
+ Local<Function> handler);
78
+
79
+ V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Then(Local<Context> context,
80
+ Local<Function> on_fulfilled,
81
+ Local<Function> on_rejected);
82
+
83
+ /**
84
+ * Returns true if the promise has at least one derived promise, and
85
+ * therefore resolve/reject handlers (including default handler).
86
+ */
87
+ bool HasHandler() const;
88
+
89
+ /**
90
+ * Returns the content of the [[PromiseResult]] field. The Promise must not
91
+ * be pending.
92
+ */
93
+ Local<Value> Result();
94
+
95
+ /**
96
+ * Returns the value of the [[PromiseState]] field.
97
+ */
98
+ PromiseState State();
99
+
100
+ /**
101
+ * Marks this promise as handled to avoid reporting unhandled rejections.
102
+ */
103
+ void MarkAsHandled();
104
+
105
+ /**
106
+ * Marks this promise as silent to prevent pausing the debugger when the
107
+ * promise is rejected.
108
+ */
109
+ void MarkAsSilent();
110
+
111
+ V8_INLINE static Promise* Cast(Value* value) {
112
+ #ifdef V8_ENABLE_CHECKS
113
+ CheckCast(value);
114
+ #endif
115
+ return static_cast<Promise*>(value);
116
+ }
117
+
118
+ static const int kEmbedderFieldCount = V8_PROMISE_INTERNAL_FIELD_COUNT;
119
+
120
+ private:
121
+ Promise();
122
+ static void CheckCast(Value* obj);
123
+ };
124
+
125
+ /**
126
+ * PromiseHook with type kInit is called when a new promise is
127
+ * created. When a new promise is created as part of the chain in the
128
+ * case of Promise.then or in the intermediate promises created by
129
+ * Promise.{race, all}/AsyncFunctionAwait, we pass the parent promise
130
+ * otherwise we pass undefined.
131
+ *
132
+ * PromiseHook with type kResolve is called at the beginning of
133
+ * resolve or reject function defined by CreateResolvingFunctions.
134
+ *
135
+ * PromiseHook with type kBefore is called at the beginning of the
136
+ * PromiseReactionJob.
137
+ *
138
+ * PromiseHook with type kAfter is called right at the end of the
139
+ * PromiseReactionJob.
140
+ */
141
+ enum class PromiseHookType { kInit, kResolve, kBefore, kAfter };
142
+
143
+ using PromiseHook = void (*)(PromiseHookType type, Local<Promise> promise,
144
+ Local<Value> parent);
145
+
146
+ // --- Promise Reject Callback ---
147
+ enum PromiseRejectEvent {
148
+ kPromiseRejectWithNoHandler = 0,
149
+ kPromiseHandlerAddedAfterReject = 1,
150
+ kPromiseRejectAfterResolved = 2,
151
+ kPromiseResolveAfterResolved = 3,
152
+ };
153
+
154
+ class PromiseRejectMessage {
155
+ public:
156
+ PromiseRejectMessage(Local<Promise> promise, PromiseRejectEvent event,
157
+ Local<Value> value)
158
+ : promise_(promise), event_(event), value_(value) {}
159
+
160
+ V8_INLINE Local<Promise> GetPromise() const { return promise_; }
161
+ V8_INLINE PromiseRejectEvent GetEvent() const { return event_; }
162
+ V8_INLINE Local<Value> GetValue() const { return value_; }
163
+
164
+ private:
165
+ Local<Promise> promise_;
166
+ PromiseRejectEvent event_;
167
+ Local<Value> value_;
168
+ };
169
+
170
+ using PromiseRejectCallback = void (*)(PromiseRejectMessage message);
171
+
172
+ } // namespace v8
173
+
174
+ #endif // INCLUDE_V8_PROMISE_H_
@@ -0,0 +1,50 @@
1
+
2
+ // Copyright 2021 the V8 project authors. All rights reserved.
3
+ // Use of this source code is governed by a BSD-style license that can be
4
+ // found in the LICENSE file.
5
+
6
+ #ifndef INCLUDE_V8_PROXY_H_
7
+ #define INCLUDE_V8_PROXY_H_
8
+
9
+ #include "v8-context.h" // NOLINT(build/include_directory)
10
+ #include "v8-local-handle.h" // NOLINT(build/include_directory)
11
+ #include "v8-object.h" // NOLINT(build/include_directory)
12
+ #include "v8config.h" // NOLINT(build/include_directory)
13
+
14
+ namespace v8 {
15
+
16
+ class Context;
17
+
18
+ /**
19
+ * An instance of the built-in Proxy constructor (ECMA-262, 6th Edition,
20
+ * 26.2.1).
21
+ */
22
+ class V8_EXPORT Proxy : public Object {
23
+ public:
24
+ Local<Value> GetTarget();
25
+ Local<Value> GetHandler();
26
+ bool IsRevoked() const;
27
+ void Revoke();
28
+
29
+ /**
30
+ * Creates a new Proxy for the target object.
31
+ */
32
+ static MaybeLocal<Proxy> New(Local<Context> context,
33
+ Local<Object> local_target,
34
+ Local<Object> local_handler);
35
+
36
+ V8_INLINE static Proxy* Cast(Value* value) {
37
+ #ifdef V8_ENABLE_CHECKS
38
+ CheckCast(value);
39
+ #endif
40
+ return static_cast<Proxy*>(value);
41
+ }
42
+
43
+ private:
44
+ Proxy();
45
+ static void CheckCast(Value* obj);
46
+ };
47
+
48
+ } // namespace v8
49
+
50
+ #endif // INCLUDE_V8_PROXY_H_
@@ -0,0 +1,105 @@
1
+
2
+ // Copyright 2021 the V8 project authors. All rights reserved.
3
+ // Use of this source code is governed by a BSD-style license that can be
4
+ // found in the LICENSE file.
5
+
6
+ #ifndef INCLUDE_V8_REGEXP_H_
7
+ #define INCLUDE_V8_REGEXP_H_
8
+
9
+ #include "v8-local-handle.h" // NOLINT(build/include_directory)
10
+ #include "v8-object.h" // NOLINT(build/include_directory)
11
+ #include "v8config.h" // NOLINT(build/include_directory)
12
+
13
+ namespace v8 {
14
+
15
+ class Context;
16
+
17
+ /**
18
+ * An instance of the built-in RegExp constructor (ECMA-262, 15.10).
19
+ */
20
+ class V8_EXPORT RegExp : public Object {
21
+ public:
22
+ /**
23
+ * Regular expression flag bits. They can be or'ed to enable a set
24
+ * of flags.
25
+ * The kLinear value ('l') is experimental and can only be used with
26
+ * --enable-experimental-regexp-engine. RegExps with kLinear flag are
27
+ * guaranteed to be executed in asymptotic linear time wrt. the length of
28
+ * the subject string.
29
+ */
30
+ enum Flags {
31
+ kNone = 0,
32
+ kGlobal = 1 << 0,
33
+ kIgnoreCase = 1 << 1,
34
+ kMultiline = 1 << 2,
35
+ kSticky = 1 << 3,
36
+ kUnicode = 1 << 4,
37
+ kDotAll = 1 << 5,
38
+ kLinear = 1 << 6,
39
+ kHasIndices = 1 << 7,
40
+ };
41
+
42
+ static constexpr int kFlagCount = 8;
43
+
44
+ /**
45
+ * Creates a regular expression from the given pattern string and
46
+ * the flags bit field. May throw a JavaScript exception as
47
+ * described in ECMA-262, 15.10.4.1.
48
+ *
49
+ * For example,
50
+ * RegExp::New(v8::String::New("foo"),
51
+ * static_cast<RegExp::Flags>(kGlobal | kMultiline))
52
+ * is equivalent to evaluating "/foo/gm".
53
+ */
54
+ static V8_WARN_UNUSED_RESULT MaybeLocal<RegExp> New(Local<Context> context,
55
+ Local<String> pattern,
56
+ Flags flags);
57
+
58
+ /**
59
+ * Like New, but additionally specifies a backtrack limit. If the number of
60
+ * backtracks done in one Exec call hits the limit, a match failure is
61
+ * immediately returned.
62
+ */
63
+ static V8_WARN_UNUSED_RESULT MaybeLocal<RegExp> NewWithBacktrackLimit(
64
+ Local<Context> context, Local<String> pattern, Flags flags,
65
+ uint32_t backtrack_limit);
66
+
67
+ /**
68
+ * Executes the current RegExp instance on the given subject string.
69
+ * Equivalent to RegExp.prototype.exec as described in
70
+ *
71
+ * https://tc39.es/ecma262/#sec-regexp.prototype.exec
72
+ *
73
+ * On success, an Array containing the matched strings is returned. On
74
+ * failure, returns Null.
75
+ *
76
+ * Note: modifies global context state, accessible e.g. through RegExp.input.
77
+ */
78
+ V8_WARN_UNUSED_RESULT MaybeLocal<Object> Exec(Local<Context> context,
79
+ Local<String> subject);
80
+
81
+ /**
82
+ * Returns the value of the source property: a string representing
83
+ * the regular expression.
84
+ */
85
+ Local<String> GetSource() const;
86
+
87
+ /**
88
+ * Returns the flags bit field.
89
+ */
90
+ Flags GetFlags() const;
91
+
92
+ V8_INLINE static RegExp* Cast(Value* value) {
93
+ #ifdef V8_ENABLE_CHECKS
94
+ CheckCast(value);
95
+ #endif
96
+ return static_cast<RegExp*>(value);
97
+ }
98
+
99
+ private:
100
+ static void CheckCast(Value* obj);
101
+ };
102
+
103
+ } // namespace v8
104
+
105
+ #endif // INCLUDE_V8_REGEXP_H_