libv8-node 22.7.0.4-x86_64-linux-musl → 23.6.1.0-x86_64-linux-musl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libv8/node/version.rb +3 -3
  3. data/vendor/v8/include/cppgc/allocation.h +10 -11
  4. data/vendor/v8/include/cppgc/garbage-collected.h +8 -0
  5. data/vendor/v8/include/cppgc/heap-statistics.h +2 -0
  6. data/vendor/v8/include/cppgc/internal/api-constants.h +6 -1
  7. data/vendor/v8/include/cppgc/internal/compiler-specific.h +9 -1
  8. data/vendor/v8/include/cppgc/internal/gc-info.h +12 -10
  9. data/vendor/v8/include/cppgc/internal/member-storage.h +6 -0
  10. data/vendor/v8/include/cppgc/internal/name-trait.h +5 -1
  11. data/vendor/v8/include/cppgc/name-provider.h +7 -0
  12. data/vendor/v8/include/v8-array-buffer.h +44 -24
  13. data/vendor/v8/include/v8-callbacks.h +10 -5
  14. data/vendor/v8/include/v8-context.h +41 -9
  15. data/vendor/v8/include/v8-cppgc.h +3 -55
  16. data/vendor/v8/include/v8-date.h +9 -0
  17. data/vendor/v8/include/v8-embedder-heap.h +4 -1
  18. data/vendor/v8/include/v8-exception.h +70 -0
  19. data/vendor/v8/include/v8-fast-api-calls.h +31 -38
  20. data/vendor/v8/include/v8-function-callback.h +203 -62
  21. data/vendor/v8/include/v8-function.h +4 -3
  22. data/vendor/v8/include/v8-handle-base.h +2 -2
  23. data/vendor/v8/include/v8-initialization.h +18 -1
  24. data/vendor/v8/include/v8-inspector.h +6 -3
  25. data/vendor/v8/include/v8-internal.h +303 -58
  26. data/vendor/v8/include/v8-isolate.h +58 -39
  27. data/vendor/v8/include/v8-local-handle.h +18 -19
  28. data/vendor/v8/include/v8-message.h +0 -21
  29. data/vendor/v8/include/v8-metrics.h +4 -0
  30. data/vendor/v8/include/v8-microtask-queue.h +0 -5
  31. data/vendor/v8/include/v8-object.h +284 -35
  32. data/vendor/v8/include/v8-persistent-handle.h +0 -19
  33. data/vendor/v8/include/v8-platform.h +21 -35
  34. data/vendor/v8/include/v8-primitive.h +92 -1
  35. data/vendor/v8/include/v8-profiler.h +38 -1
  36. data/vendor/v8/include/v8-promise.h +2 -2
  37. data/vendor/v8/include/v8-sandbox.h +173 -0
  38. data/vendor/v8/include/v8-script.h +44 -14
  39. data/vendor/v8/include/v8-snapshot.h +38 -2
  40. data/vendor/v8/include/v8-template.h +105 -263
  41. data/vendor/v8/include/v8-traced-handle.h +4 -15
  42. data/vendor/v8/include/v8-unwinder.h +2 -1
  43. data/vendor/v8/include/v8-util.h +1 -117
  44. data/vendor/v8/include/v8-value.h +3 -2
  45. data/vendor/v8/include/v8-version.h +3 -3
  46. data/vendor/v8/include/v8-wasm.h +3 -0
  47. data/vendor/v8/include/v8config.h +51 -7
  48. data/vendor/v8/x86_64-linux-musl/libv8/obj/libv8_monolith.a +0 -0
  49. metadata +3 -2
@@ -8,6 +8,7 @@
8
8
  #include <cstdint>
9
9
  #include <limits>
10
10
 
11
+ #include "v8-internal.h" // NOLINT(build/include_directory)
11
12
  #include "v8-local-handle.h" // NOLINT(build/include_directory)
12
13
  #include "v8-primitive.h" // NOLINT(build/include_directory)
13
14
  #include "v8config.h" // NOLINT(build/include_directory)
@@ -31,6 +32,11 @@ namespace debug {
31
32
  class ConsoleCallArguments;
32
33
  } // namespace debug
33
34
 
35
+ namespace api_internal {
36
+ V8_EXPORT v8::Local<v8::Value> GetFunctionTemplateData(
37
+ v8::Isolate* isolate, v8::Local<v8::Data> raw_target);
38
+ } // namespace api_internal
39
+
34
40
  template <typename T>
35
41
  class ReturnValue {
36
42
  public:
@@ -38,7 +44,7 @@ class ReturnValue {
38
44
  V8_INLINE ReturnValue(const ReturnValue<S>& that) : value_(that.value_) {
39
45
  static_assert(std::is_base_of<T, S>::value, "type check");
40
46
  }
41
- // Local setters
47
+ // Handle-based setters.
42
48
  template <typename S>
43
49
  V8_INLINE void Set(const Global<S>& handle);
44
50
  template <typename S>
@@ -51,15 +57,19 @@ class ReturnValue {
51
57
  V8_INLINE void Set(const Local<S> handle);
52
58
  template <typename S>
53
59
  V8_INLINE void SetNonEmpty(const Local<S> handle);
54
- // Fast primitive setters
60
+ // Fast primitive number setters.
55
61
  V8_INLINE void Set(bool value);
56
62
  V8_INLINE void Set(double i);
63
+ V8_INLINE void Set(int16_t i);
57
64
  V8_INLINE void Set(int32_t i);
65
+ V8_INLINE void Set(int64_t i);
66
+ V8_INLINE void Set(uint16_t i);
58
67
  V8_INLINE void Set(uint32_t i);
59
- V8_INLINE void Set(uint16_t);
68
+ V8_INLINE void Set(uint64_t i);
60
69
  // Fast JS primitive setters
61
70
  V8_INLINE void SetNull();
62
71
  V8_INLINE void SetUndefined();
72
+ V8_INLINE void SetFalse();
63
73
  V8_INLINE void SetEmptyString();
64
74
  // Convenience getter for Isolate
65
75
  V8_INLINE Isolate* GetIsolate() const;
@@ -83,14 +93,13 @@ class ReturnValue {
83
93
  template <class F, class G, class H>
84
94
  friend class PersistentValueMapBase;
85
95
  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();
96
+ // Default value depends on <T>:
97
+ // - <void> -> true_value,
98
+ // - <v8::Boolean> -> true_value,
99
+ // - <v8::Integer> -> 0,
100
+ // - <v8::Value> -> undefined_value,
101
+ // - <v8::Array> -> undefined_value.
102
+ V8_INLINE void SetDefaultValue();
94
103
  V8_INLINE explicit ReturnValue(internal::Address* slot);
95
104
 
96
105
  // See FunctionCallbackInfo.
@@ -127,6 +136,12 @@ class FunctionCallbackInfo {
127
136
  * referencing this callback was found (which in V8 internally is often
128
137
  * referred to as holder [sic]).
129
138
  */
139
+ V8_DEPRECATED(
140
+ "V8 will stop providing access to hidden prototype (i.e. "
141
+ "JSGlobalObject). Use This() instead. \n"
142
+ "DO NOT try to workaround this by accessing JSGlobalObject via "
143
+ "v8::Object::GetPrototype() - it'll be deprecated soon too. \n"
144
+ "See http://crbug.com/333672197. ")
130
145
  V8_INLINE Local<Object> Holder() const;
131
146
  /** For construct calls, this returns the "new.target" value. */
132
147
  V8_INLINE Local<Value> NewTarget() const;
@@ -139,16 +154,22 @@ class FunctionCallbackInfo {
139
154
  /** The ReturnValue for the call. */
140
155
  V8_INLINE ReturnValue<T> GetReturnValue() const;
141
156
 
157
+ // This is a temporary replacement for Holder() added just for the purpose
158
+ // of testing the deprecated Holder() machinery until it's removed for real.
159
+ // DO NOT use it.
160
+ V8_INLINE Local<Object> HolderSoonToBeDeprecated() const;
161
+
142
162
  private:
143
163
  friend class internal::FunctionCallbackArguments;
144
164
  friend class internal::CustomArguments<FunctionCallbackInfo>;
145
165
  friend class debug::ConsoleCallArguments;
166
+ friend void internal::PrintFunctionCallbackInfo(void*);
146
167
 
147
168
  static constexpr int kHolderIndex = 0;
148
169
  static constexpr int kIsolateIndex = 1;
149
- static constexpr int kUnusedIndex = 2;
170
+ static constexpr int kContextIndex = 2;
150
171
  static constexpr int kReturnValueIndex = 3;
151
- static constexpr int kDataIndex = 4;
172
+ static constexpr int kTargetIndex = 4;
152
173
  static constexpr int kNewTargetIndex = 5;
153
174
  static constexpr int kArgsLength = 6;
154
175
 
@@ -168,9 +189,13 @@ class FunctionCallbackInfo {
168
189
 
169
190
  V8_INLINE FunctionCallbackInfo(internal::Address* implicit_args,
170
191
  internal::Address* values, int length);
192
+
193
+ // TODO(https://crbug.com/326505377): flatten the v8::FunctionCallbackInfo
194
+ // object to avoid indirect loads through values_ and implicit_args_ and
195
+ // reduce the number of instructions in the CallApiCallback builtin.
171
196
  internal::Address* implicit_args_;
172
197
  internal::Address* values_;
173
- int length_;
198
+ internal::Address length_;
174
199
  };
175
200
 
176
201
  /**
@@ -244,8 +269,23 @@ class PropertyCallbackInfo {
244
269
  *
245
270
  * \note For security reasons, do not pass the object back into the runtime.
246
271
  */
272
+ V8_DEPRECATE_SOON(
273
+ "V8 will stop providing access to hidden prototype (i.e. "
274
+ "JSGlobalObject). Use HolderV2() instead. \n"
275
+ "DO NOT try to workaround this by accessing JSGlobalObject via "
276
+ "v8::Object::GetPrototype() - it'll be deprecated soon too. \n"
277
+ "See http://crbug.com/333672197. ")
247
278
  V8_INLINE Local<Object> Holder() const;
248
279
 
280
+ /**
281
+ * \return The object in the prototype chain of the receiver that has the
282
+ * interceptor. Suppose you have `x` and its prototype is `y`, and `y`
283
+ * has an interceptor. Then `info.This()` is `x` and `info.Holder()` is `y`.
284
+ * In case the property is installed on the global object the Holder()
285
+ * would return the global proxy.
286
+ */
287
+ V8_INLINE Local<Object> HolderV2() const;
288
+
249
289
  /**
250
290
  * \return The return value of the callback.
251
291
  * Can be changed by calling Set().
@@ -266,24 +306,28 @@ class PropertyCallbackInfo {
266
306
  V8_INLINE bool ShouldThrowOnError() const;
267
307
 
268
308
  private:
309
+ template <typename U>
310
+ friend class PropertyCallbackInfo;
269
311
  friend class MacroAssembler;
270
312
  friend class internal::PropertyCallbackArguments;
271
313
  friend class internal::CustomArguments<PropertyCallbackInfo>;
272
- static constexpr int kShouldThrowOnErrorIndex = 0;
273
- static constexpr int kHolderIndex = 1;
274
- static constexpr int kIsolateIndex = 2;
275
- static constexpr int kUnusedIndex = 3;
276
- static constexpr int kReturnValueIndex = 4;
277
- static constexpr int kDataIndex = 5;
278
- static constexpr int kThisIndex = 6;
279
- static constexpr int kArgsLength = 7;
314
+ friend void internal::PrintPropertyCallbackInfo(void*);
315
+
316
+ static constexpr int kPropertyKeyIndex = 0;
317
+ static constexpr int kShouldThrowOnErrorIndex = 1;
318
+ static constexpr int kHolderIndex = 2;
319
+ static constexpr int kIsolateIndex = 3;
320
+ static constexpr int kHolderV2Index = 4;
321
+ static constexpr int kReturnValueIndex = 5;
322
+ static constexpr int kDataIndex = 6;
323
+ static constexpr int kThisIndex = 7;
324
+ static constexpr int kArgsLength = 8;
280
325
 
281
- static constexpr int kSize = 1 * internal::kApiSystemPointerSize;
326
+ static constexpr int kSize = kArgsLength * internal::kApiSystemPointerSize;
282
327
 
283
- V8_INLINE explicit PropertyCallbackInfo(internal::Address* args)
284
- : args_(args) {}
328
+ PropertyCallbackInfo() = default;
285
329
 
286
- internal::Address* args_;
330
+ mutable internal::Address args_[kArgsLength];
287
331
  };
288
332
 
289
333
  using FunctionCallback = void (*)(const FunctionCallbackInfo<Value>& info);
@@ -312,7 +356,7 @@ template <typename S>
312
356
  void ReturnValue<T>::Set(const Global<S>& handle) {
313
357
  static_assert(std::is_base_of<T, S>::value, "type check");
314
358
  if (V8_UNLIKELY(handle.IsEmpty())) {
315
- SetTheHole();
359
+ SetDefaultValue();
316
360
  } else {
317
361
  SetInternal(handle.ptr());
318
362
  }
@@ -333,7 +377,7 @@ template <typename S>
333
377
  void ReturnValue<T>::Set(const BasicTracedReference<S>& handle) {
334
378
  static_assert(std::is_base_of<T, S>::value, "type check");
335
379
  if (V8_UNLIKELY(handle.IsEmpty())) {
336
- SetTheHole();
380
+ SetDefaultValue();
337
381
  } else {
338
382
  SetInternal(handle.ptr());
339
383
  }
@@ -352,10 +396,25 @@ void ReturnValue<T>::SetNonEmpty(const BasicTracedReference<S>& handle) {
352
396
  template <typename T>
353
397
  template <typename S>
354
398
  void ReturnValue<T>::Set(const Local<S> handle) {
355
- static_assert(std::is_void<T>::value || std::is_base_of<T, S>::value,
356
- "type check");
399
+ // "V8_DEPRECATE_SOON" this method if |T| is |void|.
400
+ #ifdef V8_IMMINENT_DEPRECATION_WARNINGS
401
+ static constexpr bool is_allowed_void = false;
402
+ static_assert(!std::is_void<T>::value,
403
+ "ReturnValue<void>::Set(const Local<S>) is deprecated. "
404
+ "Do nothing to indicate that the operation succeeded or use "
405
+ "SetFalse() to indicate that the operation failed (don't "
406
+ "forget to handle info.ShouldThrowOnError()). "
407
+ "See http://crbug.com/348660658 for details.");
408
+ #else
409
+ static constexpr bool is_allowed_void = std::is_void<T>::value;
410
+ #endif // V8_IMMINENT_DEPRECATION_WARNINGS
411
+ static_assert(is_allowed_void || std::is_base_of<T, S>::value, "type check");
357
412
  if (V8_UNLIKELY(handle.IsEmpty())) {
358
- SetTheHole();
413
+ SetDefaultValue();
414
+ } else if constexpr (is_allowed_void) {
415
+ // Simulate old behaviour for "v8::AccessorSetterCallback" for which
416
+ // it was possible to set the return value even for ReturnValue<void>.
417
+ Set(handle->BooleanValue(GetIsolate()));
359
418
  } else {
360
419
  SetInternal(handle.ptr());
361
420
  }
@@ -364,12 +423,29 @@ void ReturnValue<T>::Set(const Local<S> handle) {
364
423
  template <typename T>
365
424
  template <typename S>
366
425
  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");
426
+ // "V8_DEPRECATE_SOON" this method if |T| is |void|.
427
+ #ifdef V8_IMMINENT_DEPRECATION_WARNINGS
428
+ static constexpr bool is_allowed_void = false;
429
+ static_assert(!std::is_void<T>::value,
430
+ "ReturnValue<void>::SetNonEmpty(const Local<S>) is deprecated. "
431
+ "Do nothing to indicate that the operation succeeded or use "
432
+ "SetFalse() to indicate that the operation failed (don't "
433
+ "forget to handle info.ShouldThrowOnError()). "
434
+ "See http://crbug.com/348660658 for details.");
435
+ #else
436
+ static constexpr bool is_allowed_void = std::is_void<T>::value;
437
+ #endif // V8_IMMINENT_DEPRECATION_WARNINGS
438
+ static_assert(is_allowed_void || std::is_base_of<T, S>::value, "type check");
369
439
  #ifdef V8_ENABLE_CHECKS
370
440
  internal::VerifyHandleIsNonEmpty(handle.IsEmpty());
371
441
  #endif // V8_ENABLE_CHECKS
372
- SetInternal(handle.ptr());
442
+ if constexpr (is_allowed_void) {
443
+ // Simulate old behaviour for "v8::AccessorSetterCallback" for which
444
+ // it was possible to set the return value even for ReturnValue<void>.
445
+ Set(handle->BooleanValue(GetIsolate()));
446
+ } else {
447
+ SetInternal(handle.ptr());
448
+ }
373
449
  }
374
450
 
375
451
  template <typename T>
@@ -379,26 +455,32 @@ void ReturnValue<T>::Set(double i) {
379
455
  }
380
456
 
381
457
  template <typename T>
382
- void ReturnValue<T>::Set(int32_t i) {
458
+ void ReturnValue<T>::Set(int16_t i) {
383
459
  static_assert(std::is_base_of<T, Integer>::value, "type check");
384
460
  using I = internal::Internals;
385
- if (V8_LIKELY(I::IsValidSmi(i))) {
386
- SetInternal(I::IntToSmi(i));
461
+ static_assert(I::IsValidSmi(std::numeric_limits<int16_t>::min()));
462
+ static_assert(I::IsValidSmi(std::numeric_limits<int16_t>::max()));
463
+ SetInternal(I::IntegralToSmi(i));
464
+ }
465
+
466
+ template <typename T>
467
+ void ReturnValue<T>::Set(int32_t i) {
468
+ static_assert(std::is_base_of<T, Integer>::value, "type check");
469
+ if (const auto result = internal::Internals::TryIntegralToSmi(i)) {
470
+ SetInternal(*result);
387
471
  return;
388
472
  }
389
473
  SetNonEmpty(Integer::New(GetIsolate(), i));
390
474
  }
391
475
 
392
476
  template <typename T>
393
- void ReturnValue<T>::Set(uint32_t i) {
477
+ void ReturnValue<T>::Set(int64_t i) {
394
478
  static_assert(std::is_base_of<T, Integer>::value, "type check");
395
- // Can't simply use INT32_MAX here for whatever reason.
396
- bool fits_into_int32_t = (i & (1U << 31)) == 0;
397
- if (V8_LIKELY(fits_into_int32_t)) {
398
- Set(static_cast<int32_t>(i));
479
+ if (const auto result = internal::Internals::TryIntegralToSmi(i)) {
480
+ SetInternal(*result);
399
481
  return;
400
482
  }
401
- SetNonEmpty(Integer::NewFromUnsigned(GetIsolate(), i));
483
+ SetNonEmpty(Number::New(GetIsolate(), static_cast<double>(i)));
402
484
  }
403
485
 
404
486
  template <typename T>
@@ -407,12 +489,33 @@ void ReturnValue<T>::Set(uint16_t i) {
407
489
  using I = internal::Internals;
408
490
  static_assert(I::IsValidSmi(std::numeric_limits<uint16_t>::min()));
409
491
  static_assert(I::IsValidSmi(std::numeric_limits<uint16_t>::max()));
410
- SetInternal(I::IntToSmi(i));
492
+ SetInternal(I::IntegralToSmi(i));
493
+ }
494
+
495
+ template <typename T>
496
+ void ReturnValue<T>::Set(uint32_t i) {
497
+ static_assert(std::is_base_of<T, Integer>::value, "type check");
498
+ if (const auto result = internal::Internals::TryIntegralToSmi(i)) {
499
+ SetInternal(*result);
500
+ return;
501
+ }
502
+ SetNonEmpty(Integer::NewFromUnsigned(GetIsolate(), i));
503
+ }
504
+
505
+ template <typename T>
506
+ void ReturnValue<T>::Set(uint64_t i) {
507
+ static_assert(std::is_base_of<T, Integer>::value, "type check");
508
+ if (const auto result = internal::Internals::TryIntegralToSmi(i)) {
509
+ SetInternal(*result);
510
+ return;
511
+ }
512
+ SetNonEmpty(Number::New(GetIsolate(), static_cast<double>(i)));
411
513
  }
412
514
 
413
515
  template <typename T>
414
516
  void ReturnValue<T>::Set(bool value) {
415
- static_assert(std::is_base_of<T, Boolean>::value, "type check");
517
+ static_assert(std::is_void<T>::value || std::is_base_of<T, Boolean>::value,
518
+ "type check");
416
519
  using I = internal::Internals;
417
520
  #if V8_STATIC_ROOTS_BOOL
418
521
  #ifdef V8_ENABLE_CHECKS
@@ -433,13 +536,20 @@ void ReturnValue<T>::Set(bool value) {
433
536
  }
434
537
 
435
538
  template <typename T>
436
- void ReturnValue<T>::SetTheHole() {
539
+ void ReturnValue<T>::SetDefaultValue() {
437
540
  using I = internal::Internals;
541
+ if constexpr (std::is_same_v<void, T> || std::is_same_v<v8::Boolean, T>) {
542
+ Set(true);
543
+ } else if constexpr (std::is_same_v<v8::Integer, T>) {
544
+ SetInternal(I::IntegralToSmi(0));
545
+ } else {
546
+ static_assert(std::is_same_v<v8::Value, T> || std::is_same_v<v8::Array, T>);
438
547
  #if V8_STATIC_ROOTS_BOOL
439
- SetInternal(I::StaticReadOnlyRoot::kTheHoleValue);
548
+ SetInternal(I::StaticReadOnlyRoot::kUndefinedValue);
440
549
  #else
441
- *value_ = I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex);
550
+ *value_ = I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex);
442
551
  #endif // V8_STATIC_ROOTS_BOOL
552
+ }
443
553
  }
444
554
 
445
555
  template <typename T>
@@ -472,6 +582,22 @@ void ReturnValue<T>::SetUndefined() {
472
582
  #endif // V8_STATIC_ROOTS_BOOL
473
583
  }
474
584
 
585
+ template <typename T>
586
+ void ReturnValue<T>::SetFalse() {
587
+ static_assert(std::is_void<T>::value || std::is_base_of<T, Boolean>::value,
588
+ "type check");
589
+ using I = internal::Internals;
590
+ #if V8_STATIC_ROOTS_BOOL
591
+ #ifdef V8_ENABLE_CHECKS
592
+ internal::PerformCastCheck(
593
+ internal::ValueHelper::SlotAsValue<Value, true>(value_));
594
+ #endif // V8_ENABLE_CHECKS
595
+ SetInternal(I::StaticReadOnlyRoot::kFalseValue);
596
+ #else
597
+ *value_ = I::GetRoot(GetIsolate(), I::kFalseValueRootIndex);
598
+ #endif // V8_STATIC_ROOTS_BOOL
599
+ }
600
+
475
601
  template <typename T>
476
602
  void ReturnValue<T>::SetEmptyString() {
477
603
  static_assert(std::is_base_of<T, String>::value, "type check");
@@ -494,14 +620,6 @@ Isolate* ReturnValue<T>::GetIsolate() const {
494
620
 
495
621
  template <typename T>
496
622
  Local<Value> ReturnValue<T>::Get() const {
497
- using I = internal::Internals;
498
- #if V8_STATIC_ROOTS_BOOL
499
- if (I::is_identical(*value_, I::StaticReadOnlyRoot::kTheHoleValue)) {
500
- #else
501
- if (*value_ == I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex)) {
502
- #endif // V8_STATIC_ROOTS_BOOL
503
- return Undefined(GetIsolate());
504
- }
505
623
  return Local<Value>::New(GetIsolate(),
506
624
  internal::ValueHelper::SlotAsValue<Value>(value_));
507
625
  }
@@ -521,7 +639,7 @@ FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Address* implicit_args,
521
639
  template <typename T>
522
640
  Local<Value> FunctionCallbackInfo<T>::operator[](int i) const {
523
641
  // values_ points to the first argument (not the receiver).
524
- if (i < 0 || length_ <= i) return Undefined(GetIsolate());
642
+ if (i < 0 || Length() <= i) return Undefined(GetIsolate());
525
643
  return Local<Value>::FromSlot(values_ + i);
526
644
  }
527
645
 
@@ -532,10 +650,15 @@ Local<Object> FunctionCallbackInfo<T>::This() const {
532
650
  }
533
651
 
534
652
  template <typename T>
535
- Local<Object> FunctionCallbackInfo<T>::Holder() const {
653
+ Local<Object> FunctionCallbackInfo<T>::HolderSoonToBeDeprecated() const {
536
654
  return Local<Object>::FromSlot(&implicit_args_[kHolderIndex]);
537
655
  }
538
656
 
657
+ template <typename T>
658
+ Local<Object> FunctionCallbackInfo<T>::Holder() const {
659
+ return HolderSoonToBeDeprecated();
660
+ }
661
+
539
662
  template <typename T>
540
663
  Local<Value> FunctionCallbackInfo<T>::NewTarget() const {
541
664
  return Local<Value>::FromSlot(&implicit_args_[kNewTargetIndex]);
@@ -543,7 +666,8 @@ Local<Value> FunctionCallbackInfo<T>::NewTarget() const {
543
666
 
544
667
  template <typename T>
545
668
  Local<Value> FunctionCallbackInfo<T>::Data() const {
546
- return Local<Value>::FromSlot(&implicit_args_[kDataIndex]);
669
+ auto target = Local<v8::Data>::FromSlot(&implicit_args_[kTargetIndex]);
670
+ return api_internal::GetFunctionTemplateData(GetIsolate(), target);
547
671
  }
548
672
 
549
673
  template <typename T>
@@ -563,7 +687,7 @@ bool FunctionCallbackInfo<T>::IsConstructCall() const {
563
687
 
564
688
  template <typename T>
565
689
  int FunctionCallbackInfo<T>::Length() const {
566
- return length_;
690
+ return static_cast<int>(length_);
567
691
  }
568
692
 
569
693
  template <typename T>
@@ -586,6 +710,23 @@ Local<Object> PropertyCallbackInfo<T>::Holder() const {
586
710
  return Local<Object>::FromSlot(&args_[kHolderIndex]);
587
711
  }
588
712
 
713
+ namespace api_internal {
714
+ // Returns JSGlobalProxy if holder is JSGlobalObject or unmodified holder
715
+ // otherwise.
716
+ V8_EXPORT internal::Address ConvertToJSGlobalProxyIfNecessary(
717
+ internal::Address holder);
718
+ } // namespace api_internal
719
+
720
+ template <typename T>
721
+ Local<Object> PropertyCallbackInfo<T>::HolderV2() const {
722
+ using I = internal::Internals;
723
+ if (!I::HasHeapObjectTag(args_[kHolderV2Index])) {
724
+ args_[kHolderV2Index] =
725
+ api_internal::ConvertToJSGlobalProxyIfNecessary(args_[kHolderIndex]);
726
+ }
727
+ return Local<Object>::FromSlot(&args_[kHolderV2Index]);
728
+ }
729
+
589
730
  template <typename T>
590
731
  ReturnValue<T> PropertyCallbackInfo<T>::GetReturnValue() const {
591
732
  return ReturnValue<T>(&args_[kReturnValueIndex]);
@@ -595,8 +736,8 @@ template <typename T>
595
736
  bool PropertyCallbackInfo<T>::ShouldThrowOnError() const {
596
737
  using I = internal::Internals;
597
738
  if (args_[kShouldThrowOnErrorIndex] !=
598
- I::IntToSmi(I::kInferShouldThrowMode)) {
599
- return args_[kShouldThrowOnErrorIndex] != I::IntToSmi(I::kDontThrow);
739
+ I::IntegralToSmi(I::kInferShouldThrowMode)) {
740
+ return args_[kShouldThrowOnErrorIndex] != I::IntegralToSmi(I::kDontThrow);
600
741
  }
601
742
  return v8::internal::ShouldThrowOnError(
602
743
  reinterpret_cast<v8::internal::Isolate*>(GetIsolate()));
@@ -52,6 +52,10 @@ class V8_EXPORT Function : public Object {
52
52
  Local<Context> context, int argc, Local<Value> argv[],
53
53
  SideEffectType side_effect_type = SideEffectType::kHasSideEffect) const;
54
54
 
55
+ V8_WARN_UNUSED_RESULT MaybeLocal<Value> Call(v8::Isolate* isolate,
56
+ Local<Context> context,
57
+ Local<Value> recv, int argc,
58
+ Local<Value> argv[]);
55
59
  V8_WARN_UNUSED_RESULT MaybeLocal<Value> Call(Local<Context> context,
56
60
  Local<Value> recv, int argc,
57
61
  Local<Value> argv[]);
@@ -59,9 +63,6 @@ class V8_EXPORT Function : public Object {
59
63
  void SetName(Local<String> name);
60
64
  Local<Value> GetName() const;
61
65
 
62
- V8_DEPRECATED("No direct replacement")
63
- MaybeLocal<UnboundScript> GetUnboundScript() const;
64
-
65
66
  /**
66
67
  * Name inferred from variable or property assignment of this function.
67
68
  * Used to facilitate debugging and profiling of JavaScript code written
@@ -90,7 +90,7 @@ class IndirectHandleBase {
90
90
  internal::Address* location_ = nullptr;
91
91
  };
92
92
 
93
- #ifdef V8_ENABLE_DIRECT_LOCAL
93
+ #ifdef V8_ENABLE_DIRECT_HANDLE
94
94
 
95
95
  /**
96
96
  * A base class for abstract handles containing direct pointers.
@@ -130,7 +130,7 @@ class DirectHandleBase {
130
130
  internal::Address ptr_ = internal::ValueHelper::kEmpty;
131
131
  };
132
132
 
133
- #endif // V8_ENABLE_DIRECT_LOCAL
133
+ #endif // V8_ENABLE_DIRECT_HANDLE
134
134
 
135
135
  } // namespace v8::api_internal
136
136
 
@@ -52,6 +52,9 @@ using ReturnAddressLocationResolver =
52
52
  using DcheckErrorCallback = void (*)(const char* file, int line,
53
53
  const char* message);
54
54
 
55
+ using V8FatalErrorCallback = void (*)(const char* file, int line,
56
+ const char* message);
57
+
55
58
  /**
56
59
  * Container class for static utility functions.
57
60
  */
@@ -77,6 +80,12 @@ class V8_EXPORT V8 {
77
80
  /** Set the callback to invoke in case of Dcheck failures. */
78
81
  static void SetDcheckErrorHandler(DcheckErrorCallback that);
79
82
 
83
+ /** Set the callback to invoke in the case of CHECK failures or fatal
84
+ * errors. This is distinct from Isolate::SetFatalErrorHandler, which
85
+ * is invoked in response to API usage failures.
86
+ * */
87
+ static void SetFatalErrorHandler(V8FatalErrorCallback that);
88
+
80
89
  /**
81
90
  * Sets V8 flags from a string.
82
91
  */
@@ -97,10 +106,17 @@ class V8_EXPORT V8 {
97
106
  * is created. It always returns true.
98
107
  */
99
108
  V8_INLINE static bool Initialize() {
109
+ #ifdef V8_TARGET_OS_ANDROID
110
+ const bool kV8TargetOsIsAndroid = true;
111
+ #else
112
+ const bool kV8TargetOsIsAndroid = false;
113
+ #endif
114
+
100
115
  const int kBuildConfiguration =
101
116
  (internal::PointerCompressionIsEnabled() ? kPointerCompression : 0) |
102
117
  (internal::SmiValuesAre31Bits() ? k31BitSmis : 0) |
103
- (internal::SandboxIsEnabled() ? kSandbox : 0);
118
+ (internal::SandboxIsEnabled() ? kSandbox : 0) |
119
+ (kV8TargetOsIsAndroid ? kTargetOsIsAndroid : 0);
104
120
  return Initialize(kBuildConfiguration);
105
121
  }
106
122
 
@@ -271,6 +287,7 @@ class V8_EXPORT V8 {
271
287
  kPointerCompression = 1 << 0,
272
288
  k31BitSmis = 1 << 1,
273
289
  kSandbox = 1 << 2,
290
+ kTargetOsIsAndroid = 1 << 3,
274
291
  };
275
292
 
276
293
  /**
@@ -297,9 +297,12 @@ class V8_EXPORT V8InspectorClient {
297
297
  return v8::MaybeLocal<v8::Value>();
298
298
  }
299
299
 
300
- virtual void consoleTime(const StringView& title) {}
301
- virtual void consoleTimeEnd(const StringView& title) {}
302
- virtual void consoleTimeStamp(const StringView& title) {}
300
+ virtual void consoleTime(v8::Isolate* isolate, v8::Local<v8::String> label);
301
+ virtual void consoleTimeEnd(v8::Isolate* isolate,
302
+ v8::Local<v8::String> label);
303
+ virtual void consoleTimeStamp(v8::Isolate* isolate,
304
+ v8::Local<v8::String> label);
305
+
303
306
  virtual void consoleClear(int contextGroupId) {}
304
307
  virtual double currentTimeMS() { return 0; }
305
308
  typedef void (*TimerCallback)(void*);