libv8-node 21.7.2.0-arm64-darwin → 22.5.1.0-arm64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/arm64-darwin/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +1 -1
- data/vendor/v8/include/cppgc/type-traits.h +25 -4
- data/vendor/v8/include/v8-array-buffer.h +6 -0
- data/vendor/v8/include/v8-callbacks.h +6 -12
- data/vendor/v8/include/v8-container.h +54 -0
- data/vendor/v8/include/v8-context.h +51 -22
- data/vendor/v8/include/v8-embedder-heap.h +19 -3
- data/vendor/v8/include/v8-embedder-state-scope.h +2 -1
- data/vendor/v8/include/v8-exception.h +15 -9
- data/vendor/v8/include/v8-fast-api-calls.h +35 -26
- data/vendor/v8/include/v8-forward.h +1 -0
- data/vendor/v8/include/v8-function-callback.h +129 -20
- data/vendor/v8/include/v8-handle-base.h +32 -80
- data/vendor/v8/include/v8-inspector.h +16 -24
- data/vendor/v8/include/v8-internal.h +472 -65
- data/vendor/v8/include/v8-isolate.h +86 -51
- data/vendor/v8/include/v8-local-handle.h +257 -31
- data/vendor/v8/include/v8-memory-span.h +157 -2
- data/vendor/v8/include/v8-message.h +22 -3
- data/vendor/v8/include/v8-metrics.h +1 -0
- data/vendor/v8/include/v8-object.h +29 -10
- data/vendor/v8/include/v8-persistent-handle.h +5 -3
- data/vendor/v8/include/v8-platform.h +81 -44
- data/vendor/v8/include/v8-script.h +61 -11
- data/vendor/v8/include/v8-snapshot.h +94 -23
- data/vendor/v8/include/v8-statistics.h +10 -24
- data/vendor/v8/include/v8-template.h +410 -131
- data/vendor/v8/include/v8-traced-handle.h +81 -46
- data/vendor/v8/include/v8-typed-array.h +115 -7
- data/vendor/v8/include/v8-util.h +13 -12
- data/vendor/v8/include/v8-value.h +92 -4
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8config.h +35 -10
- metadata +3 -3
@@ -5,6 +5,9 @@
|
|
5
5
|
#ifndef INCLUDE_V8_FUNCTION_CALLBACK_H_
|
6
6
|
#define INCLUDE_V8_FUNCTION_CALLBACK_H_
|
7
7
|
|
8
|
+
#include <cstdint>
|
9
|
+
#include <limits>
|
10
|
+
|
8
11
|
#include "v8-local-handle.h" // NOLINT(build/include_directory)
|
9
12
|
#include "v8-primitive.h" // NOLINT(build/include_directory)
|
10
13
|
#include "v8config.h" // NOLINT(build/include_directory)
|
@@ -39,14 +42,21 @@ class ReturnValue {
|
|
39
42
|
template <typename S>
|
40
43
|
V8_INLINE void Set(const Global<S>& handle);
|
41
44
|
template <typename S>
|
45
|
+
V8_INLINE void SetNonEmpty(const Global<S>& handle);
|
46
|
+
template <typename S>
|
42
47
|
V8_INLINE void Set(const BasicTracedReference<S>& handle);
|
43
48
|
template <typename S>
|
49
|
+
V8_INLINE void SetNonEmpty(const BasicTracedReference<S>& handle);
|
50
|
+
template <typename S>
|
44
51
|
V8_INLINE void Set(const Local<S> handle);
|
52
|
+
template <typename S>
|
53
|
+
V8_INLINE void SetNonEmpty(const Local<S> handle);
|
45
54
|
// Fast primitive setters
|
46
55
|
V8_INLINE void Set(bool value);
|
47
56
|
V8_INLINE void Set(double i);
|
48
57
|
V8_INLINE void Set(int32_t i);
|
49
58
|
V8_INLINE void Set(uint32_t i);
|
59
|
+
V8_INLINE void Set(uint16_t);
|
50
60
|
// Fast JS primitive setters
|
51
61
|
V8_INLINE void SetNull();
|
52
62
|
V8_INLINE void SetUndefined();
|
@@ -72,8 +82,15 @@ class ReturnValue {
|
|
72
82
|
friend class PropertyCallbackInfo;
|
73
83
|
template <class F, class G, class H>
|
74
84
|
friend class PersistentValueMapBase;
|
75
|
-
V8_INLINE void SetInternal(internal::Address value)
|
76
|
-
|
85
|
+
V8_INLINE void SetInternal(internal::Address value);
|
86
|
+
// Setting the hole value has different meanings depending on the usage:
|
87
|
+
// - for function template callbacks it means that the callback returns
|
88
|
+
// the undefined value,
|
89
|
+
// - for property getter callbacks is means that the callback returns
|
90
|
+
// the undefined value (for property setter callbacks the value returned
|
91
|
+
// is ignored),
|
92
|
+
// - for interceptor callbacks it means that the request was not handled.
|
93
|
+
V8_INLINE void SetTheHole();
|
77
94
|
V8_INLINE explicit ReturnValue(internal::Address* slot);
|
78
95
|
|
79
96
|
// See FunctionCallbackInfo.
|
@@ -276,44 +293,89 @@ using FunctionCallback = void (*)(const FunctionCallbackInfo<Value>& info);
|
|
276
293
|
template <typename T>
|
277
294
|
ReturnValue<T>::ReturnValue(internal::Address* slot) : value_(slot) {}
|
278
295
|
|
296
|
+
template <typename T>
|
297
|
+
void ReturnValue<T>::SetInternal(internal::Address value) {
|
298
|
+
#if V8_STATIC_ROOTS_BOOL
|
299
|
+
using I = internal::Internals;
|
300
|
+
// Ensure that the upper 32-bits are not modified. Compiler should be
|
301
|
+
// able to optimize this to a store of a lower 32-bits of the value.
|
302
|
+
// This is fine since the callback can return only JavaScript values which
|
303
|
+
// are either Smis or heap objects allocated in the main cage.
|
304
|
+
*value_ = I::DecompressTaggedField(*value_, I::CompressTagged(value));
|
305
|
+
#else
|
306
|
+
*value_ = value;
|
307
|
+
#endif // V8_STATIC_ROOTS_BOOL
|
308
|
+
}
|
309
|
+
|
279
310
|
template <typename T>
|
280
311
|
template <typename S>
|
281
312
|
void ReturnValue<T>::Set(const Global<S>& handle) {
|
282
313
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
283
314
|
if (V8_UNLIKELY(handle.IsEmpty())) {
|
284
|
-
|
315
|
+
SetTheHole();
|
285
316
|
} else {
|
286
|
-
|
317
|
+
SetInternal(handle.ptr());
|
287
318
|
}
|
288
319
|
}
|
289
320
|
|
321
|
+
template <typename T>
|
322
|
+
template <typename S>
|
323
|
+
void ReturnValue<T>::SetNonEmpty(const Global<S>& handle) {
|
324
|
+
static_assert(std::is_base_of<T, S>::value, "type check");
|
325
|
+
#ifdef V8_ENABLE_CHECKS
|
326
|
+
internal::VerifyHandleIsNonEmpty(handle.IsEmpty());
|
327
|
+
#endif // V8_ENABLE_CHECKS
|
328
|
+
SetInternal(handle.ptr());
|
329
|
+
}
|
330
|
+
|
290
331
|
template <typename T>
|
291
332
|
template <typename S>
|
292
333
|
void ReturnValue<T>::Set(const BasicTracedReference<S>& handle) {
|
293
334
|
static_assert(std::is_base_of<T, S>::value, "type check");
|
294
335
|
if (V8_UNLIKELY(handle.IsEmpty())) {
|
295
|
-
|
336
|
+
SetTheHole();
|
296
337
|
} else {
|
297
|
-
|
338
|
+
SetInternal(handle.ptr());
|
298
339
|
}
|
299
340
|
}
|
300
341
|
|
342
|
+
template <typename T>
|
343
|
+
template <typename S>
|
344
|
+
void ReturnValue<T>::SetNonEmpty(const BasicTracedReference<S>& handle) {
|
345
|
+
static_assert(std::is_base_of<T, S>::value, "type check");
|
346
|
+
#ifdef V8_ENABLE_CHECKS
|
347
|
+
internal::VerifyHandleIsNonEmpty(handle.IsEmpty());
|
348
|
+
#endif // V8_ENABLE_CHECKS
|
349
|
+
SetInternal(handle.ptr());
|
350
|
+
}
|
351
|
+
|
301
352
|
template <typename T>
|
302
353
|
template <typename S>
|
303
354
|
void ReturnValue<T>::Set(const Local<S> handle) {
|
304
355
|
static_assert(std::is_void<T>::value || std::is_base_of<T, S>::value,
|
305
356
|
"type check");
|
306
357
|
if (V8_UNLIKELY(handle.IsEmpty())) {
|
307
|
-
|
358
|
+
SetTheHole();
|
308
359
|
} else {
|
309
|
-
|
360
|
+
SetInternal(handle.ptr());
|
310
361
|
}
|
311
362
|
}
|
312
363
|
|
364
|
+
template <typename T>
|
365
|
+
template <typename S>
|
366
|
+
void ReturnValue<T>::SetNonEmpty(const Local<S> handle) {
|
367
|
+
static_assert(std::is_void<T>::value || std::is_base_of<T, S>::value,
|
368
|
+
"type check");
|
369
|
+
#ifdef V8_ENABLE_CHECKS
|
370
|
+
internal::VerifyHandleIsNonEmpty(handle.IsEmpty());
|
371
|
+
#endif // V8_ENABLE_CHECKS
|
372
|
+
SetInternal(handle.ptr());
|
373
|
+
}
|
374
|
+
|
313
375
|
template <typename T>
|
314
376
|
void ReturnValue<T>::Set(double i) {
|
315
377
|
static_assert(std::is_base_of<T, Number>::value, "type check");
|
316
|
-
|
378
|
+
SetNonEmpty(Number::New(GetIsolate(), i));
|
317
379
|
}
|
318
380
|
|
319
381
|
template <typename T>
|
@@ -321,10 +383,10 @@ void ReturnValue<T>::Set(int32_t i) {
|
|
321
383
|
static_assert(std::is_base_of<T, Integer>::value, "type check");
|
322
384
|
using I = internal::Internals;
|
323
385
|
if (V8_LIKELY(I::IsValidSmi(i))) {
|
324
|
-
|
386
|
+
SetInternal(I::IntToSmi(i));
|
325
387
|
return;
|
326
388
|
}
|
327
|
-
|
389
|
+
SetNonEmpty(Integer::New(GetIsolate(), i));
|
328
390
|
}
|
329
391
|
|
330
392
|
template <typename T>
|
@@ -336,13 +398,30 @@ void ReturnValue<T>::Set(uint32_t i) {
|
|
336
398
|
Set(static_cast<int32_t>(i));
|
337
399
|
return;
|
338
400
|
}
|
339
|
-
|
401
|
+
SetNonEmpty(Integer::NewFromUnsigned(GetIsolate(), i));
|
402
|
+
}
|
403
|
+
|
404
|
+
template <typename T>
|
405
|
+
void ReturnValue<T>::Set(uint16_t i) {
|
406
|
+
static_assert(std::is_base_of<T, Integer>::value, "type check");
|
407
|
+
using I = internal::Internals;
|
408
|
+
static_assert(I::IsValidSmi(std::numeric_limits<uint16_t>::min()));
|
409
|
+
static_assert(I::IsValidSmi(std::numeric_limits<uint16_t>::max()));
|
410
|
+
SetInternal(I::IntToSmi(i));
|
340
411
|
}
|
341
412
|
|
342
413
|
template <typename T>
|
343
414
|
void ReturnValue<T>::Set(bool value) {
|
344
415
|
static_assert(std::is_base_of<T, Boolean>::value, "type check");
|
345
416
|
using I = internal::Internals;
|
417
|
+
#if V8_STATIC_ROOTS_BOOL
|
418
|
+
#ifdef V8_ENABLE_CHECKS
|
419
|
+
internal::PerformCastCheck(
|
420
|
+
internal::ValueHelper::SlotAsValue<Value, true>(value_));
|
421
|
+
#endif // V8_ENABLE_CHECKS
|
422
|
+
SetInternal(value ? I::StaticReadOnlyRoot::kTrueValue
|
423
|
+
: I::StaticReadOnlyRoot::kFalseValue);
|
424
|
+
#else
|
346
425
|
int root_index;
|
347
426
|
if (value) {
|
348
427
|
root_index = I::kTrueValueRootIndex;
|
@@ -350,27 +429,62 @@ void ReturnValue<T>::Set(bool value) {
|
|
350
429
|
root_index = I::kFalseValueRootIndex;
|
351
430
|
}
|
352
431
|
*value_ = I::GetRoot(GetIsolate(), root_index);
|
432
|
+
#endif // V8_STATIC_ROOTS_BOOL
|
433
|
+
}
|
434
|
+
|
435
|
+
template <typename T>
|
436
|
+
void ReturnValue<T>::SetTheHole() {
|
437
|
+
using I = internal::Internals;
|
438
|
+
#if V8_STATIC_ROOTS_BOOL
|
439
|
+
SetInternal(I::StaticReadOnlyRoot::kTheHoleValue);
|
440
|
+
#else
|
441
|
+
*value_ = I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex);
|
442
|
+
#endif // V8_STATIC_ROOTS_BOOL
|
353
443
|
}
|
354
444
|
|
355
445
|
template <typename T>
|
356
446
|
void ReturnValue<T>::SetNull() {
|
357
447
|
static_assert(std::is_base_of<T, Primitive>::value, "type check");
|
358
448
|
using I = internal::Internals;
|
449
|
+
#if V8_STATIC_ROOTS_BOOL
|
450
|
+
#ifdef V8_ENABLE_CHECKS
|
451
|
+
internal::PerformCastCheck(
|
452
|
+
internal::ValueHelper::SlotAsValue<Value, true>(value_));
|
453
|
+
#endif // V8_ENABLE_CHECKS
|
454
|
+
SetInternal(I::StaticReadOnlyRoot::kNullValue);
|
455
|
+
#else
|
359
456
|
*value_ = I::GetRoot(GetIsolate(), I::kNullValueRootIndex);
|
457
|
+
#endif // V8_STATIC_ROOTS_BOOL
|
360
458
|
}
|
361
459
|
|
362
460
|
template <typename T>
|
363
461
|
void ReturnValue<T>::SetUndefined() {
|
364
462
|
static_assert(std::is_base_of<T, Primitive>::value, "type check");
|
365
463
|
using I = internal::Internals;
|
464
|
+
#if V8_STATIC_ROOTS_BOOL
|
465
|
+
#ifdef V8_ENABLE_CHECKS
|
466
|
+
internal::PerformCastCheck(
|
467
|
+
internal::ValueHelper::SlotAsValue<Value, true>(value_));
|
468
|
+
#endif // V8_ENABLE_CHECKS
|
469
|
+
SetInternal(I::StaticReadOnlyRoot::kUndefinedValue);
|
470
|
+
#else
|
366
471
|
*value_ = I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex);
|
472
|
+
#endif // V8_STATIC_ROOTS_BOOL
|
367
473
|
}
|
368
474
|
|
369
475
|
template <typename T>
|
370
476
|
void ReturnValue<T>::SetEmptyString() {
|
371
477
|
static_assert(std::is_base_of<T, String>::value, "type check");
|
372
478
|
using I = internal::Internals;
|
479
|
+
#if V8_STATIC_ROOTS_BOOL
|
480
|
+
#ifdef V8_ENABLE_CHECKS
|
481
|
+
internal::PerformCastCheck(
|
482
|
+
internal::ValueHelper::SlotAsValue<Value, true>(value_));
|
483
|
+
#endif // V8_ENABLE_CHECKS
|
484
|
+
SetInternal(I::StaticReadOnlyRoot::kEmptyString);
|
485
|
+
#else
|
373
486
|
*value_ = I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex);
|
487
|
+
#endif // V8_STATIC_ROOTS_BOOL
|
374
488
|
}
|
375
489
|
|
376
490
|
template <typename T>
|
@@ -385,10 +499,11 @@ Local<Value> ReturnValue<T>::Get() const {
|
|
385
499
|
if (I::is_identical(*value_, I::StaticReadOnlyRoot::kTheHoleValue)) {
|
386
500
|
#else
|
387
501
|
if (*value_ == I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex)) {
|
388
|
-
#endif
|
502
|
+
#endif // V8_STATIC_ROOTS_BOOL
|
389
503
|
return Undefined(GetIsolate());
|
390
504
|
}
|
391
|
-
return Local<Value>::New(GetIsolate(),
|
505
|
+
return Local<Value>::New(GetIsolate(),
|
506
|
+
internal::ValueHelper::SlotAsValue<Value>(value_));
|
392
507
|
}
|
393
508
|
|
394
509
|
template <typename T>
|
@@ -397,12 +512,6 @@ void ReturnValue<T>::Set(S* whatever) {
|
|
397
512
|
static_assert(sizeof(S) < 0, "incompilable to prevent inadvertent misuse");
|
398
513
|
}
|
399
514
|
|
400
|
-
template <typename T>
|
401
|
-
internal::Address ReturnValue<T>::GetDefaultValue() {
|
402
|
-
using I = internal::Internals;
|
403
|
-
return I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex);
|
404
|
-
}
|
405
|
-
|
406
515
|
template <typename T>
|
407
516
|
FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Address* implicit_args,
|
408
517
|
internal::Address* values,
|
@@ -7,92 +7,44 @@
|
|
7
7
|
|
8
8
|
#include "v8-internal.h" // NOLINT(build/include_directory)
|
9
9
|
|
10
|
-
namespace v8 {
|
10
|
+
namespace v8::api_internal {
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
// Helper functions about values contained in handles.
|
15
|
-
// A value is either an indirect pointer or a direct pointer, depending on
|
16
|
-
// whether direct local support is enabled.
|
17
|
-
class ValueHelper final {
|
12
|
+
template <bool check_statically_enabled>
|
13
|
+
class StackAllocated {
|
18
14
|
public:
|
19
|
-
|
20
|
-
static constexpr Address kTaggedNullAddress = 1;
|
21
|
-
static constexpr Address kEmpty = kTaggedNullAddress;
|
22
|
-
#else
|
23
|
-
static constexpr Address kEmpty = kNullAddress;
|
24
|
-
#endif // V8_ENABLE_DIRECT_LOCAL
|
25
|
-
|
26
|
-
template <typename T>
|
27
|
-
V8_INLINE static bool IsEmpty(T* value) {
|
28
|
-
return reinterpret_cast<Address>(value) == kEmpty;
|
29
|
-
}
|
30
|
-
|
31
|
-
// Returns a handle's "value" for all kinds of abstract handles. For Local,
|
32
|
-
// it is equivalent to `*handle`. The variadic parameters support handle
|
33
|
-
// types with extra type parameters, like `Persistent<T, M>`.
|
34
|
-
template <template <typename T, typename... Ms> typename H, typename T,
|
35
|
-
typename... Ms>
|
36
|
-
V8_INLINE static T* HandleAsValue(const H<T, Ms...>& handle) {
|
37
|
-
return handle.template value<T>();
|
38
|
-
}
|
39
|
-
|
40
|
-
#ifdef V8_ENABLE_DIRECT_LOCAL
|
41
|
-
|
42
|
-
template <typename T>
|
43
|
-
V8_INLINE static Address ValueAsAddress(const T* value) {
|
44
|
-
return reinterpret_cast<Address>(value);
|
45
|
-
}
|
46
|
-
|
47
|
-
template <typename T, bool check_null = true, typename S>
|
48
|
-
V8_INLINE static T* SlotAsValue(S* slot) {
|
49
|
-
if (check_null && slot == nullptr) {
|
50
|
-
return reinterpret_cast<T*>(kTaggedNullAddress);
|
51
|
-
}
|
52
|
-
return *reinterpret_cast<T**>(slot);
|
53
|
-
}
|
15
|
+
V8_INLINE StackAllocated() = default;
|
54
16
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
V8_INLINE static Address ValueAsAddress(const T* value) {
|
59
|
-
return *reinterpret_cast<const Address*>(value);
|
60
|
-
}
|
17
|
+
protected:
|
18
|
+
struct no_checking_tag {};
|
19
|
+
static constexpr no_checking_tag do_not_check{};
|
61
20
|
|
62
|
-
|
63
|
-
V8_INLINE
|
64
|
-
|
65
|
-
}
|
21
|
+
V8_INLINE explicit StackAllocated(no_checking_tag) {}
|
22
|
+
V8_INLINE explicit StackAllocated(const StackAllocated& other,
|
23
|
+
no_checking_tag) {}
|
66
24
|
|
67
|
-
|
25
|
+
V8_INLINE void VerifyOnStack() const {}
|
68
26
|
};
|
69
27
|
|
70
|
-
|
71
|
-
|
72
|
-
*/
|
73
|
-
class HandleHelper final {
|
28
|
+
template <>
|
29
|
+
class V8_TRIVIAL_ABI StackAllocated<true> : public StackAllocated<false> {
|
74
30
|
public:
|
75
|
-
|
76
|
-
* Checks whether two handles are equal.
|
77
|
-
* They are equal iff they are both empty or they are both non-empty and the
|
78
|
-
* objects to which they refer are physically equal.
|
79
|
-
*
|
80
|
-
* If both handles refer to JS objects, this is the same as strict equality.
|
81
|
-
* For primitives, such as numbers or strings, a `false` return value does not
|
82
|
-
* indicate that the values aren't equal in the JavaScript sense.
|
83
|
-
* Use `Value::StrictEquals()` to check primitives for equality.
|
84
|
-
*/
|
85
|
-
template <typename T1, typename T2>
|
86
|
-
V8_INLINE static bool EqualHandles(const T1& lhs, const T2& rhs) {
|
87
|
-
if (lhs.IsEmpty()) return rhs.IsEmpty();
|
88
|
-
if (rhs.IsEmpty()) return false;
|
89
|
-
return lhs.ptr() == rhs.ptr();
|
90
|
-
}
|
31
|
+
V8_INLINE StackAllocated() { VerifyOnStack(); }
|
91
32
|
|
92
|
-
|
93
|
-
|
33
|
+
#if V8_HAS_ATTRIBUTE_TRIVIAL_ABI
|
34
|
+
// In this case, StackAllocated becomes not trivially copyable.
|
35
|
+
V8_INLINE StackAllocated(const StackAllocated& other) { VerifyOnStack(); }
|
36
|
+
StackAllocated& operator=(const StackAllocated&) = default;
|
37
|
+
#endif
|
94
38
|
|
95
|
-
|
39
|
+
protected:
|
40
|
+
V8_INLINE explicit StackAllocated(no_checking_tag tag)
|
41
|
+
: StackAllocated<false>(tag) {}
|
42
|
+
V8_INLINE explicit StackAllocated(const StackAllocated& other,
|
43
|
+
no_checking_tag tag)
|
44
|
+
: StackAllocated<false>(other, tag) {}
|
45
|
+
|
46
|
+
V8_EXPORT void VerifyOnStack() const;
|
47
|
+
};
|
96
48
|
|
97
49
|
/**
|
98
50
|
* A base class for abstract handles containing indirect pointers.
|
@@ -129,9 +81,9 @@ class IndirectHandleBase {
|
|
129
81
|
|
130
82
|
// Returns the handler's "value" (direct or indirect pointer, depending on
|
131
83
|
// whether direct local support is enabled).
|
132
|
-
template <typename T>
|
84
|
+
template <typename T, bool check_null = false>
|
133
85
|
V8_INLINE T* value() const {
|
134
|
-
return internal::ValueHelper::SlotAsValue<T,
|
86
|
+
return internal::ValueHelper::SlotAsValue<T, check_null>(slot());
|
135
87
|
}
|
136
88
|
|
137
89
|
private:
|
@@ -169,7 +121,7 @@ class DirectHandleBase {
|
|
169
121
|
|
170
122
|
// Returns the handler's "value" (direct pointer, as direct local support
|
171
123
|
// is guaranteed to be enabled here).
|
172
|
-
template <typename T>
|
124
|
+
template <typename T, bool check_null = false>
|
173
125
|
V8_INLINE T* value() const {
|
174
126
|
return reinterpret_cast<T*>(ptr_);
|
175
127
|
}
|
@@ -180,6 +132,6 @@ class DirectHandleBase {
|
|
180
132
|
|
181
133
|
#endif // V8_ENABLE_DIRECT_LOCAL
|
182
134
|
|
183
|
-
} // namespace v8
|
135
|
+
} // namespace v8::api_internal
|
184
136
|
|
185
137
|
#endif // INCLUDE_V8_HANDLE_BASE_H_
|
@@ -172,10 +172,6 @@ class V8_EXPORT V8InspectorSession {
|
|
172
172
|
virtual v8::Local<v8::Value> get(v8::Local<v8::Context>) = 0;
|
173
173
|
virtual ~Inspectable() = default;
|
174
174
|
};
|
175
|
-
class V8_EXPORT CommandLineAPIScope {
|
176
|
-
public:
|
177
|
-
virtual ~CommandLineAPIScope() = default;
|
178
|
-
};
|
179
175
|
virtual void addInspectedObject(std::unique_ptr<Inspectable>) = 0;
|
180
176
|
|
181
177
|
// Dispatching protocol messages.
|
@@ -185,9 +181,6 @@ class V8_EXPORT V8InspectorSession {
|
|
185
181
|
virtual std::vector<std::unique_ptr<protocol::Schema::API::Domain>>
|
186
182
|
supportedDomains() = 0;
|
187
183
|
|
188
|
-
virtual std::unique_ptr<V8InspectorSession::CommandLineAPIScope>
|
189
|
-
initializeCommandLineAPIScope(int executionContextId) = 0;
|
190
|
-
|
191
184
|
// Debugger actions.
|
192
185
|
virtual void schedulePauseOnNextStatement(StringView breakReason,
|
193
186
|
StringView breakDetails) = 0;
|
@@ -213,21 +206,26 @@ class V8_EXPORT V8InspectorSession {
|
|
213
206
|
virtual void releaseObjectGroup(StringView) = 0;
|
214
207
|
virtual void triggerPreciseCoverageDeltaUpdate(StringView occasion) = 0;
|
215
208
|
|
209
|
+
struct V8_EXPORT EvaluateResult {
|
210
|
+
enum class ResultType {
|
211
|
+
kNotRun,
|
212
|
+
kSuccess,
|
213
|
+
kException,
|
214
|
+
};
|
215
|
+
|
216
|
+
ResultType type;
|
217
|
+
v8::Local<v8::Value> value;
|
218
|
+
};
|
219
|
+
// Evalaute 'expression' in the provided context. Does the same as
|
220
|
+
// Runtime#evaluate under-the-hood but exposed on the C++ side.
|
221
|
+
virtual EvaluateResult evaluate(v8::Local<v8::Context> context,
|
222
|
+
StringView expression,
|
223
|
+
bool includeCommandLineAPI = false) = 0;
|
224
|
+
|
216
225
|
// Prepare for shutdown (disables debugger pausing, etc.).
|
217
226
|
virtual void stop() = 0;
|
218
227
|
};
|
219
228
|
|
220
|
-
// Deprecated.
|
221
|
-
// TODO(crbug.com/1420968): remove.
|
222
|
-
class V8_EXPORT WebDriverValue {
|
223
|
-
public:
|
224
|
-
explicit WebDriverValue(std::unique_ptr<StringBuffer> type,
|
225
|
-
v8::MaybeLocal<v8::Value> value = {})
|
226
|
-
: type(std::move(type)), value(value) {}
|
227
|
-
std::unique_ptr<StringBuffer> type;
|
228
|
-
v8::MaybeLocal<v8::Value> value;
|
229
|
-
};
|
230
|
-
|
231
229
|
struct V8_EXPORT DeepSerializedValue {
|
232
230
|
explicit DeepSerializedValue(std::unique_ptr<StringBuffer> type,
|
233
231
|
v8::MaybeLocal<v8::Value> value = {})
|
@@ -266,12 +264,6 @@ class V8_EXPORT V8InspectorClient {
|
|
266
264
|
virtual void beginUserGesture() {}
|
267
265
|
virtual void endUserGesture() {}
|
268
266
|
|
269
|
-
// Deprecated. Use `deepSerialize` instead.
|
270
|
-
// TODO(crbug.com/1420968): remove.
|
271
|
-
virtual std::unique_ptr<WebDriverValue> serializeToWebDriverValue(
|
272
|
-
v8::Local<v8::Value> v8Value, int maxDepth) {
|
273
|
-
return nullptr;
|
274
|
-
}
|
275
267
|
virtual std::unique_ptr<DeepSerializationResult> deepSerialize(
|
276
268
|
v8::Local<v8::Value> v8Value, int maxDepth,
|
277
269
|
v8::Local<v8::Object> additionalParameters) {
|