libv8 5.3.332.38.5-arm-linux → 5.7.492.65.1-arm-linux

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,33 @@
1
+ // Copyright 2017 the V8 project authors. All rights reserved.
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ #ifndef V8_VERSION_STRING_H_
6
+ #define V8_VERSION_STRING_H_
7
+
8
+ #include "v8-version.h" // NOLINT(build/include)
9
+
10
+ // This is here rather than v8-version.h to keep that file simple and
11
+ // machine-processable.
12
+
13
+ #if V8_IS_CANDIDATE_VERSION
14
+ #define V8_CANDIDATE_STRING " (candidate)"
15
+ #else
16
+ #define V8_CANDIDATE_STRING ""
17
+ #endif
18
+
19
+ #define V8_SX(x) #x
20
+ #define V8_S(x) V8_SX(x)
21
+
22
+ #if V8_PATCH_LEVEL > 0
23
+ #define V8_VERSION_STRING \
24
+ V8_S(V8_MAJOR_VERSION) \
25
+ "." V8_S(V8_MINOR_VERSION) "." V8_S(V8_BUILD_NUMBER) "." V8_S( \
26
+ V8_PATCH_LEVEL) V8_CANDIDATE_STRING
27
+ #else
28
+ #define V8_VERSION_STRING \
29
+ V8_S(V8_MAJOR_VERSION) \
30
+ "." V8_S(V8_MINOR_VERSION) "." V8_S(V8_BUILD_NUMBER) V8_CANDIDATE_STRING
31
+ #endif
32
+
33
+ #endif // V8_VERSION_STRING_H_
@@ -9,9 +9,9 @@
9
9
  // NOTE these macros are used by some of the tool scripts and the build
10
10
  // system so their names cannot be changed without changing the scripts.
11
11
  #define V8_MAJOR_VERSION 5
12
- #define V8_MINOR_VERSION 3
13
- #define V8_BUILD_NUMBER 332
14
- #define V8_PATCH_LEVEL 38
12
+ #define V8_MINOR_VERSION 7
13
+ #define V8_BUILD_NUMBER 492
14
+ #define V8_PATCH_LEVEL 65
15
15
 
16
16
  // Use 1 for candidates and 0 otherwise.
17
17
  // (Boolean macro values are not supported by all preprocessors.)
@@ -18,6 +18,7 @@
18
18
  #include <stddef.h>
19
19
  #include <stdint.h>
20
20
  #include <stdio.h>
21
+ #include <memory>
21
22
  #include <utility>
22
23
  #include <vector>
23
24
 
@@ -34,11 +35,6 @@
34
35
  // the V8 DLL USING_V8_SHARED needs to be defined. When either building the V8
35
36
  // static library or building a program which uses the V8 static library neither
36
37
  // BUILDING_V8_SHARED nor USING_V8_SHARED should be defined.
37
- #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
38
- #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the\
39
- build configuration to ensure that at most one of these is set
40
- #endif
41
-
42
38
  #ifdef BUILDING_V8_SHARED
43
39
  # define V8_EXPORT __declspec(dllexport)
44
40
  #elif USING_V8_SHARED
@@ -50,7 +46,7 @@
50
46
  #else // V8_OS_WIN
51
47
 
52
48
  // Setup for Linux shared library export.
53
- #if V8_HAS_ATTRIBUTE_VISIBILITY && defined(V8_SHARED)
49
+ #if V8_HAS_ATTRIBUTE_VISIBILITY
54
50
  # ifdef BUILDING_V8_SHARED
55
51
  # define V8_EXPORT __attribute__ ((visibility("default")))
56
52
  # else
@@ -69,6 +65,7 @@ namespace v8 {
69
65
 
70
66
  class AccessorSignature;
71
67
  class Array;
68
+ class ArrayBuffer;
72
69
  class Boolean;
73
70
  class BooleanObject;
74
71
  class Context;
@@ -94,6 +91,7 @@ class ObjectTemplate;
94
91
  class Platform;
95
92
  class Primitive;
96
93
  class Promise;
94
+ class PropertyDescriptor;
97
95
  class Proxy;
98
96
  class RawOperationDescriptor;
99
97
  class Script;
@@ -292,8 +290,8 @@ class Local {
292
290
  return Local<T>(T::Cast(*that));
293
291
  }
294
292
 
295
-
296
- template <class S> V8_INLINE Local<S> As() {
293
+ template <class S>
294
+ V8_INLINE Local<S> As() const {
297
295
  return Local<S>::Cast(*this);
298
296
  }
299
297
 
@@ -340,7 +338,7 @@ class Local {
340
338
 
341
339
 
342
340
  #if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
343
- // Local is an alias for Local for historical reasons.
341
+ // Handle is an alias for Local for historical reasons.
344
342
  template <class T>
345
343
  using Handle = Local<T>;
346
344
  #endif
@@ -575,18 +573,6 @@ template <class T> class PersistentBase {
575
573
  */
576
574
  V8_INLINE void MarkIndependent();
577
575
 
578
- /**
579
- * Marks the reference to this object partially dependent. Partially dependent
580
- * handles only depend on other partially dependent handles and these
581
- * dependencies are provided through object groups. It provides a way to build
582
- * smaller object groups for young objects that represent only a subset of all
583
- * external dependencies. This mark is automatically cleared after each
584
- * garbage collection.
585
- */
586
- V8_INLINE V8_DEPRECATED(
587
- "deprecated optimization, do not use partially dependent groups",
588
- void MarkPartiallyDependent());
589
-
590
576
  /**
591
577
  * Marks the reference to this object as active. The scavenge garbage
592
578
  * collection should not reclaim the objects marked as active.
@@ -614,6 +600,9 @@ template <class T> class PersistentBase {
614
600
  */
615
601
  V8_INLINE uint16_t WrapperClassId() const;
616
602
 
603
+ PersistentBase(const PersistentBase& other) = delete; // NOLINT
604
+ void operator=(const PersistentBase&) = delete;
605
+
617
606
  private:
618
607
  friend class Isolate;
619
608
  friend class Utils;
@@ -629,8 +618,6 @@ template <class T> class PersistentBase {
629
618
  friend class Object;
630
619
 
631
620
  explicit V8_INLINE PersistentBase(T* val) : val_(val) {}
632
- PersistentBase(const PersistentBase& other) = delete; // NOLINT
633
- void operator=(const PersistentBase&) = delete;
634
621
  V8_INLINE static T* New(Isolate* isolate, T* that);
635
622
 
636
623
  T* val_;
@@ -679,7 +666,7 @@ struct CopyablePersistentTraits {
679
666
  /**
680
667
  * A PersistentBase which allows copy and assignment.
681
668
  *
682
- * Copy, assignment and destructor bevavior is controlled by the traits
669
+ * Copy, assignment and destructor behavior is controlled by the traits
683
670
  * class M.
684
671
  *
685
672
  * Note: Persistent class hierarchy is subject to future changes.
@@ -743,17 +730,18 @@ template <class T, class M> class Persistent : public PersistentBase<T> {
743
730
 
744
731
  // TODO(dcarney): this is pretty useless, fix or remove
745
732
  template <class S>
746
- V8_INLINE static Persistent<T>& Cast(Persistent<S>& that) { // NOLINT
733
+ V8_INLINE static Persistent<T>& Cast(const Persistent<S>& that) { // NOLINT
747
734
  #ifdef V8_ENABLE_CHECKS
748
735
  // If we're going to perform the type check then we have to check
749
736
  // that the handle isn't empty before doing the checked cast.
750
737
  if (!that.IsEmpty()) T::Cast(*that);
751
738
  #endif
752
- return reinterpret_cast<Persistent<T>&>(that);
739
+ return reinterpret_cast<Persistent<T>&>(const_cast<Persistent<S>&>(that));
753
740
  }
754
741
 
755
742
  // TODO(dcarney): this is pretty useless, fix or remove
756
- template <class S> V8_INLINE Persistent<S>& As() { // NOLINT
743
+ template <class S>
744
+ V8_INLINE Persistent<S>& As() const { // NOLINT
757
745
  return Persistent<S>::Cast(*this);
758
746
  }
759
747
 
@@ -833,11 +821,12 @@ class Global : public PersistentBase<T> {
833
821
  */
834
822
  typedef void MoveOnlyTypeForCPP03;
835
823
 
824
+ Global(const Global&) = delete;
825
+ void operator=(const Global&) = delete;
826
+
836
827
  private:
837
828
  template <class F>
838
829
  friend class ReturnValue;
839
- Global(const Global&) = delete;
840
- void operator=(const Global&) = delete;
841
830
  V8_INLINE T* operator*() const { return this->val_; }
842
831
  };
843
832
 
@@ -876,6 +865,11 @@ class V8_EXPORT HandleScope {
876
865
  return reinterpret_cast<Isolate*>(isolate_);
877
866
  }
878
867
 
868
+ HandleScope(const HandleScope&) = delete;
869
+ void operator=(const HandleScope&) = delete;
870
+ void* operator new(size_t size);
871
+ void operator delete(void*, size_t);
872
+
879
873
  protected:
880
874
  V8_INLINE HandleScope() {}
881
875
 
@@ -889,13 +883,6 @@ class V8_EXPORT HandleScope {
889
883
  static internal::Object** CreateHandle(internal::HeapObject* heap_object,
890
884
  internal::Object* value);
891
885
 
892
- // Make it hard to create heap-allocated or illegal handle scopes by
893
- // disallowing certain operations.
894
- HandleScope(const HandleScope&);
895
- void operator=(const HandleScope&);
896
- void* operator new(size_t size);
897
- void operator delete(void*, size_t);
898
-
899
886
  internal::Isolate* isolate_;
900
887
  internal::Object** prev_next_;
901
888
  internal::Object** prev_limit_;
@@ -930,16 +917,13 @@ class V8_EXPORT EscapableHandleScope : public HandleScope {
930
917
  return Local<T>(reinterpret_cast<T*>(slot));
931
918
  }
932
919
 
933
- private:
934
- internal::Object** Escape(internal::Object** escape_value);
935
-
936
- // Make it hard to create heap-allocated or illegal handle scopes by
937
- // disallowing certain operations.
938
- EscapableHandleScope(const EscapableHandleScope&);
939
- void operator=(const EscapableHandleScope&);
920
+ EscapableHandleScope(const EscapableHandleScope&) = delete;
921
+ void operator=(const EscapableHandleScope&) = delete;
940
922
  void* operator new(size_t size);
941
923
  void operator delete(void*, size_t);
942
924
 
925
+ private:
926
+ internal::Object** Escape(internal::Object** escape_value);
943
927
  internal::Object** escape_slot_;
944
928
  };
945
929
 
@@ -948,15 +932,13 @@ class V8_EXPORT SealHandleScope {
948
932
  SealHandleScope(Isolate* isolate);
949
933
  ~SealHandleScope();
950
934
 
951
- private:
952
- // Make it hard to create heap-allocated or illegal handle scopes by
953
- // disallowing certain operations.
954
- SealHandleScope(const SealHandleScope&);
955
- void operator=(const SealHandleScope&);
935
+ SealHandleScope(const SealHandleScope&) = delete;
936
+ void operator=(const SealHandleScope&) = delete;
956
937
  void* operator new(size_t size);
957
938
  void operator delete(void*, size_t);
958
939
 
959
- internal::Isolate* isolate_;
940
+ private:
941
+ internal::Isolate* const isolate_;
960
942
  internal::Object** prev_limit_;
961
943
  int prev_sealed_level_;
962
944
  };
@@ -979,30 +961,21 @@ class V8_EXPORT Data {
979
961
  */
980
962
  class ScriptOriginOptions {
981
963
  public:
982
- V8_INLINE ScriptOriginOptions(bool is_embedder_debug_script = false,
983
- bool is_shared_cross_origin = false,
984
- bool is_opaque = false)
985
- : flags_((is_embedder_debug_script ? kIsEmbedderDebugScript : 0) |
986
- (is_shared_cross_origin ? kIsSharedCrossOrigin : 0) |
987
- (is_opaque ? kIsOpaque : 0)) {}
964
+ V8_INLINE ScriptOriginOptions(bool is_shared_cross_origin = false,
965
+ bool is_opaque = false, bool is_wasm = false)
966
+ : flags_((is_shared_cross_origin ? kIsSharedCrossOrigin : 0) |
967
+ (is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0)) {}
988
968
  V8_INLINE ScriptOriginOptions(int flags)
989
- : flags_(flags &
990
- (kIsEmbedderDebugScript | kIsSharedCrossOrigin | kIsOpaque)) {}
991
- bool IsEmbedderDebugScript() const {
992
- return (flags_ & kIsEmbedderDebugScript) != 0;
993
- }
969
+ : flags_(flags & (kIsSharedCrossOrigin | kIsOpaque | kIsWasm)) {}
994
970
  bool IsSharedCrossOrigin() const {
995
971
  return (flags_ & kIsSharedCrossOrigin) != 0;
996
972
  }
997
973
  bool IsOpaque() const { return (flags_ & kIsOpaque) != 0; }
974
+ bool IsWasm() const { return (flags_ & kIsWasm) != 0; }
998
975
  int Flags() const { return flags_; }
999
976
 
1000
977
  private:
1001
- enum {
1002
- kIsEmbedderDebugScript = 1,
1003
- kIsSharedCrossOrigin = 1 << 1,
1004
- kIsOpaque = 1 << 2
1005
- };
978
+ enum { kIsSharedCrossOrigin = 1, kIsOpaque = 1 << 1, kIsWasm = 1 << 2 };
1006
979
  const int flags_;
1007
980
  };
1008
981
 
@@ -1017,9 +990,10 @@ class ScriptOrigin {
1017
990
  Local<Integer> resource_column_offset = Local<Integer>(),
1018
991
  Local<Boolean> resource_is_shared_cross_origin = Local<Boolean>(),
1019
992
  Local<Integer> script_id = Local<Integer>(),
1020
- Local<Boolean> resource_is_embedder_debug_script = Local<Boolean>(),
1021
993
  Local<Value> source_map_url = Local<Value>(),
1022
- Local<Boolean> resource_is_opaque = Local<Boolean>());
994
+ Local<Boolean> resource_is_opaque = Local<Boolean>(),
995
+ Local<Boolean> is_wasm = Local<Boolean>());
996
+
1023
997
  V8_INLINE Local<Value> ResourceName() const;
1024
998
  V8_INLINE Local<Integer> ResourceLineOffset() const;
1025
999
  V8_INLINE Local<Integer> ResourceColumnOffset() const;
@@ -1071,6 +1045,47 @@ class V8_EXPORT UnboundScript {
1071
1045
  static const int kNoScriptId = 0;
1072
1046
  };
1073
1047
 
1048
+ /**
1049
+ * This is an unfinished experimental feature, and is only exposed
1050
+ * here for internal testing purposes. DO NOT USE.
1051
+ *
1052
+ * A compiled JavaScript module.
1053
+ */
1054
+ class V8_EXPORT Module {
1055
+ public:
1056
+ /**
1057
+ * Returns the number of modules requested by this module.
1058
+ */
1059
+ int GetModuleRequestsLength() const;
1060
+
1061
+ /**
1062
+ * Returns the ith module specifier in this module.
1063
+ * i must be < GetModuleRequestsLength() and >= 0.
1064
+ */
1065
+ Local<String> GetModuleRequest(int i) const;
1066
+
1067
+ /**
1068
+ * Returns the identity hash for this object.
1069
+ */
1070
+ int GetIdentityHash() const;
1071
+
1072
+ typedef MaybeLocal<Module> (*ResolveCallback)(Local<Context> context,
1073
+ Local<String> specifier,
1074
+ Local<Module> referrer);
1075
+
1076
+ /**
1077
+ * ModuleDeclarationInstantiation
1078
+ *
1079
+ * Returns false if an exception occurred during instantiation.
1080
+ */
1081
+ V8_WARN_UNUSED_RESULT bool Instantiate(Local<Context> context,
1082
+ ResolveCallback callback);
1083
+
1084
+ /**
1085
+ * ModuleEvaluation
1086
+ */
1087
+ V8_WARN_UNUSED_RESULT MaybeLocal<Value> Evaluate(Local<Context> context);
1088
+ };
1074
1089
 
1075
1090
  /**
1076
1091
  * A compiled JavaScript script, tied to a Context which was active when the
@@ -1146,10 +1161,9 @@ class V8_EXPORT ScriptCompiler {
1146
1161
  bool rejected;
1147
1162
  BufferPolicy buffer_policy;
1148
1163
 
1149
- private:
1150
- // Prevent copying. Not implemented.
1151
- CachedData(const CachedData&);
1152
- CachedData& operator=(const CachedData&);
1164
+ // Prevent copying.
1165
+ CachedData(const CachedData&) = delete;
1166
+ CachedData& operator=(const CachedData&) = delete;
1153
1167
  };
1154
1168
 
1155
1169
  /**
@@ -1169,11 +1183,12 @@ class V8_EXPORT ScriptCompiler {
1169
1183
  // alive.
1170
1184
  V8_INLINE const CachedData* GetCachedData() const;
1171
1185
 
1186
+ // Prevent copying.
1187
+ Source(const Source&) = delete;
1188
+ Source& operator=(const Source&) = delete;
1189
+
1172
1190
  private:
1173
1191
  friend class ScriptCompiler;
1174
- // Prevent copying. Not implemented.
1175
- Source(const Source&);
1176
- Source& operator=(const Source&);
1177
1192
 
1178
1193
  Local<String> source_string;
1179
1194
 
@@ -1256,11 +1271,11 @@ class V8_EXPORT ScriptCompiler {
1256
1271
 
1257
1272
  internal::StreamedSource* impl() const { return impl_; }
1258
1273
 
1259
- private:
1260
- // Prevent copying. Not implemented.
1261
- StreamedSource(const StreamedSource&);
1262
- StreamedSource& operator=(const StreamedSource&);
1274
+ // Prevent copying.
1275
+ StreamedSource(const StreamedSource&) = delete;
1276
+ StreamedSource& operator=(const StreamedSource&) = delete;
1263
1277
 
1278
+ private:
1264
1279
  internal::StreamedSource* impl_;
1265
1280
  };
1266
1281
 
@@ -1374,18 +1389,17 @@ class V8_EXPORT ScriptCompiler {
1374
1389
  static uint32_t CachedDataVersionTag();
1375
1390
 
1376
1391
  /**
1377
- * Compile an ES6 module.
1378
- *
1379
1392
  * This is an unfinished experimental feature, and is only exposed
1380
- * here for internal testing purposes.
1381
- * Only parsing works at the moment. Do not use.
1393
+ * here for internal testing purposes. DO NOT USE.
1394
+ *
1395
+ * Compile an ES module, returning a Module that encapsulates
1396
+ * the compiled code.
1382
1397
  *
1383
- * TODO(adamk): Script is likely the wrong return value for this;
1384
- * should return some new Module type.
1398
+ * Corresponds to the ParseModule abstract operation in the
1399
+ * ECMAScript specification.
1385
1400
  */
1386
- static V8_WARN_UNUSED_RESULT MaybeLocal<Script> CompileModule(
1387
- Local<Context> context, Source* source,
1388
- CompileOptions options = kNoCompileOptions);
1401
+ static V8_WARN_UNUSED_RESULT MaybeLocal<Module> CompileModule(
1402
+ Isolate* isolate, Source* source);
1389
1403
 
1390
1404
  /**
1391
1405
  * Compile a function for a given context. This is equivalent to running
@@ -1463,6 +1477,11 @@ class V8_EXPORT Message {
1463
1477
  */
1464
1478
  int GetEndPosition() const;
1465
1479
 
1480
+ /**
1481
+ * Returns the error level of the message.
1482
+ */
1483
+ int ErrorLevel() const;
1484
+
1466
1485
  /**
1467
1486
  * Returns the index within the line of the first character where
1468
1487
  * the error occurred.
@@ -1662,6 +1681,210 @@ class V8_EXPORT JSON {
1662
1681
  Local<String> gap = Local<String>());
1663
1682
  };
1664
1683
 
1684
+ /**
1685
+ * Value serialization compatible with the HTML structured clone algorithm.
1686
+ * The format is backward-compatible (i.e. safe to store to disk).
1687
+ *
1688
+ * WARNING: This API is under development, and changes (including incompatible
1689
+ * changes to the API or wire format) may occur without notice until this
1690
+ * warning is removed.
1691
+ */
1692
+ class V8_EXPORT ValueSerializer {
1693
+ public:
1694
+ class V8_EXPORT Delegate {
1695
+ public:
1696
+ virtual ~Delegate() {}
1697
+
1698
+ /*
1699
+ * Handles the case where a DataCloneError would be thrown in the structured
1700
+ * clone spec. Other V8 embedders may throw some other appropriate exception
1701
+ * type.
1702
+ */
1703
+ virtual void ThrowDataCloneError(Local<String> message) = 0;
1704
+
1705
+ /*
1706
+ * The embedder overrides this method to write some kind of host object, if
1707
+ * possible. If not, a suitable exception should be thrown and
1708
+ * Nothing<bool>() returned.
1709
+ */
1710
+ virtual Maybe<bool> WriteHostObject(Isolate* isolate, Local<Object> object);
1711
+
1712
+ /*
1713
+ * Called when the ValueSerializer is going to serialize a
1714
+ * SharedArrayBuffer object. The embedder must return an ID for the
1715
+ * object, using the same ID if this SharedArrayBuffer has already been
1716
+ * serialized in this buffer. When deserializing, this ID will be passed to
1717
+ * ValueDeserializer::TransferSharedArrayBuffer as |transfer_id|.
1718
+ *
1719
+ * If the object cannot be serialized, an
1720
+ * exception should be thrown and Nothing<uint32_t>() returned.
1721
+ */
1722
+ virtual Maybe<uint32_t> GetSharedArrayBufferId(
1723
+ Isolate* isolate, Local<SharedArrayBuffer> shared_array_buffer);
1724
+
1725
+ /*
1726
+ * Allocates memory for the buffer of at least the size provided. The actual
1727
+ * size (which may be greater or equal) is written to |actual_size|. If no
1728
+ * buffer has been allocated yet, nullptr will be provided.
1729
+ */
1730
+ virtual void* ReallocateBufferMemory(void* old_buffer, size_t size,
1731
+ size_t* actual_size);
1732
+
1733
+ /*
1734
+ * Frees a buffer allocated with |ReallocateBufferMemory|.
1735
+ */
1736
+ virtual void FreeBufferMemory(void* buffer);
1737
+ };
1738
+
1739
+ explicit ValueSerializer(Isolate* isolate);
1740
+ ValueSerializer(Isolate* isolate, Delegate* delegate);
1741
+ ~ValueSerializer();
1742
+
1743
+ /*
1744
+ * Writes out a header, which includes the format version.
1745
+ */
1746
+ void WriteHeader();
1747
+
1748
+ /*
1749
+ * Serializes a JavaScript value into the buffer.
1750
+ */
1751
+ V8_WARN_UNUSED_RESULT Maybe<bool> WriteValue(Local<Context> context,
1752
+ Local<Value> value);
1753
+
1754
+ /*
1755
+ * Returns the stored data. This serializer should not be used once the buffer
1756
+ * is released. The contents are undefined if a previous write has failed.
1757
+ */
1758
+ V8_DEPRECATE_SOON("Use Release()", std::vector<uint8_t> ReleaseBuffer());
1759
+
1760
+ /*
1761
+ * Returns the stored data (allocated using the delegate's
1762
+ * AllocateBufferMemory) and its size. This serializer should not be used once
1763
+ * the buffer is released. The contents are undefined if a previous write has
1764
+ * failed.
1765
+ */
1766
+ V8_WARN_UNUSED_RESULT std::pair<uint8_t*, size_t> Release();
1767
+
1768
+ /*
1769
+ * Marks an ArrayBuffer as havings its contents transferred out of band.
1770
+ * Pass the corresponding JSArrayBuffer in the deserializing context to
1771
+ * ValueDeserializer::TransferArrayBuffer.
1772
+ */
1773
+ void TransferArrayBuffer(uint32_t transfer_id,
1774
+ Local<ArrayBuffer> array_buffer);
1775
+
1776
+ /*
1777
+ * Similar to TransferArrayBuffer, but for SharedArrayBuffer.
1778
+ */
1779
+ V8_DEPRECATE_SOON("Use Delegate::GetSharedArrayBufferId",
1780
+ void TransferSharedArrayBuffer(
1781
+ uint32_t transfer_id,
1782
+ Local<SharedArrayBuffer> shared_array_buffer));
1783
+
1784
+ /*
1785
+ * Write raw data in various common formats to the buffer.
1786
+ * Note that integer types are written in base-128 varint format, not with a
1787
+ * binary copy. For use during an override of Delegate::WriteHostObject.
1788
+ */
1789
+ void WriteUint32(uint32_t value);
1790
+ void WriteUint64(uint64_t value);
1791
+ void WriteDouble(double value);
1792
+ void WriteRawBytes(const void* source, size_t length);
1793
+
1794
+ private:
1795
+ ValueSerializer(const ValueSerializer&) = delete;
1796
+ void operator=(const ValueSerializer&) = delete;
1797
+
1798
+ struct PrivateData;
1799
+ PrivateData* private_;
1800
+ };
1801
+
1802
+ /**
1803
+ * Deserializes values from data written with ValueSerializer, or a compatible
1804
+ * implementation.
1805
+ *
1806
+ * WARNING: This API is under development, and changes (including incompatible
1807
+ * changes to the API or wire format) may occur without notice until this
1808
+ * warning is removed.
1809
+ */
1810
+ class V8_EXPORT ValueDeserializer {
1811
+ public:
1812
+ class V8_EXPORT Delegate {
1813
+ public:
1814
+ virtual ~Delegate() {}
1815
+
1816
+ /*
1817
+ * The embedder overrides this method to read some kind of host object, if
1818
+ * possible. If not, a suitable exception should be thrown and
1819
+ * MaybeLocal<Object>() returned.
1820
+ */
1821
+ virtual MaybeLocal<Object> ReadHostObject(Isolate* isolate);
1822
+ };
1823
+
1824
+ ValueDeserializer(Isolate* isolate, const uint8_t* data, size_t size);
1825
+ ValueDeserializer(Isolate* isolate, const uint8_t* data, size_t size,
1826
+ Delegate* delegate);
1827
+ ~ValueDeserializer();
1828
+
1829
+ /*
1830
+ * Reads and validates a header (including the format version).
1831
+ * May, for example, reject an invalid or unsupported wire format.
1832
+ */
1833
+ V8_WARN_UNUSED_RESULT Maybe<bool> ReadHeader(Local<Context> context);
1834
+
1835
+ /*
1836
+ * Deserializes a JavaScript value from the buffer.
1837
+ */
1838
+ V8_WARN_UNUSED_RESULT MaybeLocal<Value> ReadValue(Local<Context> context);
1839
+
1840
+ /*
1841
+ * Accepts the array buffer corresponding to the one passed previously to
1842
+ * ValueSerializer::TransferArrayBuffer.
1843
+ */
1844
+ void TransferArrayBuffer(uint32_t transfer_id,
1845
+ Local<ArrayBuffer> array_buffer);
1846
+
1847
+ /*
1848
+ * Similar to TransferArrayBuffer, but for SharedArrayBuffer.
1849
+ * The id is not necessarily in the same namespace as unshared ArrayBuffer
1850
+ * objects.
1851
+ */
1852
+ void TransferSharedArrayBuffer(uint32_t id,
1853
+ Local<SharedArrayBuffer> shared_array_buffer);
1854
+
1855
+ /*
1856
+ * Must be called before ReadHeader to enable support for reading the legacy
1857
+ * wire format (i.e., which predates this being shipped).
1858
+ *
1859
+ * Don't use this unless you need to read data written by previous versions of
1860
+ * blink::ScriptValueSerializer.
1861
+ */
1862
+ void SetSupportsLegacyWireFormat(bool supports_legacy_wire_format);
1863
+
1864
+ /*
1865
+ * Reads the underlying wire format version. Likely mostly to be useful to
1866
+ * legacy code reading old wire format versions. Must be called after
1867
+ * ReadHeader.
1868
+ */
1869
+ uint32_t GetWireFormatVersion() const;
1870
+
1871
+ /*
1872
+ * Reads raw data in various common formats to the buffer.
1873
+ * Note that integer types are read in base-128 varint format, not with a
1874
+ * binary copy. For use during an override of Delegate::ReadHostObject.
1875
+ */
1876
+ V8_WARN_UNUSED_RESULT bool ReadUint32(uint32_t* value);
1877
+ V8_WARN_UNUSED_RESULT bool ReadUint64(uint64_t* value);
1878
+ V8_WARN_UNUSED_RESULT bool ReadDouble(double* value);
1879
+ V8_WARN_UNUSED_RESULT bool ReadRawBytes(size_t length, const void** data);
1880
+
1881
+ private:
1882
+ ValueDeserializer(const ValueDeserializer&) = delete;
1883
+ void operator=(const ValueDeserializer&) = delete;
1884
+
1885
+ struct PrivateData;
1886
+ PrivateData* private_;
1887
+ };
1665
1888
 
1666
1889
  /**
1667
1890
  * A map whose keys are referenced weakly. It is similar to JavaScript WeakMap
@@ -1698,9 +1921,16 @@ class V8_EXPORT Value : public Data {
1698
1921
  */
1699
1922
  V8_INLINE bool IsNull() const;
1700
1923
 
1701
- /**
1702
- * Returns true if this value is true.
1924
+ /**
1925
+ * Returns true if this value is either the null or the undefined value.
1926
+ * See ECMA-262
1927
+ * 4.3.11. and 4.3.12
1703
1928
  */
1929
+ V8_INLINE bool IsNullOrUndefined() const;
1930
+
1931
+ /**
1932
+ * Returns true if this value is true.
1933
+ */
1704
1934
  bool IsTrue() const;
1705
1935
 
1706
1936
  /**
@@ -1710,7 +1940,6 @@ class V8_EXPORT Value : public Data {
1710
1940
 
1711
1941
  /**
1712
1942
  * Returns true if this value is a symbol or a string.
1713
- * This is an experimental feature.
1714
1943
  */
1715
1944
  bool IsName() const;
1716
1945
 
@@ -1722,7 +1951,6 @@ class V8_EXPORT Value : public Data {
1722
1951
 
1723
1952
  /**
1724
1953
  * Returns true if this value is a symbol.
1725
- * This is an experimental feature.
1726
1954
  */
1727
1955
  bool IsSymbol() const;
1728
1956
 
@@ -1794,7 +2022,6 @@ class V8_EXPORT Value : public Data {
1794
2022
 
1795
2023
  /**
1796
2024
  * Returns true if this value is a Symbol object.
1797
- * This is an experimental feature.
1798
2025
  */
1799
2026
  bool IsSymbolObject() const;
1800
2027
 
@@ -1808,21 +2035,23 @@ class V8_EXPORT Value : public Data {
1808
2035
  */
1809
2036
  bool IsRegExp() const;
1810
2037
 
2038
+ /**
2039
+ * Returns true if this value is an async function.
2040
+ */
2041
+ bool IsAsyncFunction() const;
2042
+
1811
2043
  /**
1812
2044
  * Returns true if this value is a Generator function.
1813
- * This is an experimental feature.
1814
2045
  */
1815
2046
  bool IsGeneratorFunction() const;
1816
2047
 
1817
2048
  /**
1818
2049
  * Returns true if this value is a Generator object (iterator).
1819
- * This is an experimental feature.
1820
2050
  */
1821
2051
  bool IsGeneratorObject() const;
1822
2052
 
1823
2053
  /**
1824
2054
  * Returns true if this value is a Promise.
1825
- * This is an experimental feature.
1826
2055
  */
1827
2056
  bool IsPromise() const;
1828
2057
 
@@ -1858,73 +2087,61 @@ class V8_EXPORT Value : public Data {
1858
2087
 
1859
2088
  /**
1860
2089
  * Returns true if this value is an ArrayBuffer.
1861
- * This is an experimental feature.
1862
2090
  */
1863
2091
  bool IsArrayBuffer() const;
1864
2092
 
1865
2093
  /**
1866
2094
  * Returns true if this value is an ArrayBufferView.
1867
- * This is an experimental feature.
1868
2095
  */
1869
2096
  bool IsArrayBufferView() const;
1870
2097
 
1871
2098
  /**
1872
2099
  * Returns true if this value is one of TypedArrays.
1873
- * This is an experimental feature.
1874
2100
  */
1875
2101
  bool IsTypedArray() const;
1876
2102
 
1877
2103
  /**
1878
2104
  * Returns true if this value is an Uint8Array.
1879
- * This is an experimental feature.
1880
2105
  */
1881
2106
  bool IsUint8Array() const;
1882
2107
 
1883
2108
  /**
1884
2109
  * Returns true if this value is an Uint8ClampedArray.
1885
- * This is an experimental feature.
1886
2110
  */
1887
2111
  bool IsUint8ClampedArray() const;
1888
2112
 
1889
2113
  /**
1890
2114
  * Returns true if this value is an Int8Array.
1891
- * This is an experimental feature.
1892
2115
  */
1893
2116
  bool IsInt8Array() const;
1894
2117
 
1895
2118
  /**
1896
2119
  * Returns true if this value is an Uint16Array.
1897
- * This is an experimental feature.
1898
2120
  */
1899
2121
  bool IsUint16Array() const;
1900
2122
 
1901
2123
  /**
1902
2124
  * Returns true if this value is an Int16Array.
1903
- * This is an experimental feature.
1904
2125
  */
1905
2126
  bool IsInt16Array() const;
1906
2127
 
1907
2128
  /**
1908
2129
  * Returns true if this value is an Uint32Array.
1909
- * This is an experimental feature.
1910
2130
  */
1911
2131
  bool IsUint32Array() const;
1912
2132
 
1913
2133
  /**
1914
2134
  * Returns true if this value is an Int32Array.
1915
- * This is an experimental feature.
1916
2135
  */
1917
2136
  bool IsInt32Array() const;
1918
2137
 
1919
2138
  /**
1920
2139
  * Returns true if this value is a Float32Array.
1921
- * This is an experimental feature.
1922
2140
  */
1923
2141
  bool IsFloat32Array() const;
1924
2142
 
1925
2143
  /**
1926
2144
  * Returns true if this value is a Float64Array.
1927
- * This is an experimental feature.
1928
2145
  */
1929
2146
  bool IsFloat64Array() const;
1930
2147
 
@@ -1936,7 +2153,6 @@ class V8_EXPORT Value : public Data {
1936
2153
 
1937
2154
  /**
1938
2155
  * Returns true if this value is a DataView.
1939
- * This is an experimental feature.
1940
2156
  */
1941
2157
  bool IsDataView() const;
1942
2158
 
@@ -1951,6 +2167,7 @@ class V8_EXPORT Value : public Data {
1951
2167
  */
1952
2168
  bool IsProxy() const;
1953
2169
 
2170
+ bool IsWebAssemblyCompiledModule() const;
1954
2171
 
1955
2172
  V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean(
1956
2173
  Local<Context> context) const;
@@ -2028,11 +2245,12 @@ class V8_EXPORT Value : public Data {
2028
2245
 
2029
2246
  template <class T> V8_INLINE static Value* Cast(T* value);
2030
2247
 
2031
- Local<String> TypeOf(v8::Isolate*);
2248
+ Local<String> TypeOf(Isolate*);
2032
2249
 
2033
2250
  private:
2034
2251
  V8_INLINE bool QuickIsUndefined() const;
2035
2252
  V8_INLINE bool QuickIsNull() const;
2253
+ V8_INLINE bool QuickIsNullOrUndefined() const;
2036
2254
  V8_INLINE bool QuickIsString() const;
2037
2255
  bool FullIsUndefined() const;
2038
2256
  bool FullIsNull() const;
@@ -2075,9 +2293,10 @@ class V8_EXPORT Name : public Primitive {
2075
2293
  */
2076
2294
  int GetIdentityHash();
2077
2295
 
2078
- V8_INLINE static Name* Cast(v8::Value* obj);
2296
+ V8_INLINE static Name* Cast(Value* obj);
2297
+
2079
2298
  private:
2080
- static void CheckCast(v8::Value* obj);
2299
+ static void CheckCast(Value* obj);
2081
2300
  };
2082
2301
 
2083
2302
 
@@ -2175,7 +2394,7 @@ class V8_EXPORT String : public Name {
2175
2394
  /**
2176
2395
  * A zero length string.
2177
2396
  */
2178
- V8_INLINE static v8::Local<v8::String> Empty(Isolate* isolate);
2397
+ V8_INLINE static Local<String> Empty(Isolate* isolate);
2179
2398
 
2180
2399
  /**
2181
2400
  * Returns true if the string is external
@@ -2204,12 +2423,12 @@ class V8_EXPORT String : public Name {
2204
2423
  */
2205
2424
  virtual void Dispose() { delete this; }
2206
2425
 
2207
- private:
2208
2426
  // Disallow copying and assigning.
2209
- ExternalStringResourceBase(const ExternalStringResourceBase&);
2210
- void operator=(const ExternalStringResourceBase&);
2427
+ ExternalStringResourceBase(const ExternalStringResourceBase&) = delete;
2428
+ void operator=(const ExternalStringResourceBase&) = delete;
2211
2429
 
2212
- friend class v8::internal::Heap;
2430
+ private:
2431
+ friend class internal::Heap;
2213
2432
  };
2214
2433
 
2215
2434
  /**
@@ -2410,13 +2629,14 @@ class V8_EXPORT String : public Name {
2410
2629
  char* operator*() { return str_; }
2411
2630
  const char* operator*() const { return str_; }
2412
2631
  int length() const { return length_; }
2632
+
2633
+ // Disallow copying and assigning.
2634
+ Utf8Value(const Utf8Value&) = delete;
2635
+ void operator=(const Utf8Value&) = delete;
2636
+
2413
2637
  private:
2414
2638
  char* str_;
2415
2639
  int length_;
2416
-
2417
- // Disallow copying and assigning.
2418
- Utf8Value(const Utf8Value&);
2419
- void operator=(const Utf8Value&);
2420
2640
  };
2421
2641
 
2422
2642
  /**
@@ -2432,13 +2652,14 @@ class V8_EXPORT String : public Name {
2432
2652
  uint16_t* operator*() { return str_; }
2433
2653
  const uint16_t* operator*() const { return str_; }
2434
2654
  int length() const { return length_; }
2655
+
2656
+ // Disallow copying and assigning.
2657
+ Value(const Value&) = delete;
2658
+ void operator=(const Value&) = delete;
2659
+
2435
2660
  private:
2436
2661
  uint16_t* str_;
2437
2662
  int length_;
2438
-
2439
- // Disallow copying and assigning.
2440
- Value(const Value&);
2441
- void operator=(const Value&);
2442
2663
  };
2443
2664
 
2444
2665
  private:
@@ -2451,8 +2672,6 @@ class V8_EXPORT String : public Name {
2451
2672
 
2452
2673
  /**
2453
2674
  * A JavaScript symbol (ECMA-262 edition 6)
2454
- *
2455
- * This is an experimental feature. Use at your own risk.
2456
2675
  */
2457
2676
  class V8_EXPORT Symbol : public Name {
2458
2677
  public:
@@ -2477,14 +2696,15 @@ class V8_EXPORT Symbol : public Name {
2477
2696
  // Well-known symbols
2478
2697
  static Local<Symbol> GetIterator(Isolate* isolate);
2479
2698
  static Local<Symbol> GetUnscopables(Isolate* isolate);
2699
+ static Local<Symbol> GetToPrimitive(Isolate* isolate);
2480
2700
  static Local<Symbol> GetToStringTag(Isolate* isolate);
2481
2701
  static Local<Symbol> GetIsConcatSpreadable(Isolate* isolate);
2482
2702
 
2483
- V8_INLINE static Symbol* Cast(v8::Value* obj);
2703
+ V8_INLINE static Symbol* Cast(Value* obj);
2484
2704
 
2485
2705
  private:
2486
2706
  Symbol();
2487
- static void CheckCast(v8::Value* obj);
2707
+ static void CheckCast(Value* obj);
2488
2708
  };
2489
2709
 
2490
2710
 
@@ -2572,11 +2792,17 @@ class V8_EXPORT Uint32 : public Integer {
2572
2792
  static void CheckCast(v8::Value* obj);
2573
2793
  };
2574
2794
 
2575
-
2795
+ /**
2796
+ * PropertyAttribute.
2797
+ */
2576
2798
  enum PropertyAttribute {
2577
- None = 0,
2578
- ReadOnly = 1 << 0,
2579
- DontEnum = 1 << 1,
2799
+ /** None. **/
2800
+ None = 0,
2801
+ /** ReadOnly, i.e., not writable. **/
2802
+ ReadOnly = 1 << 0,
2803
+ /** DontEnum, i.e., not enumerable. **/
2804
+ DontEnum = 1 << 1,
2805
+ /** DontDelete, i.e., not configurable. **/
2580
2806
  DontDelete = 1 << 2
2581
2807
  };
2582
2808
 
@@ -2690,6 +2916,22 @@ class V8_EXPORT Object : public Value {
2690
2916
  Local<Context> context, Local<Name> key, Local<Value> value,
2691
2917
  PropertyAttribute attributes = None);
2692
2918
 
2919
+ // Implements Object.DefineProperty(O, P, Attributes), see Ecma-262 19.1.2.4.
2920
+ //
2921
+ // The defineProperty function is used to add an own property or
2922
+ // update the attributes of an existing own property of an object.
2923
+ //
2924
+ // Both data and accessor descriptors can be used.
2925
+ //
2926
+ // In general, CreateDataProperty is faster, however, does not allow
2927
+ // for specifying attributes or an accessor descriptor.
2928
+ //
2929
+ // The PropertyDescriptor can change when redefining a property.
2930
+ //
2931
+ // Returns true on success.
2932
+ V8_WARN_UNUSED_RESULT Maybe<bool> DefineProperty(
2933
+ Local<Context> context, Local<Name> key, PropertyDescriptor& descriptor);
2934
+
2693
2935
  // Sets an own property on this object bypassing interceptors and
2694
2936
  // overriding accessors or read-only properties.
2695
2937
  //
@@ -2733,6 +2975,21 @@ class V8_EXPORT Object : public Value {
2733
2975
  Local<Context> context, Local<String> key);
2734
2976
 
2735
2977
  V8_DEPRECATE_SOON("Use maybe version", bool Has(Local<Value> key));
2978
+ /**
2979
+ * Object::Has() calls the abstract operation HasProperty(O, P) described
2980
+ * in ECMA-262, 7.3.10. Has() returns
2981
+ * true, if the object has the property, either own or on the prototype chain.
2982
+ * Interceptors, i.e., PropertyQueryCallbacks, are called if present.
2983
+ *
2984
+ * Has() has the same side effects as JavaScript's `variable in object`.
2985
+ * For example, calling Has() on a revoked proxy will throw an exception.
2986
+ *
2987
+ * \note Has() converts the key to a name, which possibly calls back into
2988
+ * JavaScript.
2989
+ *
2990
+ * See also v8::Object::HasOwnProperty() and
2991
+ * v8::Object::HasRealNamedProperty().
2992
+ */
2736
2993
  V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context,
2737
2994
  Local<Value> key);
2738
2995
 
@@ -2892,15 +3149,36 @@ class V8_EXPORT Object : public Value {
2892
3149
  * leads to undefined behavior.
2893
3150
  */
2894
3151
  void SetAlignedPointerInInternalField(int index, void* value);
3152
+ void SetAlignedPointerInInternalFields(int argc, int indices[],
3153
+ void* values[]);
2895
3154
 
2896
3155
  // Testers for local properties.
2897
3156
  V8_DEPRECATED("Use maybe version", bool HasOwnProperty(Local<String> key));
3157
+
3158
+ /**
3159
+ * HasOwnProperty() is like JavaScript's Object.prototype.hasOwnProperty().
3160
+ *
3161
+ * See also v8::Object::Has() and v8::Object::HasRealNamedProperty().
3162
+ */
2898
3163
  V8_WARN_UNUSED_RESULT Maybe<bool> HasOwnProperty(Local<Context> context,
2899
3164
  Local<Name> key);
2900
3165
  V8_WARN_UNUSED_RESULT Maybe<bool> HasOwnProperty(Local<Context> context,
2901
3166
  uint32_t index);
2902
3167
  V8_DEPRECATE_SOON("Use maybe version",
2903
3168
  bool HasRealNamedProperty(Local<String> key));
3169
+ /**
3170
+ * Use HasRealNamedProperty() if you want to check if an object has an own
3171
+ * property without causing side effects, i.e., without calling interceptors.
3172
+ *
3173
+ * This function is similar to v8::Object::HasOwnProperty(), but it does not
3174
+ * call interceptors.
3175
+ *
3176
+ * \note Consider using non-masking interceptors, i.e., the interceptors are
3177
+ * not called if the receiver has the real named property. See
3178
+ * `v8::PropertyHandlerFlags::kNonMasking`.
3179
+ *
3180
+ * See also v8::Object::Has().
3181
+ */
2904
3182
  V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedProperty(Local<Context> context,
2905
3183
  Local<Name> key);
2906
3184
  V8_DEPRECATE_SOON("Use maybe version",
@@ -2983,6 +3261,12 @@ class V8_EXPORT Object : public Value {
2983
3261
  */
2984
3262
  Local<Context> CreationContext();
2985
3263
 
3264
+ /** Same as above, but works for Persistents */
3265
+ V8_INLINE static Local<Context> CreationContext(
3266
+ const PersistentBase<Object>& object) {
3267
+ return object.val_->CreationContext();
3268
+ }
3269
+
2986
3270
  /**
2987
3271
  * Checks whether a callback is set by the
2988
3272
  * ObjectTemplate::SetCallAsFunctionHandler method.
@@ -3231,12 +3515,91 @@ class FunctionCallbackInfo {
3231
3515
  template<typename T>
3232
3516
  class PropertyCallbackInfo {
3233
3517
  public:
3518
+ /**
3519
+ * \return The isolate of the property access.
3520
+ */
3234
3521
  V8_INLINE Isolate* GetIsolate() const;
3522
+
3523
+ /**
3524
+ * \return The data set in the configuration, i.e., in
3525
+ * `NamedPropertyHandlerConfiguration` or
3526
+ * `IndexedPropertyHandlerConfiguration.`
3527
+ */
3235
3528
  V8_INLINE Local<Value> Data() const;
3529
+
3530
+ /**
3531
+ * \return The receiver. In many cases, this is the object on which the
3532
+ * property access was intercepted. When using
3533
+ * `Reflect.get`, `Function.prototype.call`, or similar functions, it is the
3534
+ * object passed in as receiver or thisArg.
3535
+ *
3536
+ * \code
3537
+ * void GetterCallback(Local<Name> name,
3538
+ * const v8::PropertyCallbackInfo<v8::Value>& info) {
3539
+ * auto context = info.GetIsolate()->GetCurrentContext();
3540
+ *
3541
+ * v8::Local<v8::Value> a_this =
3542
+ * info.This()
3543
+ * ->GetRealNamedProperty(context, v8_str("a"))
3544
+ * .ToLocalChecked();
3545
+ * v8::Local<v8::Value> a_holder =
3546
+ * info.Holder()
3547
+ * ->GetRealNamedProperty(context, v8_str("a"))
3548
+ * .ToLocalChecked();
3549
+ *
3550
+ * CHECK(v8_str("r")->Equals(context, a_this).FromJust());
3551
+ * CHECK(v8_str("obj")->Equals(context, a_holder).FromJust());
3552
+ *
3553
+ * info.GetReturnValue().Set(name);
3554
+ * }
3555
+ *
3556
+ * v8::Local<v8::FunctionTemplate> templ =
3557
+ * v8::FunctionTemplate::New(isolate);
3558
+ * templ->InstanceTemplate()->SetHandler(
3559
+ * v8::NamedPropertyHandlerConfiguration(GetterCallback));
3560
+ * LocalContext env;
3561
+ * env->Global()
3562
+ * ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local())
3563
+ * .ToLocalChecked()
3564
+ * ->NewInstance(env.local())
3565
+ * .ToLocalChecked())
3566
+ * .FromJust();
3567
+ *
3568
+ * CompileRun("obj.a = 'obj'; var r = {a: 'r'}; Reflect.get(obj, 'x', r)");
3569
+ * \endcode
3570
+ */
3236
3571
  V8_INLINE Local<Object> This() const;
3572
+
3573
+ /**
3574
+ * \return The object in the prototype chain of the receiver that has the
3575
+ * interceptor. Suppose you have `x` and its prototype is `y`, and `y`
3576
+ * has an interceptor. Then `info.This()` is `x` and `info.Holder()` is `y`.
3577
+ * The Holder() could be a hidden object (the global object, rather
3578
+ * than the global proxy).
3579
+ *
3580
+ * \note For security reasons, do not pass the object back into the runtime.
3581
+ */
3237
3582
  V8_INLINE Local<Object> Holder() const;
3583
+
3584
+ /**
3585
+ * \return The return value of the callback.
3586
+ * Can be changed by calling Set().
3587
+ * \code
3588
+ * info.GetReturnValue().Set(...)
3589
+ * \endcode
3590
+ *
3591
+ */
3238
3592
  V8_INLINE ReturnValue<T> GetReturnValue() const;
3593
+
3594
+ /**
3595
+ * \return True if the intercepted function should throw if an error occurs.
3596
+ * Usually, `true` corresponds to `'use strict'`.
3597
+ *
3598
+ * \note Always `false` when intercepting `Reflect.set()`
3599
+ * independent of the language mode.
3600
+ */
3239
3601
  V8_INLINE bool ShouldThrowOnError() const;
3602
+
3240
3603
  // This shouldn't be public, but the arm compiler needs it.
3241
3604
  static const int kArgsLength = 7;
3242
3605
 
@@ -3334,7 +3697,7 @@ class V8_EXPORT Function : public Object {
3334
3697
  /**
3335
3698
  * Tells whether this function is builtin.
3336
3699
  */
3337
- bool IsBuiltin() const;
3700
+ V8_DEPRECATED("this should no longer be used.", bool IsBuiltin() const);
3338
3701
 
3339
3702
  /**
3340
3703
  * Returns scriptId.
@@ -3359,10 +3722,15 @@ class V8_EXPORT Function : public Object {
3359
3722
 
3360
3723
  /**
3361
3724
  * An instance of the built-in Promise constructor (ES6 draft).
3362
- * This API is experimental. Only works with --harmony flag.
3363
3725
  */
3364
3726
  class V8_EXPORT Promise : public Object {
3365
3727
  public:
3728
+ /**
3729
+ * State of the promise. Each value corresponds to one of the possible values
3730
+ * of the [[PromiseState]] field.
3731
+ */
3732
+ enum PromiseState { kPending, kFulfilled, kRejected };
3733
+
3366
3734
  class V8_EXPORT Resolver : public Object {
3367
3735
  public:
3368
3736
  /**
@@ -3403,12 +3771,6 @@ class V8_EXPORT Promise : public Object {
3403
3771
  * an argument. If the promise is already resolved/rejected, the handler is
3404
3772
  * invoked at the end of turn.
3405
3773
  */
3406
- V8_DEPRECATED("Use maybe version of Then",
3407
- Local<Promise> Chain(Local<Function> handler));
3408
- V8_DEPRECATED("Use Then",
3409
- V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Chain(
3410
- Local<Context> context, Local<Function> handler));
3411
-
3412
3774
  V8_DEPRECATED("Use maybe version",
3413
3775
  Local<Promise> Catch(Local<Function> handler));
3414
3776
  V8_WARN_UNUSED_RESULT MaybeLocal<Promise> Catch(Local<Context> context,
@@ -3425,6 +3787,17 @@ class V8_EXPORT Promise : public Object {
3425
3787
  */
3426
3788
  bool HasHandler();
3427
3789
 
3790
+ /**
3791
+ * Returns the content of the [[PromiseResult]] field. The Promise must not
3792
+ * be pending.
3793
+ */
3794
+ Local<Value> Result();
3795
+
3796
+ /**
3797
+ * Returns the value of the [[PromiseState]] field.
3798
+ */
3799
+ PromiseState State();
3800
+
3428
3801
  V8_INLINE static Promise* Cast(Value* obj);
3429
3802
 
3430
3803
  private:
@@ -3432,6 +3805,78 @@ class V8_EXPORT Promise : public Object {
3432
3805
  static void CheckCast(Value* obj);
3433
3806
  };
3434
3807
 
3808
+ /**
3809
+ * An instance of a Property Descriptor, see Ecma-262 6.2.4.
3810
+ *
3811
+ * Properties in a descriptor are present or absent. If you do not set
3812
+ * `enumerable`, `configurable`, and `writable`, they are absent. If `value`,
3813
+ * `get`, or `set` are absent, but you must specify them in the constructor, use
3814
+ * empty handles.
3815
+ *
3816
+ * Accessors `get` and `set` must be callable or undefined if they are present.
3817
+ *
3818
+ * \note Only query properties if they are present, i.e., call `x()` only if
3819
+ * `has_x()` returns true.
3820
+ *
3821
+ * \code
3822
+ * // var desc = {writable: false}
3823
+ * v8::PropertyDescriptor d(Local<Value>()), false);
3824
+ * d.value(); // error, value not set
3825
+ * if (d.has_writable()) {
3826
+ * d.writable(); // false
3827
+ * }
3828
+ *
3829
+ * // var desc = {value: undefined}
3830
+ * v8::PropertyDescriptor d(v8::Undefined(isolate));
3831
+ *
3832
+ * // var desc = {get: undefined}
3833
+ * v8::PropertyDescriptor d(v8::Undefined(isolate), Local<Value>()));
3834
+ * \endcode
3835
+ */
3836
+ class V8_EXPORT PropertyDescriptor {
3837
+ public:
3838
+ // GenericDescriptor
3839
+ PropertyDescriptor();
3840
+
3841
+ // DataDescriptor
3842
+ PropertyDescriptor(Local<Value> value);
3843
+
3844
+ // DataDescriptor with writable property
3845
+ PropertyDescriptor(Local<Value> value, bool writable);
3846
+
3847
+ // AccessorDescriptor
3848
+ PropertyDescriptor(Local<Value> get, Local<Value> set);
3849
+
3850
+ ~PropertyDescriptor();
3851
+
3852
+ Local<Value> value() const;
3853
+ bool has_value() const;
3854
+
3855
+ Local<Value> get() const;
3856
+ bool has_get() const;
3857
+ Local<Value> set() const;
3858
+ bool has_set() const;
3859
+
3860
+ void set_enumerable(bool enumerable);
3861
+ bool enumerable() const;
3862
+ bool has_enumerable() const;
3863
+
3864
+ void set_configurable(bool configurable);
3865
+ bool configurable() const;
3866
+ bool has_configurable() const;
3867
+
3868
+ bool writable() const;
3869
+ bool has_writable() const;
3870
+
3871
+ struct PrivateData;
3872
+ PrivateData* get_private() const { return private_; }
3873
+
3874
+ PropertyDescriptor(const PropertyDescriptor&) = delete;
3875
+ void operator=(const PropertyDescriptor&) = delete;
3876
+
3877
+ private:
3878
+ PrivateData* private_;
3879
+ };
3435
3880
 
3436
3881
  /**
3437
3882
  * An instance of the built-in Proxy constructor (ECMA-262, 6th Edition,
@@ -3445,7 +3890,7 @@ class V8_EXPORT Proxy : public Object {
3445
3890
  void Revoke();
3446
3891
 
3447
3892
  /**
3448
- * Creates a new empty Map.
3893
+ * Creates a new Proxy for the target object.
3449
3894
  */
3450
3895
  static MaybeLocal<Proxy> New(Local<Context> context,
3451
3896
  Local<Object> local_target,
@@ -3458,6 +3903,35 @@ class V8_EXPORT Proxy : public Object {
3458
3903
  static void CheckCast(Value* obj);
3459
3904
  };
3460
3905
 
3906
+ class V8_EXPORT WasmCompiledModule : public Object {
3907
+ public:
3908
+ typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> SerializedModule;
3909
+ // A buffer that is owned by the caller.
3910
+ typedef std::pair<const uint8_t*, size_t> CallerOwnedBuffer;
3911
+ // Get the wasm-encoded bytes that were used to compile this module.
3912
+ Local<String> GetWasmWireBytes();
3913
+
3914
+ // Serialize the compiled module. The serialized data does not include the
3915
+ // uncompiled bytes.
3916
+ SerializedModule Serialize();
3917
+
3918
+ // If possible, deserialize the module, otherwise compile it from the provided
3919
+ // uncompiled bytes.
3920
+ static MaybeLocal<WasmCompiledModule> DeserializeOrCompile(
3921
+ Isolate* isolate, const CallerOwnedBuffer& serialized_module,
3922
+ const CallerOwnedBuffer& wire_bytes);
3923
+ V8_INLINE static WasmCompiledModule* Cast(Value* obj);
3924
+
3925
+ private:
3926
+ static MaybeLocal<WasmCompiledModule> Deserialize(
3927
+ Isolate* isolate, const CallerOwnedBuffer& serialized_module,
3928
+ const CallerOwnedBuffer& wire_bytes);
3929
+ static MaybeLocal<WasmCompiledModule> Compile(Isolate* isolate,
3930
+ const uint8_t* start,
3931
+ size_t length);
3932
+ WasmCompiledModule();
3933
+ static void CheckCast(Value* obj);
3934
+ };
3461
3935
 
3462
3936
  #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
3463
3937
  // The number of required internal fields can be defined by embedder.
@@ -3470,7 +3944,6 @@ enum class ArrayBufferCreationMode { kInternalized, kExternalized };
3470
3944
 
3471
3945
  /**
3472
3946
  * An instance of the built-in ArrayBuffer constructor (ES6 draft 15.13.5).
3473
- * This API is experimental and may change significantly.
3474
3947
  */
3475
3948
  class V8_EXPORT ArrayBuffer : public Object {
3476
3949
  public:
@@ -3488,8 +3961,6 @@ class V8_EXPORT ArrayBuffer : public Object {
3488
3961
  *
3489
3962
  * Note that it is unsafe to call back into V8 from any of the allocator
3490
3963
  * functions.
3491
- *
3492
- * This API is experimental and may change significantly.
3493
3964
  */
3494
3965
  class V8_EXPORT Allocator { // NOLINT
3495
3966
  public:
@@ -3506,11 +3977,19 @@ class V8_EXPORT ArrayBuffer : public Object {
3506
3977
  * Memory does not have to be initialized.
3507
3978
  */
3508
3979
  virtual void* AllocateUninitialized(size_t length) = 0;
3980
+
3509
3981
  /**
3510
3982
  * Free the memory block of size |length|, pointed to by |data|.
3511
3983
  * That memory is guaranteed to be previously allocated by |Allocate|.
3512
3984
  */
3513
3985
  virtual void Free(void* data, size_t length) = 0;
3986
+
3987
+ /**
3988
+ * malloc/free based convenience allocator.
3989
+ *
3990
+ * Caller takes ownership.
3991
+ */
3992
+ static Allocator* NewDefaultAllocator();
3514
3993
  };
3515
3994
 
3516
3995
  /**
@@ -3520,8 +3999,6 @@ class V8_EXPORT ArrayBuffer : public Object {
3520
3999
  *
3521
4000
  * The Data pointer of ArrayBuffer::Contents is always allocated with
3522
4001
  * Allocator::Allocate that is set via Isolate::CreateParams.
3523
- *
3524
- * This API is experimental and may change significantly.
3525
4002
  */
3526
4003
  class V8_EXPORT Contents { // NOLINT
3527
4004
  public:
@@ -3583,7 +4060,7 @@ class V8_EXPORT ArrayBuffer : public Object {
3583
4060
  /**
3584
4061
  * Make this ArrayBuffer external. The pointer to underlying memory block
3585
4062
  * and byte length are returned as |Contents| structure. After ArrayBuffer
3586
- * had been etxrenalized, it does no longer owns the memory block. The caller
4063
+ * had been externalized, it does no longer own the memory block. The caller
3587
4064
  * should take steps to free memory when it is no longer needed.
3588
4065
  *
3589
4066
  * The memory block is guaranteed to be allocated with |Allocator::Allocate|
@@ -3594,7 +4071,7 @@ class V8_EXPORT ArrayBuffer : public Object {
3594
4071
  /**
3595
4072
  * Get a pointer to the ArrayBuffer's underlying memory block without
3596
4073
  * externalizing it. If the ArrayBuffer is not externalized, this pointer
3597
- * will become invalid as soon as the ArrayBuffer became garbage collected.
4074
+ * will become invalid as soon as the ArrayBuffer gets garbage collected.
3598
4075
  *
3599
4076
  * The embedder should make sure to hold a strong reference to the
3600
4077
  * ArrayBuffer while accessing this pointer.
@@ -3622,8 +4099,6 @@ class V8_EXPORT ArrayBuffer : public Object {
3622
4099
  /**
3623
4100
  * A base class for an instance of one of "views" over ArrayBuffer,
3624
4101
  * including TypedArrays and DataView (ES6 draft 15.13).
3625
- *
3626
- * This API is experimental and may change significantly.
3627
4102
  */
3628
4103
  class V8_EXPORT ArrayBufferView : public Object {
3629
4104
  public:
@@ -3646,7 +4121,7 @@ class V8_EXPORT ArrayBufferView : public Object {
3646
4121
  * might incur.
3647
4122
  *
3648
4123
  * Will write at most min(|byte_length|, ByteLength) bytes starting at
3649
- * ByteOffset of the underling buffer to the memory starting at |dest|.
4124
+ * ByteOffset of the underlying buffer to the memory starting at |dest|.
3650
4125
  * Returns the number of bytes actually written.
3651
4126
  */
3652
4127
  size_t CopyContents(void* dest, size_t byte_length);
@@ -3671,7 +4146,6 @@ class V8_EXPORT ArrayBufferView : public Object {
3671
4146
  /**
3672
4147
  * A base class for an instance of TypedArray series of constructors
3673
4148
  * (ES6 draft 15.13.6).
3674
- * This API is experimental and may change significantly.
3675
4149
  */
3676
4150
  class V8_EXPORT TypedArray : public ArrayBufferView {
3677
4151
  public:
@@ -3691,7 +4165,6 @@ class V8_EXPORT TypedArray : public ArrayBufferView {
3691
4165
 
3692
4166
  /**
3693
4167
  * An instance of Uint8Array constructor (ES6 draft 15.13.6).
3694
- * This API is experimental and may change significantly.
3695
4168
  */
3696
4169
  class V8_EXPORT Uint8Array : public TypedArray {
3697
4170
  public:
@@ -3709,7 +4182,6 @@ class V8_EXPORT Uint8Array : public TypedArray {
3709
4182
 
3710
4183
  /**
3711
4184
  * An instance of Uint8ClampedArray constructor (ES6 draft 15.13.6).
3712
- * This API is experimental and may change significantly.
3713
4185
  */
3714
4186
  class V8_EXPORT Uint8ClampedArray : public TypedArray {
3715
4187
  public:
@@ -3727,7 +4199,6 @@ class V8_EXPORT Uint8ClampedArray : public TypedArray {
3727
4199
 
3728
4200
  /**
3729
4201
  * An instance of Int8Array constructor (ES6 draft 15.13.6).
3730
- * This API is experimental and may change significantly.
3731
4202
  */
3732
4203
  class V8_EXPORT Int8Array : public TypedArray {
3733
4204
  public:
@@ -3745,7 +4216,6 @@ class V8_EXPORT Int8Array : public TypedArray {
3745
4216
 
3746
4217
  /**
3747
4218
  * An instance of Uint16Array constructor (ES6 draft 15.13.6).
3748
- * This API is experimental and may change significantly.
3749
4219
  */
3750
4220
  class V8_EXPORT Uint16Array : public TypedArray {
3751
4221
  public:
@@ -3763,7 +4233,6 @@ class V8_EXPORT Uint16Array : public TypedArray {
3763
4233
 
3764
4234
  /**
3765
4235
  * An instance of Int16Array constructor (ES6 draft 15.13.6).
3766
- * This API is experimental and may change significantly.
3767
4236
  */
3768
4237
  class V8_EXPORT Int16Array : public TypedArray {
3769
4238
  public:
@@ -3781,7 +4250,6 @@ class V8_EXPORT Int16Array : public TypedArray {
3781
4250
 
3782
4251
  /**
3783
4252
  * An instance of Uint32Array constructor (ES6 draft 15.13.6).
3784
- * This API is experimental and may change significantly.
3785
4253
  */
3786
4254
  class V8_EXPORT Uint32Array : public TypedArray {
3787
4255
  public:
@@ -3799,7 +4267,6 @@ class V8_EXPORT Uint32Array : public TypedArray {
3799
4267
 
3800
4268
  /**
3801
4269
  * An instance of Int32Array constructor (ES6 draft 15.13.6).
3802
- * This API is experimental and may change significantly.
3803
4270
  */
3804
4271
  class V8_EXPORT Int32Array : public TypedArray {
3805
4272
  public:
@@ -3817,7 +4284,6 @@ class V8_EXPORT Int32Array : public TypedArray {
3817
4284
 
3818
4285
  /**
3819
4286
  * An instance of Float32Array constructor (ES6 draft 15.13.6).
3820
- * This API is experimental and may change significantly.
3821
4287
  */
3822
4288
  class V8_EXPORT Float32Array : public TypedArray {
3823
4289
  public:
@@ -3835,7 +4301,6 @@ class V8_EXPORT Float32Array : public TypedArray {
3835
4301
 
3836
4302
  /**
3837
4303
  * An instance of Float64Array constructor (ES6 draft 15.13.6).
3838
- * This API is experimental and may change significantly.
3839
4304
  */
3840
4305
  class V8_EXPORT Float64Array : public TypedArray {
3841
4306
  public:
@@ -3853,7 +4318,6 @@ class V8_EXPORT Float64Array : public TypedArray {
3853
4318
 
3854
4319
  /**
3855
4320
  * An instance of DataView constructor (ES6 draft 15.13.7).
3856
- * This API is experimental and may change significantly.
3857
4321
  */
3858
4322
  class V8_EXPORT DataView : public ArrayBufferView {
3859
4323
  public:
@@ -3933,7 +4397,7 @@ class V8_EXPORT SharedArrayBuffer : public Object {
3933
4397
  /**
3934
4398
  * Make this SharedArrayBuffer external. The pointer to underlying memory
3935
4399
  * block and byte length are returned as |Contents| structure. After
3936
- * SharedArrayBuffer had been etxrenalized, it does no longer owns the memory
4400
+ * SharedArrayBuffer had been externalized, it does no longer own the memory
3937
4401
  * block. The caller should take steps to free memory when it is no longer
3938
4402
  * needed.
3939
4403
  *
@@ -3984,7 +4448,7 @@ class V8_EXPORT Date : public Object {
3984
4448
  */
3985
4449
  double ValueOf() const;
3986
4450
 
3987
- V8_INLINE static Date* Cast(v8::Value* obj);
4451
+ V8_INLINE static Date* Cast(Value* obj);
3988
4452
 
3989
4453
  /**
3990
4454
  * Notification that the embedder has changed the time zone,
@@ -4001,7 +4465,7 @@ class V8_EXPORT Date : public Object {
4001
4465
  static void DateTimeConfigurationChangeNotification(Isolate* isolate);
4002
4466
 
4003
4467
  private:
4004
- static void CheckCast(v8::Value* obj);
4468
+ static void CheckCast(Value* obj);
4005
4469
  };
4006
4470
 
4007
4471
 
@@ -4014,10 +4478,10 @@ class V8_EXPORT NumberObject : public Object {
4014
4478
 
4015
4479
  double ValueOf() const;
4016
4480
 
4017
- V8_INLINE static NumberObject* Cast(v8::Value* obj);
4481
+ V8_INLINE static NumberObject* Cast(Value* obj);
4018
4482
 
4019
4483
  private:
4020
- static void CheckCast(v8::Value* obj);
4484
+ static void CheckCast(Value* obj);
4021
4485
  };
4022
4486
 
4023
4487
 
@@ -4031,10 +4495,10 @@ class V8_EXPORT BooleanObject : public Object {
4031
4495
 
4032
4496
  bool ValueOf() const;
4033
4497
 
4034
- V8_INLINE static BooleanObject* Cast(v8::Value* obj);
4498
+ V8_INLINE static BooleanObject* Cast(Value* obj);
4035
4499
 
4036
4500
  private:
4037
- static void CheckCast(v8::Value* obj);
4501
+ static void CheckCast(Value* obj);
4038
4502
  };
4039
4503
 
4040
4504
 
@@ -4047,17 +4511,15 @@ class V8_EXPORT StringObject : public Object {
4047
4511
 
4048
4512
  Local<String> ValueOf() const;
4049
4513
 
4050
- V8_INLINE static StringObject* Cast(v8::Value* obj);
4514
+ V8_INLINE static StringObject* Cast(Value* obj);
4051
4515
 
4052
4516
  private:
4053
- static void CheckCast(v8::Value* obj);
4517
+ static void CheckCast(Value* obj);
4054
4518
  };
4055
4519
 
4056
4520
 
4057
4521
  /**
4058
4522
  * A Symbol object (ECMA-262 edition 6).
4059
- *
4060
- * This is an experimental feature. Use at your own risk.
4061
4523
  */
4062
4524
  class V8_EXPORT SymbolObject : public Object {
4063
4525
  public:
@@ -4065,10 +4527,10 @@ class V8_EXPORT SymbolObject : public Object {
4065
4527
 
4066
4528
  Local<Symbol> ValueOf() const;
4067
4529
 
4068
- V8_INLINE static SymbolObject* Cast(v8::Value* obj);
4530
+ V8_INLINE static SymbolObject* Cast(Value* obj);
4069
4531
 
4070
4532
  private:
4071
- static void CheckCast(v8::Value* obj);
4533
+ static void CheckCast(Value* obj);
4072
4534
  };
4073
4535
 
4074
4536
 
@@ -4118,10 +4580,10 @@ class V8_EXPORT RegExp : public Object {
4118
4580
  */
4119
4581
  Flags GetFlags() const;
4120
4582
 
4121
- V8_INLINE static RegExp* Cast(v8::Value* obj);
4583
+ V8_INLINE static RegExp* Cast(Value* obj);
4122
4584
 
4123
4585
  private:
4124
- static void CheckCast(v8::Value* obj);
4586
+ static void CheckCast(Value* obj);
4125
4587
  };
4126
4588
 
4127
4589
 
@@ -4163,6 +4625,8 @@ class V8_EXPORT Template : public Data {
4163
4625
  */
4164
4626
  void Set(Local<Name> name, Local<Data> value,
4165
4627
  PropertyAttribute attributes = None);
4628
+ void SetPrivate(Local<Private> name, Local<Data> value,
4629
+ PropertyAttribute attributes = None);
4166
4630
  V8_INLINE void Set(Isolate* isolate, const char* name, Local<Data> value);
4167
4631
 
4168
4632
  void SetAccessorProperty(
@@ -4214,6 +4678,14 @@ class V8_EXPORT Template : public Data {
4214
4678
  Local<AccessorSignature> signature = Local<AccessorSignature>(),
4215
4679
  AccessControl settings = DEFAULT);
4216
4680
 
4681
+ /**
4682
+ * Like SetNativeDataProperty, but V8 will replace the native data property
4683
+ * with a real data property on first access.
4684
+ */
4685
+ void SetLazyDataProperty(Local<Name> name, AccessorNameGetterCallback getter,
4686
+ Local<Value> data = Local<Value>(),
4687
+ PropertyAttribute attribute = None);
4688
+
4217
4689
  /**
4218
4690
  * During template instantiation, sets the value with the intrinsic property
4219
4691
  * from the correct context.
@@ -4278,36 +4750,115 @@ typedef void (*NamedPropertyEnumeratorCallback)(
4278
4750
 
4279
4751
  // TODO(dcarney): Deprecate and remove previous typedefs, and replace
4280
4752
  // GenericNamedPropertyFooCallback with just NamedPropertyFooCallback.
4753
+
4281
4754
  /**
4282
- * GenericNamedProperty[Getter|Setter] are used as interceptors on object.
4283
- * See ObjectTemplate::SetNamedPropertyHandler.
4755
+ * Interceptor for get requests on an object.
4756
+ *
4757
+ * Use `info.GetReturnValue().Set()` to set the return value of the
4758
+ * intercepted get request.
4759
+ *
4760
+ * \param property The name of the property for which the request was
4761
+ * intercepted.
4762
+ * \param info Information about the intercepted request, such as
4763
+ * isolate, receiver, return value, or whether running in `'use strict`' mode.
4764
+ * See `PropertyCallbackInfo`.
4765
+ *
4766
+ * \code
4767
+ * void GetterCallback(
4768
+ * Local<Name> name,
4769
+ * const v8::PropertyCallbackInfo<v8::Value>& info) {
4770
+ * info.GetReturnValue().Set(v8_num(42));
4771
+ * }
4772
+ *
4773
+ * v8::Local<v8::FunctionTemplate> templ =
4774
+ * v8::FunctionTemplate::New(isolate);
4775
+ * templ->InstanceTemplate()->SetHandler(
4776
+ * v8::NamedPropertyHandlerConfiguration(GetterCallback));
4777
+ * LocalContext env;
4778
+ * env->Global()
4779
+ * ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local())
4780
+ * .ToLocalChecked()
4781
+ * ->NewInstance(env.local())
4782
+ * .ToLocalChecked())
4783
+ * .FromJust();
4784
+ * v8::Local<v8::Value> result = CompileRun("obj.a = 17; obj.a");
4785
+ * CHECK(v8_num(42)->Equals(env.local(), result).FromJust());
4786
+ * \endcode
4787
+ *
4788
+ * See also `ObjectTemplate::SetHandler`.
4284
4789
  */
4285
4790
  typedef void (*GenericNamedPropertyGetterCallback)(
4286
4791
  Local<Name> property, const PropertyCallbackInfo<Value>& info);
4287
4792
 
4288
-
4289
4793
  /**
4290
- * Returns the value if the setter intercepts the request.
4291
- * Otherwise, returns an empty handle.
4794
+ * Interceptor for set requests on an object.
4795
+ *
4796
+ * Use `info.GetReturnValue()` to indicate whether the request was intercepted
4797
+ * or not. If the setter successfully intercepts the request, i.e., if the
4798
+ * request should not be further executed, call
4799
+ * `info.GetReturnValue().Set(value)`. If the setter
4800
+ * did not intercept the request, i.e., if the request should be handled as
4801
+ * if no interceptor is present, do not not call `Set()`.
4802
+ *
4803
+ * \param property The name of the property for which the request was
4804
+ * intercepted.
4805
+ * \param value The value which the property will have if the request
4806
+ * is not intercepted.
4807
+ * \param info Information about the intercepted request, such as
4808
+ * isolate, receiver, return value, or whether running in `'use strict'` mode.
4809
+ * See `PropertyCallbackInfo`.
4810
+ *
4811
+ * See also
4812
+ * `ObjectTemplate::SetHandler.`
4292
4813
  */
4293
4814
  typedef void (*GenericNamedPropertySetterCallback)(
4294
4815
  Local<Name> property, Local<Value> value,
4295
4816
  const PropertyCallbackInfo<Value>& info);
4296
4817
 
4297
-
4298
4818
  /**
4299
- * Returns a non-empty handle if the interceptor intercepts the request.
4300
- * The result is an integer encoding property attributes (like v8::None,
4301
- * v8::DontEnum, etc.)
4819
+ * Intercepts all requests that query the attributes of the
4820
+ * property, e.g., getOwnPropertyDescriptor(), propertyIsEnumerable(), and
4821
+ * defineProperty().
4822
+ *
4823
+ * Use `info.GetReturnValue().Set(value)` to set the property attributes. The
4824
+ * value is an interger encoding a `v8::PropertyAttribute`.
4825
+ *
4826
+ * \param property The name of the property for which the request was
4827
+ * intercepted.
4828
+ * \param info Information about the intercepted request, such as
4829
+ * isolate, receiver, return value, or whether running in `'use strict'` mode.
4830
+ * See `PropertyCallbackInfo`.
4831
+ *
4832
+ * \note Some functions query the property attributes internally, even though
4833
+ * they do not return the attributes. For example, `hasOwnProperty()` can
4834
+ * trigger this interceptor depending on the state of the object.
4835
+ *
4836
+ * See also
4837
+ * `ObjectTemplate::SetHandler.`
4302
4838
  */
4303
4839
  typedef void (*GenericNamedPropertyQueryCallback)(
4304
4840
  Local<Name> property, const PropertyCallbackInfo<Integer>& info);
4305
4841
 
4306
-
4307
4842
  /**
4308
- * Returns a non-empty handle if the deleter intercepts the request.
4309
- * The return value is true if the property could be deleted and false
4310
- * otherwise.
4843
+ * Interceptor for delete requests on an object.
4844
+ *
4845
+ * Use `info.GetReturnValue()` to indicate whether the request was intercepted
4846
+ * or not. If the deleter successfully intercepts the request, i.e., if the
4847
+ * request should not be further executed, call
4848
+ * `info.GetReturnValue().Set(value)` with a boolean `value`. The `value` is
4849
+ * used as the return value of `delete`.
4850
+ *
4851
+ * \param property The name of the property for which the request was
4852
+ * intercepted.
4853
+ * \param info Information about the intercepted request, such as
4854
+ * isolate, receiver, return value, or whether running in `'use strict'` mode.
4855
+ * See `PropertyCallbackInfo`.
4856
+ *
4857
+ * \note If you need to mimic the behavior of `delete`, i.e., throw in strict
4858
+ * mode instead of returning false, use `info.ShouldThrowOnError()` to determine
4859
+ * if you are in strict mode.
4860
+ *
4861
+ * See also `ObjectTemplate::SetHandler.`
4311
4862
  */
4312
4863
  typedef void (*GenericNamedPropertyDeleterCallback)(
4313
4864
  Local<Name> property, const PropertyCallbackInfo<Boolean>& info);
@@ -4320,52 +4871,99 @@ typedef void (*GenericNamedPropertyDeleterCallback)(
4320
4871
  typedef void (*GenericNamedPropertyEnumeratorCallback)(
4321
4872
  const PropertyCallbackInfo<Array>& info);
4322
4873
 
4874
+ /**
4875
+ * Interceptor for defineProperty requests on an object.
4876
+ *
4877
+ * Use `info.GetReturnValue()` to indicate whether the request was intercepted
4878
+ * or not. If the definer successfully intercepts the request, i.e., if the
4879
+ * request should not be further executed, call
4880
+ * `info.GetReturnValue().Set(value)`. If the definer
4881
+ * did not intercept the request, i.e., if the request should be handled as
4882
+ * if no interceptor is present, do not not call `Set()`.
4883
+ *
4884
+ * \param property The name of the property for which the request was
4885
+ * intercepted.
4886
+ * \param desc The property descriptor which is used to define the
4887
+ * property if the request is not intercepted.
4888
+ * \param info Information about the intercepted request, such as
4889
+ * isolate, receiver, return value, or whether running in `'use strict'` mode.
4890
+ * See `PropertyCallbackInfo`.
4891
+ *
4892
+ * See also `ObjectTemplate::SetHandler`.
4893
+ */
4894
+ typedef void (*GenericNamedPropertyDefinerCallback)(
4895
+ Local<Name> property, const PropertyDescriptor& desc,
4896
+ const PropertyCallbackInfo<Value>& info);
4323
4897
 
4324
4898
  /**
4325
- * Returns the value of the property if the getter intercepts the
4326
- * request. Otherwise, returns an empty handle.
4899
+ * Interceptor for getOwnPropertyDescriptor requests on an object.
4900
+ *
4901
+ * Use `info.GetReturnValue().Set()` to set the return value of the
4902
+ * intercepted request. The return value must be an object that
4903
+ * can be converted to a PropertyDescriptor, e.g., a `v8::value` returned from
4904
+ * `v8::Object::getOwnPropertyDescriptor`.
4905
+ *
4906
+ * \param property The name of the property for which the request was
4907
+ * intercepted.
4908
+ * \info Information about the intercepted request, such as
4909
+ * isolate, receiver, return value, or whether running in `'use strict'` mode.
4910
+ * See `PropertyCallbackInfo`.
4911
+ *
4912
+ * \note If GetOwnPropertyDescriptor is intercepted, it will
4913
+ * always return true, i.e., indicate that the property was found.
4914
+ *
4915
+ * See also `ObjectTemplate::SetHandler`.
4916
+ */
4917
+ typedef void (*GenericNamedPropertyDescriptorCallback)(
4918
+ Local<Name> property, const PropertyCallbackInfo<Value>& info);
4919
+
4920
+ /**
4921
+ * See `v8::GenericNamedPropertyGetterCallback`.
4327
4922
  */
4328
4923
  typedef void (*IndexedPropertyGetterCallback)(
4329
4924
  uint32_t index,
4330
4925
  const PropertyCallbackInfo<Value>& info);
4331
4926
 
4332
-
4333
- /**
4334
- * Returns the value if the setter intercepts the request.
4335
- * Otherwise, returns an empty handle.
4927
+ /**
4928
+ * See `v8::GenericNamedPropertySetterCallback`.
4336
4929
  */
4337
4930
  typedef void (*IndexedPropertySetterCallback)(
4338
4931
  uint32_t index,
4339
4932
  Local<Value> value,
4340
4933
  const PropertyCallbackInfo<Value>& info);
4341
4934
 
4342
-
4343
4935
  /**
4344
- * Returns a non-empty handle if the interceptor intercepts the request.
4345
- * The result is an integer encoding property attributes.
4936
+ * See `v8::GenericNamedPropertyQueryCallback`.
4346
4937
  */
4347
4938
  typedef void (*IndexedPropertyQueryCallback)(
4348
4939
  uint32_t index,
4349
4940
  const PropertyCallbackInfo<Integer>& info);
4350
4941
 
4351
-
4352
4942
  /**
4353
- * Returns a non-empty handle if the deleter intercepts the request.
4354
- * The return value is true if the property could be deleted and false
4355
- * otherwise.
4943
+ * See `v8::GenericNamedPropertyDeleterCallback`.
4356
4944
  */
4357
4945
  typedef void (*IndexedPropertyDeleterCallback)(
4358
4946
  uint32_t index,
4359
4947
  const PropertyCallbackInfo<Boolean>& info);
4360
4948
 
4361
-
4362
4949
  /**
4363
- * Returns an array containing the indices of the properties the
4364
- * indexed property getter intercepts.
4950
+ * See `v8::GenericNamedPropertyEnumeratorCallback`.
4365
4951
  */
4366
4952
  typedef void (*IndexedPropertyEnumeratorCallback)(
4367
4953
  const PropertyCallbackInfo<Array>& info);
4368
4954
 
4955
+ /**
4956
+ * See `v8::GenericNamedPropertyDefinerCallback`.
4957
+ */
4958
+ typedef void (*IndexedPropertyDefinerCallback)(
4959
+ uint32_t index, const PropertyDescriptor& desc,
4960
+ const PropertyCallbackInfo<Value>& info);
4961
+
4962
+ /**
4963
+ * See `v8::GenericNamedPropertyDescriptorCallback`.
4964
+ */
4965
+ typedef void (*IndexedPropertyDescriptorCallback)(
4966
+ uint32_t index, const PropertyCallbackInfo<Value>& info);
4369
4967
 
4370
4968
  /**
4371
4969
  * Access type specification.
@@ -4396,7 +4994,7 @@ typedef bool (*AccessCheckCallback)(Local<Context> accessing_context,
4396
4994
  * preferred.
4397
4995
  *
4398
4996
  * Any modification of a FunctionTemplate after first instantiation will trigger
4399
- *a crash.
4997
+ * a crash.
4400
4998
  *
4401
4999
  * A FunctionTemplate can have properties, these properties are added to the
4402
5000
  * function object when it is created.
@@ -4412,17 +5010,21 @@ typedef bool (*AccessCheckCallback)(Local<Context> accessing_context,
4412
5010
  * The following example shows how to use a FunctionTemplate:
4413
5011
  *
4414
5012
  * \code
4415
- * v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New();
4416
- * t->Set("func_property", v8::Number::New(1));
5013
+ * v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
5014
+ * t->Set(isolate, "func_property", v8::Number::New(isolate, 1));
4417
5015
  *
4418
5016
  * v8::Local<v8::Template> proto_t = t->PrototypeTemplate();
4419
- * proto_t->Set("proto_method", v8::FunctionTemplate::New(InvokeCallback));
4420
- * proto_t->Set("proto_const", v8::Number::New(2));
5017
+ * proto_t->Set(isolate,
5018
+ * "proto_method",
5019
+ * v8::FunctionTemplate::New(isolate, InvokeCallback));
5020
+ * proto_t->Set(isolate, "proto_const", v8::Number::New(isolate, 2));
4421
5021
  *
4422
5022
  * v8::Local<v8::ObjectTemplate> instance_t = t->InstanceTemplate();
4423
- * instance_t->SetAccessor("instance_accessor", InstanceAccessorCallback);
4424
- * instance_t->SetNamedPropertyHandler(PropertyHandlerCallback, ...);
4425
- * instance_t->Set("instance_property", Number::New(3));
5023
+ * instance_t->SetAccessor(String::NewFromUtf8(isolate, "instance_accessor"),
5024
+ * InstanceAccessorCallback);
5025
+ * instance_t->SetNamedPropertyHandler(PropertyHandlerCallback);
5026
+ * instance_t->Set(String::NewFromUtf8(isolate, "instance_property"),
5027
+ * Number::New(isolate, 3));
4426
5028
  *
4427
5029
  * v8::Local<v8::Function> function = t->GetFunction();
4428
5030
  * v8::Local<v8::Object> instance = function->NewInstance();
@@ -4492,7 +5094,8 @@ class V8_EXPORT FunctionTemplate : public Template {
4492
5094
  ConstructorBehavior behavior = ConstructorBehavior::kAllow);
4493
5095
 
4494
5096
  /** Get a template included in the snapshot by index. */
4495
- static Local<FunctionTemplate> FromSnapshot(Isolate* isolate, size_t index);
5097
+ static MaybeLocal<FunctionTemplate> FromSnapshot(Isolate* isolate,
5098
+ size_t index);
4496
5099
 
4497
5100
  /**
4498
5101
  * Creates a function template with a fast handler. If a fast handler is set,
@@ -4504,11 +5107,28 @@ class V8_EXPORT FunctionTemplate : public Template {
4504
5107
  Local<Value> data = Local<Value>(),
4505
5108
  Local<Signature> signature = Local<Signature>(), int length = 0);
4506
5109
 
5110
+ /**
5111
+ * Creates a function template backed/cached by a private property.
5112
+ */
5113
+ static Local<FunctionTemplate> NewWithCache(
5114
+ Isolate* isolate, FunctionCallback callback,
5115
+ Local<Private> cache_property, Local<Value> data = Local<Value>(),
5116
+ Local<Signature> signature = Local<Signature>(), int length = 0);
5117
+
4507
5118
  /** Returns the unique function instance in the current execution context.*/
4508
5119
  V8_DEPRECATE_SOON("Use maybe version", Local<Function> GetFunction());
4509
5120
  V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
4510
5121
  Local<Context> context);
4511
5122
 
5123
+ /**
5124
+ * Similar to Context::NewRemoteContext, this creates an instance that
5125
+ * isn't backed by an actual object.
5126
+ *
5127
+ * The InstanceTemplate of this FunctionTemplate must have access checks with
5128
+ * handlers installed.
5129
+ */
5130
+ V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewRemoteInstance();
5131
+
4512
5132
  /**
4513
5133
  * Set the call-handler callback for a FunctionTemplate. This
4514
5134
  * callback is called whenever the function created from this
@@ -4524,7 +5144,11 @@ class V8_EXPORT FunctionTemplate : public Template {
4524
5144
  /** Get the InstanceTemplate. */
4525
5145
  Local<ObjectTemplate> InstanceTemplate();
4526
5146
 
4527
- /** Causes the function template to inherit from a parent function template.*/
5147
+ /**
5148
+ * Causes the function template to inherit from a parent function template.
5149
+ * This means the the function's prototype.__proto__ is set to the parent
5150
+ * function's prototype.
5151
+ **/
4528
5152
  void Inherit(Local<FunctionTemplate> parent);
4529
5153
 
4530
5154
  /**
@@ -4533,6 +5157,14 @@ class V8_EXPORT FunctionTemplate : public Template {
4533
5157
  */
4534
5158
  Local<ObjectTemplate> PrototypeTemplate();
4535
5159
 
5160
+ /**
5161
+ * A PrototypeProviderTemplate is another function template whose prototype
5162
+ * property is used for this template. This is mutually exclusive with setting
5163
+ * a prototype template indirectly by calling PrototypeTemplate() or using
5164
+ * Inherit().
5165
+ **/
5166
+ void SetPrototypeProviderTemplate(Local<FunctionTemplate> prototype_provider);
5167
+
4536
5168
  /**
4537
5169
  * Set the class name of the FunctionTemplate. This is used for
4538
5170
  * printing objects created with the function created from the
@@ -4585,23 +5217,37 @@ class V8_EXPORT FunctionTemplate : public Template {
4585
5217
  friend class ObjectTemplate;
4586
5218
  };
4587
5219
 
4588
-
5220
+ /**
5221
+ * Configuration flags for v8::NamedPropertyHandlerConfiguration or
5222
+ * v8::IndexedPropertyHandlerConfiguration.
5223
+ */
4589
5224
  enum class PropertyHandlerFlags {
5225
+ /**
5226
+ * None.
5227
+ */
4590
5228
  kNone = 0,
4591
- // See ALL_CAN_READ above.
5229
+
5230
+ /**
5231
+ * See ALL_CAN_READ above.
5232
+ */
4592
5233
  kAllCanRead = 1,
4593
- // Will not call into interceptor for properties on the receiver or prototype
4594
- // chain. Currently only valid for named interceptors.
5234
+
5235
+ /** Will not call into interceptor for properties on the receiver or prototype
5236
+ * chain, i.e., only call into interceptor for properties that do not exist.
5237
+ * Currently only valid for named interceptors.
5238
+ */
4595
5239
  kNonMasking = 1 << 1,
4596
- // Will not call into interceptor for symbol lookup. Only meaningful for
4597
- // named interceptors.
5240
+
5241
+ /**
5242
+ * Will not call into interceptor for symbol lookup. Only meaningful for
5243
+ * named interceptors.
5244
+ */
4598
5245
  kOnlyInterceptStrings = 1 << 2,
4599
5246
  };
4600
5247
 
4601
-
4602
5248
  struct NamedPropertyHandlerConfiguration {
4603
5249
  NamedPropertyHandlerConfiguration(
4604
- /** Note: getter is required **/
5250
+ /** Note: getter is required */
4605
5251
  GenericNamedPropertyGetterCallback getter = 0,
4606
5252
  GenericNamedPropertySetterCallback setter = 0,
4607
5253
  GenericNamedPropertyQueryCallback query = 0,
@@ -4614,6 +5260,27 @@ struct NamedPropertyHandlerConfiguration {
4614
5260
  query(query),
4615
5261
  deleter(deleter),
4616
5262
  enumerator(enumerator),
5263
+ definer(0),
5264
+ descriptor(0),
5265
+ data(data),
5266
+ flags(flags) {}
5267
+
5268
+ NamedPropertyHandlerConfiguration(
5269
+ GenericNamedPropertyGetterCallback getter,
5270
+ GenericNamedPropertySetterCallback setter,
5271
+ GenericNamedPropertyDescriptorCallback descriptor,
5272
+ GenericNamedPropertyDeleterCallback deleter,
5273
+ GenericNamedPropertyEnumeratorCallback enumerator,
5274
+ GenericNamedPropertyDefinerCallback definer,
5275
+ Local<Value> data = Local<Value>(),
5276
+ PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
5277
+ : getter(getter),
5278
+ setter(setter),
5279
+ query(0),
5280
+ deleter(deleter),
5281
+ enumerator(enumerator),
5282
+ definer(definer),
5283
+ descriptor(descriptor),
4617
5284
  data(data),
4618
5285
  flags(flags) {}
4619
5286
 
@@ -4622,6 +5289,8 @@ struct NamedPropertyHandlerConfiguration {
4622
5289
  GenericNamedPropertyQueryCallback query;
4623
5290
  GenericNamedPropertyDeleterCallback deleter;
4624
5291
  GenericNamedPropertyEnumeratorCallback enumerator;
5292
+ GenericNamedPropertyDefinerCallback definer;
5293
+ GenericNamedPropertyDescriptorCallback descriptor;
4625
5294
  Local<Value> data;
4626
5295
  PropertyHandlerFlags flags;
4627
5296
  };
@@ -4629,7 +5298,7 @@ struct NamedPropertyHandlerConfiguration {
4629
5298
 
4630
5299
  struct IndexedPropertyHandlerConfiguration {
4631
5300
  IndexedPropertyHandlerConfiguration(
4632
- /** Note: getter is required **/
5301
+ /** Note: getter is required */
4633
5302
  IndexedPropertyGetterCallback getter = 0,
4634
5303
  IndexedPropertySetterCallback setter = 0,
4635
5304
  IndexedPropertyQueryCallback query = 0,
@@ -4642,6 +5311,27 @@ struct IndexedPropertyHandlerConfiguration {
4642
5311
  query(query),
4643
5312
  deleter(deleter),
4644
5313
  enumerator(enumerator),
5314
+ definer(0),
5315
+ descriptor(0),
5316
+ data(data),
5317
+ flags(flags) {}
5318
+
5319
+ IndexedPropertyHandlerConfiguration(
5320
+ IndexedPropertyGetterCallback getter,
5321
+ IndexedPropertySetterCallback setter,
5322
+ IndexedPropertyDescriptorCallback descriptor,
5323
+ IndexedPropertyDeleterCallback deleter,
5324
+ IndexedPropertyEnumeratorCallback enumerator,
5325
+ IndexedPropertyDefinerCallback definer,
5326
+ Local<Value> data = Local<Value>(),
5327
+ PropertyHandlerFlags flags = PropertyHandlerFlags::kNone)
5328
+ : getter(getter),
5329
+ setter(setter),
5330
+ query(0),
5331
+ deleter(deleter),
5332
+ enumerator(enumerator),
5333
+ definer(definer),
5334
+ descriptor(descriptor),
4645
5335
  data(data),
4646
5336
  flags(flags) {}
4647
5337
 
@@ -4650,6 +5340,8 @@ struct IndexedPropertyHandlerConfiguration {
4650
5340
  IndexedPropertyQueryCallback query;
4651
5341
  IndexedPropertyDeleterCallback deleter;
4652
5342
  IndexedPropertyEnumeratorCallback enumerator;
5343
+ IndexedPropertyDefinerCallback definer;
5344
+ IndexedPropertyDescriptorCallback descriptor;
4653
5345
  Local<Value> data;
4654
5346
  PropertyHandlerFlags flags;
4655
5347
  };
@@ -4670,7 +5362,8 @@ class V8_EXPORT ObjectTemplate : public Template {
4670
5362
  static V8_DEPRECATED("Use isolate version", Local<ObjectTemplate> New());
4671
5363
 
4672
5364
  /** Get a template included in the snapshot by index. */
4673
- static Local<ObjectTemplate> FromSnapshot(Isolate* isolate, size_t index);
5365
+ static MaybeLocal<ObjectTemplate> FromSnapshot(Isolate* isolate,
5366
+ size_t index);
4674
5367
 
4675
5368
  /** Creates a new instance of this template.*/
4676
5369
  V8_DEPRECATE_SOON("Use maybe version", Local<Object> NewInstance());
@@ -4723,8 +5416,10 @@ class V8_EXPORT ObjectTemplate : public Template {
4723
5416
  * from this object template, the provided callback is invoked instead of
4724
5417
  * accessing the property directly on the JavaScript object.
4725
5418
  *
4726
- * Note that new code should use the second version that can intercept
4727
- * symbol-named properties as well as string-named properties.
5419
+ * SetNamedPropertyHandler() is different from SetHandler(), in
5420
+ * that the latter can intercept symbol-named properties as well as
5421
+ * string-named properties when called with a
5422
+ * NamedPropertyHandlerConfiguration. New code should use SetHandler().
4728
5423
  *
4729
5424
  * \param getter The callback to invoke when getting a property.
4730
5425
  * \param setter The callback to invoke when setting a property.
@@ -4743,6 +5438,18 @@ class V8_EXPORT ObjectTemplate : public Template {
4743
5438
  NamedPropertyDeleterCallback deleter = 0,
4744
5439
  NamedPropertyEnumeratorCallback enumerator = 0,
4745
5440
  Local<Value> data = Local<Value>());
5441
+
5442
+ /**
5443
+ * Sets a named property handler on the object template.
5444
+ *
5445
+ * Whenever a property whose name is a string or a symbol is accessed on
5446
+ * objects created from this object template, the provided callback is
5447
+ * invoked instead of accessing the property directly on the JavaScript
5448
+ * object.
5449
+ *
5450
+ * @param configuration The NamedPropertyHandlerConfiguration that defines the
5451
+ * callbacks to invoke when accessing a property.
5452
+ */
4746
5453
  void SetHandler(const NamedPropertyHandlerConfiguration& configuration);
4747
5454
 
4748
5455
  /**
@@ -4761,7 +5468,6 @@ class V8_EXPORT ObjectTemplate : public Template {
4761
5468
  * \param data A piece of data that will be passed to the callbacks
4762
5469
  * whenever they are invoked.
4763
5470
  */
4764
- void SetHandler(const IndexedPropertyHandlerConfiguration& configuration);
4765
5471
  // TODO(dcarney): deprecate
4766
5472
  void SetIndexedPropertyHandler(
4767
5473
  IndexedPropertyGetterCallback getter,
@@ -4773,6 +5479,19 @@ class V8_EXPORT ObjectTemplate : public Template {
4773
5479
  SetHandler(IndexedPropertyHandlerConfiguration(getter, setter, query,
4774
5480
  deleter, enumerator, data));
4775
5481
  }
5482
+
5483
+ /**
5484
+ * Sets an indexed property handler on the object template.
5485
+ *
5486
+ * Whenever an indexed property is accessed on objects created from
5487
+ * this object template, the provided callback is invoked instead of
5488
+ * accessing the property directly on the JavaScript object.
5489
+ *
5490
+ * @param configuration The IndexedPropertyHandlerConfiguration that defines
5491
+ * the callbacks to invoke when accessing a property.
5492
+ */
5493
+ void SetHandler(const IndexedPropertyHandlerConfiguration& configuration);
5494
+
4776
5495
  /**
4777
5496
  * Sets the callback to be used when calling instances created from
4778
5497
  * this template as a function. If no callback is set, instances
@@ -4827,6 +5546,17 @@ class V8_EXPORT ObjectTemplate : public Template {
4827
5546
  */
4828
5547
  void SetInternalFieldCount(int value);
4829
5548
 
5549
+ /**
5550
+ * Returns true if the object will be an immutable prototype exotic object.
5551
+ */
5552
+ bool IsImmutableProto();
5553
+
5554
+ /**
5555
+ * Makes the ObjectTempate for an immutable prototype exotic object, with an
5556
+ * immutable __proto__.
5557
+ */
5558
+ void SetImmutableProto();
5559
+
4830
5560
  private:
4831
5561
  ObjectTemplate();
4832
5562
  static Local<ObjectTemplate> New(internal::Isolate* isolate,
@@ -4893,9 +5623,9 @@ class V8_EXPORT Extension { // NOLINT
4893
5623
  const char** deps = 0,
4894
5624
  int source_length = -1);
4895
5625
  virtual ~Extension() { }
4896
- virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate(
4897
- v8::Isolate* isolate, v8::Local<v8::String> name) {
4898
- return v8::Local<v8::FunctionTemplate>();
5626
+ virtual Local<FunctionTemplate> GetNativeFunctionTemplate(
5627
+ Isolate* isolate, Local<String> name) {
5628
+ return Local<FunctionTemplate>();
4899
5629
  }
4900
5630
 
4901
5631
  const char* name() const { return name_; }
@@ -4907,6 +5637,10 @@ class V8_EXPORT Extension { // NOLINT
4907
5637
  void set_auto_enable(bool value) { auto_enable_ = value; }
4908
5638
  bool auto_enable() { return auto_enable_; }
4909
5639
 
5640
+ // Disallow copying and assigning.
5641
+ Extension(const Extension&) = delete;
5642
+ void operator=(const Extension&) = delete;
5643
+
4910
5644
  private:
4911
5645
  const char* name_;
4912
5646
  size_t source_length_; // expected to initialize before source_
@@ -4914,10 +5648,6 @@ class V8_EXPORT Extension { // NOLINT
4914
5648
  int dep_count_;
4915
5649
  const char** deps_;
4916
5650
  bool auto_enable_;
4917
-
4918
- // Disallow copying and assigning.
4919
- Extension(const Extension&);
4920
- void operator=(const Extension&);
4921
5651
  };
4922
5652
 
4923
5653
 
@@ -4978,6 +5708,10 @@ class V8_EXPORT ResourceConstraints {
4978
5708
  void set_code_range_size(size_t limit_in_mb) {
4979
5709
  code_range_size_ = limit_in_mb;
4980
5710
  }
5711
+ size_t max_zone_pool_size() const { return max_zone_pool_size_; }
5712
+ void set_max_zone_pool_size(const size_t bytes) {
5713
+ max_zone_pool_size_ = bytes;
5714
+ }
4981
5715
 
4982
5716
  private:
4983
5717
  int max_semi_space_size_;
@@ -4985,6 +5719,7 @@ class V8_EXPORT ResourceConstraints {
4985
5719
  int max_executable_size_;
4986
5720
  uint32_t* stack_limit_;
4987
5721
  size_t code_range_size_;
5722
+ size_t max_zone_pool_size_;
4988
5723
  };
4989
5724
 
4990
5725
 
@@ -4993,8 +5728,9 @@ class V8_EXPORT ResourceConstraints {
4993
5728
 
4994
5729
  typedef void (*FatalErrorCallback)(const char* location, const char* message);
4995
5730
 
5731
+ typedef void (*OOMErrorCallback)(const char* location, bool is_heap_oom);
4996
5732
 
4997
- typedef void (*MessageCallback)(Local<Message> message, Local<Value> error);
5733
+ typedef void (*MessageCallback)(Local<Message> message, Local<Value> data);
4998
5734
 
4999
5735
  // --- Tracing ---
5000
5736
 
@@ -5063,6 +5799,27 @@ typedef void (*BeforeCallEnteredCallback)(Isolate*);
5063
5799
  typedef void (*CallCompletedCallback)(Isolate*);
5064
5800
  typedef void (*DeprecatedCallCompletedCallback)();
5065
5801
 
5802
+ /**
5803
+ * PromiseHook with type kInit is called when a new promise is
5804
+ * created. When a new promise is created as part of the chain in the
5805
+ * case of Promise.then or in the intermediate promises created by
5806
+ * Promise.{race, all}/AsyncFunctionAwait, we pass the parent promise
5807
+ * otherwise we pass undefined.
5808
+ *
5809
+ * PromiseHook with type kResolve is called at the beginning of
5810
+ * resolve or reject function defined by CreateResolvingFunctions.
5811
+ *
5812
+ * PromiseHook with type kBefore is called at the beginning of the
5813
+ * PromiseReactionJob.
5814
+ *
5815
+ * PromiseHook with type kAfter is called right at the end of the
5816
+ * PromiseReactionJob.
5817
+ */
5818
+ enum class PromiseHookType { kInit, kResolve, kBefore, kAfter };
5819
+
5820
+ typedef void (*PromiseHook)(PromiseHookType type, Local<Promise> promise,
5821
+ Local<Value> parent);
5822
+
5066
5823
  // --- Promise Reject Callback ---
5067
5824
  enum PromiseRejectEvent {
5068
5825
  kPromiseRejectWithNoHandler = 0,
@@ -5142,13 +5899,13 @@ class V8_EXPORT MicrotasksScope {
5142
5899
  */
5143
5900
  static bool IsRunningMicrotasks(Isolate* isolate);
5144
5901
 
5902
+ // Prevent copying.
5903
+ MicrotasksScope(const MicrotasksScope&) = delete;
5904
+ MicrotasksScope& operator=(const MicrotasksScope&) = delete;
5905
+
5145
5906
  private:
5146
5907
  internal::Isolate* const isolate_;
5147
5908
  bool run_;
5148
-
5149
- // Prevent copying.
5150
- MicrotasksScope(const MicrotasksScope&);
5151
- MicrotasksScope& operator=(const MicrotasksScope&);
5152
5909
  };
5153
5910
 
5154
5911
 
@@ -5165,6 +5922,21 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target,
5165
5922
  */
5166
5923
  typedef bool (*AllowCodeGenerationFromStringsCallback)(Local<Context> context);
5167
5924
 
5925
+ // --- WASM compilation callbacks ---
5926
+
5927
+ /**
5928
+ * Callback to check if a buffer source may be compiled to WASM, given
5929
+ * the compilation is attempted as a promise or not.
5930
+ */
5931
+
5932
+ typedef bool (*AllowWasmCompileCallback)(Isolate* isolate, Local<Value> source,
5933
+ bool as_promise);
5934
+
5935
+ typedef bool (*AllowWasmInstantiateCallback)(Isolate* isolate,
5936
+ Local<Value> module_or_bytes,
5937
+ MaybeLocal<Value> ffi,
5938
+ bool as_promise);
5939
+
5168
5940
  // --- Garbage Collection Callbacks ---
5169
5941
 
5170
5942
  /**
@@ -5201,6 +5973,7 @@ enum GCCallbackFlags {
5201
5973
  kGCCallbackFlagForced = 1 << 2,
5202
5974
  kGCCallbackFlagSynchronousPhantomCallbackProcessing = 1 << 3,
5203
5975
  kGCCallbackFlagCollectAllAvailableGarbage = 1 << 4,
5976
+ kGCCallbackFlagCollectAllExternalMemory = 1 << 5,
5204
5977
  };
5205
5978
 
5206
5979
  typedef void (*GCCallback)(GCType type, GCCallbackFlags flags);
@@ -5224,6 +5997,7 @@ class V8_EXPORT HeapStatistics {
5224
5997
  size_t used_heap_size() { return used_heap_size_; }
5225
5998
  size_t heap_size_limit() { return heap_size_limit_; }
5226
5999
  size_t malloced_memory() { return malloced_memory_; }
6000
+ size_t peak_malloced_memory() { return peak_malloced_memory_; }
5227
6001
  size_t does_zap_garbage() { return does_zap_garbage_; }
5228
6002
 
5229
6003
  private:
@@ -5234,6 +6008,7 @@ class V8_EXPORT HeapStatistics {
5234
6008
  size_t used_heap_size_;
5235
6009
  size_t heap_size_limit_;
5236
6010
  size_t malloced_memory_;
6011
+ size_t peak_malloced_memory_;
5237
6012
  bool does_zap_garbage_;
5238
6013
 
5239
6014
  friend class V8;
@@ -5378,16 +6153,13 @@ struct JitCodeEvent {
5378
6153
  * profile/evaluate-performance/rail
5379
6154
  */
5380
6155
  enum RAILMode {
5381
- // Default performance mode: V8 will optimize for both latency and
5382
- // throughput in this mode.
5383
- PERFORMANCE_DEFAULT,
5384
6156
  // Response performance mode: In this mode very low virtual machine latency
5385
6157
  // is provided. V8 will try to avoid JavaScript execution interruptions.
5386
6158
  // Throughput may be throttled.
5387
6159
  PERFORMANCE_RESPONSE,
5388
6160
  // Animation performance mode: In this mode low virtual machine latency is
5389
6161
  // provided. V8 will try to avoid as many JavaScript execution interruptions
5390
- // as possible. Throughput may be throttled
6162
+ // as possible. Throughput may be throttled. This is the default mode.
5391
6163
  PERFORMANCE_ANIMATION,
5392
6164
  // Idle performance mode: The embedder is idle. V8 can complete deferred work
5393
6165
  // in this mode.
@@ -5446,11 +6218,11 @@ class V8_EXPORT PersistentHandleVisitor { // NOLINT
5446
6218
  enum class MemoryPressureLevel { kNone, kModerate, kCritical };
5447
6219
 
5448
6220
  /**
5449
- * Interface for tracing through the embedder heap. During the v8 garbage
6221
+ * Interface for tracing through the embedder heap. During a v8 garbage
5450
6222
  * collection, v8 collects hidden fields of all potential wrappers, and at the
5451
6223
  * end of its marking phase iterates the collection and asks the embedder to
5452
- * trace through its heap and call PersistentBase::RegisterExternalReference on
5453
- * each js object reachable from any of the given wrappers.
6224
+ * trace through its heap and use reporter to report each JavaScript object
6225
+ * reachable from any of the given wrappers.
5454
6226
  *
5455
6227
  * Before the first call to the TraceWrappersFrom function TracePrologue will be
5456
6228
  * called. When the garbage collection cycle is finished, TraceEpilogue will be
@@ -5459,54 +6231,100 @@ enum class MemoryPressureLevel { kNone, kModerate, kCritical };
5459
6231
  class V8_EXPORT EmbedderHeapTracer {
5460
6232
  public:
5461
6233
  enum ForceCompletionAction { FORCE_COMPLETION, DO_NOT_FORCE_COMPLETION };
6234
+
5462
6235
  struct AdvanceTracingActions {
5463
6236
  explicit AdvanceTracingActions(ForceCompletionAction force_completion_)
5464
6237
  : force_completion(force_completion_) {}
5465
6238
 
5466
6239
  ForceCompletionAction force_completion;
5467
6240
  };
6241
+
5468
6242
  /**
5469
- * V8 will call this method with internal fields of found wrappers.
5470
- * Embedder is expected to store them in it's marking deque and trace
5471
- * reachable wrappers from them when asked by AdvanceTracing method.
6243
+ * Called by v8 to register internal fields of found wrappers.
6244
+ *
6245
+ * The embedder is expected to store them somewhere and trace reachable
6246
+ * wrappers from them when called through |AdvanceTracing|.
5472
6247
  */
5473
6248
  virtual void RegisterV8References(
5474
6249
  const std::vector<std::pair<void*, void*> >& internal_fields) = 0;
6250
+
5475
6251
  /**
5476
- * V8 will call this method at the beginning of the gc cycle.
6252
+ * Called at the beginning of a GC cycle.
5477
6253
  */
5478
6254
  virtual void TracePrologue() = 0;
6255
+
5479
6256
  /**
5480
- * Embedder is expected to trace its heap starting from wrappers reported by
5481
- * RegisterV8References method, and call
5482
- * PersistentBase::RegisterExternalReference() on all reachable wrappers.
5483
- * Embedder is expected to stop tracing by the given deadline.
6257
+ * Called to to make a tracing step in the embedder.
6258
+ *
6259
+ * The embedder is expected to trace its heap starting from wrappers reported
6260
+ * by RegisterV8References method, and report back all reachable wrappers.
6261
+ * Furthermore, the embedder is expected to stop tracing by the given
6262
+ * deadline.
5484
6263
  *
5485
6264
  * Returns true if there is still work to do.
5486
6265
  */
5487
6266
  virtual bool AdvanceTracing(double deadline_in_ms,
5488
6267
  AdvanceTracingActions actions) = 0;
6268
+
5489
6269
  /**
5490
- * V8 will call this method at the end of the gc cycle. Allocation is *not*
5491
- * allowed in the TraceEpilogue.
6270
+ * Called at the end of a GC cycle.
6271
+ *
6272
+ * Note that allocation is *not* allowed within |TraceEpilogue|.
5492
6273
  */
5493
6274
  virtual void TraceEpilogue() = 0;
5494
6275
 
5495
6276
  /**
5496
- * Let embedder know v8 entered final marking pause (no more incremental steps
5497
- * will follow).
6277
+ * Called upon entering the final marking pause. No more incremental marking
6278
+ * steps will follow this call.
6279
+ */
6280
+ virtual void EnterFinalPause() = 0;
6281
+
6282
+ /**
6283
+ * Called when tracing is aborted.
6284
+ *
6285
+ * The embedder is expected to throw away all intermediate data and reset to
6286
+ * the initial state.
5498
6287
  */
5499
- virtual void EnterFinalPause() {}
6288
+ virtual void AbortTracing() = 0;
5500
6289
 
5501
6290
  /**
5502
- * Throw away all intermediate data and reset to the initial state.
6291
+ * Returns the number of wrappers that are still to be traced by the embedder.
5503
6292
  */
5504
- virtual void AbortTracing() {}
6293
+ virtual size_t NumberOfWrappersToTrace() { return 0; }
5505
6294
 
5506
6295
  protected:
5507
6296
  virtual ~EmbedderHeapTracer() = default;
5508
6297
  };
5509
6298
 
6299
+ /**
6300
+ * Callback and supporting data used in SnapshotCreator to implement embedder
6301
+ * logic to serialize internal fields.
6302
+ */
6303
+ struct SerializeInternalFieldsCallback {
6304
+ typedef StartupData (*CallbackFunction)(Local<Object> holder, int index,
6305
+ void* data);
6306
+ SerializeInternalFieldsCallback(CallbackFunction function = nullptr,
6307
+ void* data_arg = nullptr)
6308
+ : callback(function), data(data_arg) {}
6309
+ CallbackFunction callback;
6310
+ void* data;
6311
+ };
6312
+
6313
+ /**
6314
+ * Callback and supporting data used to implement embedder logic to deserialize
6315
+ * internal fields.
6316
+ */
6317
+ struct DeserializeInternalFieldsCallback {
6318
+ typedef void (*CallbackFunction)(Local<Object> holder, int index,
6319
+ StartupData payload, void* data);
6320
+ DeserializeInternalFieldsCallback(CallbackFunction function = nullptr,
6321
+ void* data_arg = nullptr)
6322
+ : callback(function), data(data_arg) {}
6323
+ void (*callback)(Local<Object> holder, int index, StartupData payload,
6324
+ void* data);
6325
+ void* data;
6326
+ };
6327
+
5510
6328
  /**
5511
6329
  * Isolate represents an isolated instance of the V8 engine. V8 isolates have
5512
6330
  * completely separate states. Objects from one isolate must not be used in
@@ -5600,12 +6418,12 @@ class V8_EXPORT Isolate {
5600
6418
 
5601
6419
  ~Scope() { isolate_->Exit(); }
5602
6420
 
6421
+ // Prevent copying of Scope objects.
6422
+ Scope(const Scope&) = delete;
6423
+ Scope& operator=(const Scope&) = delete;
6424
+
5603
6425
  private:
5604
6426
  Isolate* const isolate_;
5605
-
5606
- // Prevent copying of Scope objects.
5607
- Scope(const Scope&);
5608
- Scope& operator=(const Scope&);
5609
6427
  };
5610
6428
 
5611
6429
 
@@ -5619,14 +6437,15 @@ class V8_EXPORT Isolate {
5619
6437
  DisallowJavascriptExecutionScope(Isolate* isolate, OnFailure on_failure);
5620
6438
  ~DisallowJavascriptExecutionScope();
5621
6439
 
6440
+ // Prevent copying of Scope objects.
6441
+ DisallowJavascriptExecutionScope(const DisallowJavascriptExecutionScope&) =
6442
+ delete;
6443
+ DisallowJavascriptExecutionScope& operator=(
6444
+ const DisallowJavascriptExecutionScope&) = delete;
6445
+
5622
6446
  private:
5623
6447
  bool on_failure_;
5624
6448
  void* internal_;
5625
-
5626
- // Prevent copying of Scope objects.
5627
- DisallowJavascriptExecutionScope(const DisallowJavascriptExecutionScope&);
5628
- DisallowJavascriptExecutionScope& operator=(
5629
- const DisallowJavascriptExecutionScope&);
5630
6449
  };
5631
6450
 
5632
6451
 
@@ -5638,14 +6457,15 @@ class V8_EXPORT Isolate {
5638
6457
  explicit AllowJavascriptExecutionScope(Isolate* isolate);
5639
6458
  ~AllowJavascriptExecutionScope();
5640
6459
 
6460
+ // Prevent copying of Scope objects.
6461
+ AllowJavascriptExecutionScope(const AllowJavascriptExecutionScope&) =
6462
+ delete;
6463
+ AllowJavascriptExecutionScope& operator=(
6464
+ const AllowJavascriptExecutionScope&) = delete;
6465
+
5641
6466
  private:
5642
6467
  void* internal_throws_;
5643
6468
  void* internal_assert_;
5644
-
5645
- // Prevent copying of Scope objects.
5646
- AllowJavascriptExecutionScope(const AllowJavascriptExecutionScope&);
5647
- AllowJavascriptExecutionScope& operator=(
5648
- const AllowJavascriptExecutionScope&);
5649
6469
  };
5650
6470
 
5651
6471
  /**
@@ -5657,13 +6477,14 @@ class V8_EXPORT Isolate {
5657
6477
  explicit SuppressMicrotaskExecutionScope(Isolate* isolate);
5658
6478
  ~SuppressMicrotaskExecutionScope();
5659
6479
 
5660
- private:
5661
- internal::Isolate* isolate_;
5662
-
5663
6480
  // Prevent copying of Scope objects.
5664
- SuppressMicrotaskExecutionScope(const SuppressMicrotaskExecutionScope&);
6481
+ SuppressMicrotaskExecutionScope(const SuppressMicrotaskExecutionScope&) =
6482
+ delete;
5665
6483
  SuppressMicrotaskExecutionScope& operator=(
5666
- const SuppressMicrotaskExecutionScope&);
6484
+ const SuppressMicrotaskExecutionScope&) = delete;
6485
+
6486
+ private:
6487
+ internal::Isolate* const isolate_;
5667
6488
  };
5668
6489
 
5669
6490
  /**
@@ -5716,12 +6537,26 @@ class V8_EXPORT Isolate {
5716
6537
  kDecimalWithLeadingZeroInStrictMode = 32,
5717
6538
  kLegacyDateParser = 33,
5718
6539
  kDefineGetterOrSetterWouldThrow = 34,
6540
+ kFunctionConstructorReturnedUndefined = 35,
6541
+ kAssigmentExpressionLHSIsCallInSloppy = 36,
6542
+ kAssigmentExpressionLHSIsCallInStrict = 37,
6543
+ kPromiseConstructorReturnedUndefined = 38,
5719
6544
 
5720
6545
  // If you add new values here, you'll also need to update Chromium's:
5721
6546
  // UseCounter.h, V8PerIsolateData.cpp, histograms.xml
5722
6547
  kUseCounterFeatureCount // This enum value must be last.
5723
6548
  };
5724
6549
 
6550
+ enum MessageErrorLevel {
6551
+ kMessageLog = (1 << 0),
6552
+ kMessageDebug = (1 << 1),
6553
+ kMessageInfo = (1 << 2),
6554
+ kMessageError = (1 << 3),
6555
+ kMessageWarning = (1 << 4),
6556
+ kMessageAll = kMessageLog | kMessageDebug | kMessageInfo | kMessageError |
6557
+ kMessageWarning,
6558
+ };
6559
+
5725
6560
  typedef void (*UseCounterCallback)(Isolate* isolate,
5726
6561
  UseCounterFeature feature);
5727
6562
 
@@ -5916,7 +6751,8 @@ class V8_EXPORT Isolate {
5916
6751
  * is initialized. It is the embedder's responsibility to stop all CPU
5917
6752
  * profiling activities if it has started any.
5918
6753
  */
5919
- CpuProfiler* GetCpuProfiler();
6754
+ V8_DEPRECATE_SOON("CpuProfiler should be created with CpuProfiler::New call.",
6755
+ CpuProfiler* GetCpuProfiler());
5920
6756
 
5921
6757
  /** Returns true if this isolate has a current context. */
5922
6758
  bool InContext();
@@ -5959,8 +6795,10 @@ class V8_EXPORT Isolate {
5959
6795
  * garbage collection types it is sufficient to provide object groups
5960
6796
  * for partially dependent handles only.
5961
6797
  */
5962
- template<typename T> void SetObjectGroupId(const Persistent<T>& object,
5963
- UniqueId id);
6798
+ template <typename T>
6799
+ V8_DEPRECATE_SOON("Use EmbedderHeapTracer",
6800
+ void SetObjectGroupId(const Persistent<T>& object,
6801
+ UniqueId id));
5964
6802
 
5965
6803
  /**
5966
6804
  * Allows the host application to declare implicit references from an object
@@ -5969,8 +6807,10 @@ class V8_EXPORT Isolate {
5969
6807
  * are removed. It is intended to be used in the before-garbage-collection
5970
6808
  * callback function.
5971
6809
  */
5972
- template<typename T> void SetReferenceFromGroup(UniqueId id,
5973
- const Persistent<T>& child);
6810
+ template <typename T>
6811
+ V8_DEPRECATE_SOON("Use EmbedderHeapTracer",
6812
+ void SetReferenceFromGroup(UniqueId id,
6813
+ const Persistent<T>& child));
5974
6814
 
5975
6815
  /**
5976
6816
  * Allows the host application to declare implicit references from an object
@@ -5978,8 +6818,10 @@ class V8_EXPORT Isolate {
5978
6818
  * too. After each garbage collection, all implicit references are removed. It
5979
6819
  * is intended to be used in the before-garbage-collection callback function.
5980
6820
  */
5981
- template<typename T, typename S>
5982
- void SetReference(const Persistent<T>& parent, const Persistent<S>& child);
6821
+ template <typename T, typename S>
6822
+ V8_DEPRECATE_SOON("Use EmbedderHeapTracer",
6823
+ void SetReference(const Persistent<T>& parent,
6824
+ const Persistent<S>& child));
5983
6825
 
5984
6826
  typedef void (*GCCallback)(Isolate* isolate, GCType type,
5985
6827
  GCCallbackFlags flags);
@@ -6121,6 +6963,12 @@ class V8_EXPORT Isolate {
6121
6963
  void RemoveCallCompletedCallback(
6122
6964
  DeprecatedCallCompletedCallback callback));
6123
6965
 
6966
+ /**
6967
+ * Experimental: Set the PromiseHook callback for various promise
6968
+ * lifecycle events.
6969
+ */
6970
+ void SetPromiseHook(PromiseHook hook);
6971
+
6124
6972
  /**
6125
6973
  * Set callback to notify about promise reject with no handler, or
6126
6974
  * revocation of such a previous notification once the handler is added.
@@ -6254,6 +7102,23 @@ class V8_EXPORT Isolate {
6254
7102
  */
6255
7103
  void SetRAILMode(RAILMode rail_mode);
6256
7104
 
7105
+ /**
7106
+ * Optional notification to tell V8 the current isolate is used for debugging
7107
+ * and requires higher heap limit.
7108
+ */
7109
+ void IncreaseHeapLimitForDebugging();
7110
+
7111
+ /**
7112
+ * Restores the original heap limit after IncreaseHeapLimitForDebugging().
7113
+ */
7114
+ void RestoreOriginalHeapLimit();
7115
+
7116
+ /**
7117
+ * Returns true if the heap limit was increased for debugging and the
7118
+ * original heap limit was not restored yet.
7119
+ */
7120
+ bool IsHeapLimitIncreasedForDebugging();
7121
+
6257
7122
  /**
6258
7123
  * Allows the host application to provide the address of a function that is
6259
7124
  * notified each time code is added, moved or removed.
@@ -6308,6 +7173,9 @@ class V8_EXPORT Isolate {
6308
7173
  /** Set the callback to invoke in case of fatal errors. */
6309
7174
  void SetFatalErrorHandler(FatalErrorCallback that);
6310
7175
 
7176
+ /** Set the callback to invoke in case of OOM errors. */
7177
+ void SetOOMErrorHandler(OOMErrorCallback that);
7178
+
6311
7179
  /**
6312
7180
  * Set the callback to invoke to check if code generation from
6313
7181
  * strings should be allowed.
@@ -6315,6 +7183,16 @@ class V8_EXPORT Isolate {
6315
7183
  void SetAllowCodeGenerationFromStringsCallback(
6316
7184
  AllowCodeGenerationFromStringsCallback callback);
6317
7185
 
7186
+ /**
7187
+ * Set the callback to invoke to check if wasm compilation from
7188
+ * the specified object is allowed. By default, wasm compilation
7189
+ * is allowed.
7190
+ *
7191
+ * Similar for instantiate.
7192
+ */
7193
+ void SetAllowWasmCompileCallback(AllowWasmCompileCallback callback);
7194
+ void SetAllowWasmInstantiateCallback(AllowWasmInstantiateCallback callback);
7195
+
6318
7196
  /**
6319
7197
  * Check if V8 is dead and therefore unusable. This is the case after
6320
7198
  * fatal errors such as out-of-memory situations.
@@ -6322,7 +7200,7 @@ class V8_EXPORT Isolate {
6322
7200
  bool IsDead();
6323
7201
 
6324
7202
  /**
6325
- * Adds a message listener.
7203
+ * Adds a message listener (errors only).
6326
7204
  *
6327
7205
  * The same message listener can be added more than once and in that
6328
7206
  * case it will be called more than once for each message.
@@ -6333,6 +7211,21 @@ class V8_EXPORT Isolate {
6333
7211
  bool AddMessageListener(MessageCallback that,
6334
7212
  Local<Value> data = Local<Value>());
6335
7213
 
7214
+ /**
7215
+ * Adds a message listener.
7216
+ *
7217
+ * The same message listener can be added more than once and in that
7218
+ * case it will be called more than once for each message.
7219
+ *
7220
+ * If data is specified, it will be passed to the callback when it is called.
7221
+ * Otherwise, the exception object will be passed to the callback instead.
7222
+ *
7223
+ * A listener can listen for particular error levels by providing a mask.
7224
+ */
7225
+ bool AddMessageListenerWithErrorLevel(MessageCallback that,
7226
+ int message_levels,
7227
+ Local<Value> data = Local<Value>());
7228
+
6336
7229
  /**
6337
7230
  * Remove all message listeners from the specified callback function.
6338
7231
  */
@@ -6384,17 +7277,17 @@ class V8_EXPORT Isolate {
6384
7277
  */
6385
7278
  bool IsInUse();
6386
7279
 
7280
+ Isolate() = delete;
7281
+ ~Isolate() = delete;
7282
+ Isolate(const Isolate&) = delete;
7283
+ Isolate& operator=(const Isolate&) = delete;
7284
+ void* operator new(size_t size) = delete;
7285
+ void operator delete(void*, size_t) = delete;
7286
+
6387
7287
  private:
6388
7288
  template <class K, class V, class Traits>
6389
7289
  friend class PersistentValueMapBase;
6390
7290
 
6391
- Isolate();
6392
- Isolate(const Isolate&);
6393
- ~Isolate();
6394
- Isolate& operator=(const Isolate&);
6395
- void* operator new(size_t size);
6396
- void operator delete(void*, size_t);
6397
-
6398
7291
  void SetObjectGroupId(internal::Object** object, UniqueId id);
6399
7292
  void SetReferenceFromGroup(UniqueId id, internal::Object** object);
6400
7293
  void SetReference(internal::Object** parent, internal::Object** child);
@@ -6414,19 +7307,18 @@ class V8_EXPORT StartupData {
6414
7307
  */
6415
7308
  typedef bool (*EntropySource)(unsigned char* buffer, size_t length);
6416
7309
 
6417
-
6418
7310
  /**
6419
7311
  * ReturnAddressLocationResolver is used as a callback function when v8 is
6420
7312
  * resolving the location of a return address on the stack. Profilers that
6421
7313
  * change the return address on the stack can use this to resolve the stack
6422
7314
  * location to whereever the profiler stashed the original return address.
6423
7315
  *
6424
- * \param return_addr_location points to a location on stack where a machine
7316
+ * \param return_addr_location A location on stack where a machine
6425
7317
  * return address resides.
6426
- * \returns either return_addr_location, or else a pointer to the profiler's
7318
+ * \returns Either return_addr_location, or else a pointer to the profiler's
6427
7319
  * copy of the original return address.
6428
7320
  *
6429
- * \note the resolver function must not cause garbage collection.
7321
+ * \note The resolver function must not cause garbage collection.
6430
7322
  */
6431
7323
  typedef uintptr_t (*ReturnAddressLocationResolver)(
6432
7324
  uintptr_t return_addr_location);
@@ -6784,6 +7676,7 @@ class V8_EXPORT V8 {
6784
7676
 
6785
7677
  static void RegisterExternallyReferencedObject(internal::Object** object,
6786
7678
  internal::Isolate* isolate);
7679
+
6787
7680
  template <class K, class V, class T>
6788
7681
  friend class PersistentValueMapBase;
6789
7682
 
@@ -6806,7 +7699,7 @@ class V8_EXPORT V8 {
6806
7699
  /**
6807
7700
  * Helper class to create a snapshot data blob.
6808
7701
  */
6809
- class SnapshotCreator {
7702
+ class V8_EXPORT SnapshotCreator {
6810
7703
  public:
6811
7704
  enum class FunctionCodeHandling { kClear, kKeep };
6812
7705
 
@@ -6829,10 +7722,23 @@ class SnapshotCreator {
6829
7722
  Isolate* GetIsolate();
6830
7723
 
6831
7724
  /**
6832
- * Add a context to be included in the snapshot blob.
7725
+ * Set the default context to be included in the snapshot blob.
7726
+ * The snapshot will not contain the global proxy, and we expect one or a
7727
+ * global object template to create one, to be provided upon deserialization.
7728
+ */
7729
+ void SetDefaultContext(Local<Context> context);
7730
+
7731
+ /**
7732
+ * Add additional context to be included in the snapshot blob.
7733
+ * The snapshot will include the global proxy.
7734
+ *
7735
+ * \param callback optional callback to serialize internal fields.
7736
+ *
6833
7737
  * \returns the index of the context in the snapshot blob.
6834
7738
  */
6835
- size_t AddContext(Local<Context> context);
7739
+ size_t AddContext(Local<Context> context,
7740
+ SerializeInternalFieldsCallback callback =
7741
+ SerializeInternalFieldsCallback());
6836
7742
 
6837
7743
  /**
6838
7744
  * Add a template to be included in the snapshot blob.
@@ -6850,12 +7756,12 @@ class SnapshotCreator {
6850
7756
  */
6851
7757
  StartupData CreateBlob(FunctionCodeHandling function_code_handling);
6852
7758
 
7759
+ // Disallow copying and assigning.
7760
+ SnapshotCreator(const SnapshotCreator&) = delete;
7761
+ void operator=(const SnapshotCreator&) = delete;
7762
+
6853
7763
  private:
6854
7764
  void* data_;
6855
-
6856
- // Disallow copying and assigning.
6857
- SnapshotCreator(const SnapshotCreator&);
6858
- void operator=(const SnapshotCreator&);
6859
7765
  };
6860
7766
 
6861
7767
  /**
@@ -6871,17 +7777,25 @@ class SnapshotCreator {
6871
7777
  template <class T>
6872
7778
  class Maybe {
6873
7779
  public:
6874
- V8_INLINE bool IsNothing() const { return !has_value; }
6875
- V8_INLINE bool IsJust() const { return has_value; }
7780
+ V8_INLINE bool IsNothing() const { return !has_value_; }
7781
+ V8_INLINE bool IsJust() const { return has_value_; }
7782
+
7783
+ // Will crash if the Maybe<> is nothing.
7784
+ V8_INLINE T ToChecked() const { return FromJust(); }
7785
+
7786
+ V8_WARN_UNUSED_RESULT V8_INLINE bool To(T* out) const {
7787
+ if (V8_LIKELY(IsJust())) *out = value_;
7788
+ return IsJust();
7789
+ }
6876
7790
 
6877
7791
  // Will crash if the Maybe<> is nothing.
6878
7792
  V8_INLINE T FromJust() const {
6879
7793
  if (V8_UNLIKELY(!IsJust())) V8::FromJustIsNothing();
6880
- return value;
7794
+ return value_;
6881
7795
  }
6882
7796
 
6883
7797
  V8_INLINE T FromMaybe(const T& default_value) const {
6884
- return has_value ? value : default_value;
7798
+ return has_value_ ? value_ : default_value;
6885
7799
  }
6886
7800
 
6887
7801
  V8_INLINE bool operator==(const Maybe& other) const {
@@ -6894,11 +7808,11 @@ class Maybe {
6894
7808
  }
6895
7809
 
6896
7810
  private:
6897
- Maybe() : has_value(false) {}
6898
- explicit Maybe(const T& t) : has_value(true), value(t) {}
7811
+ Maybe() : has_value_(false) {}
7812
+ explicit Maybe(const T& t) : has_value_(true), value_(t) {}
6899
7813
 
6900
- bool has_value;
6901
- T value;
7814
+ bool has_value_;
7815
+ T value_;
6902
7816
 
6903
7817
  template <class U>
6904
7818
  friend Maybe<U> Nothing();
@@ -7046,22 +7960,21 @@ class V8_EXPORT TryCatch {
7046
7960
  * UseAfterReturn is enabled, then the address returned will be the address
7047
7961
  * of the C++ try catch handler itself.
7048
7962
  */
7049
- static void* JSStackComparableAddress(v8::TryCatch* handler) {
7963
+ static void* JSStackComparableAddress(TryCatch* handler) {
7050
7964
  if (handler == NULL) return NULL;
7051
7965
  return handler->js_stack_comparable_address_;
7052
7966
  }
7053
7967
 
7054
- private:
7055
- void ResetInternal();
7056
-
7057
- // Make it hard to create heap-allocated TryCatch blocks.
7058
- TryCatch(const TryCatch&);
7059
- void operator=(const TryCatch&);
7968
+ TryCatch(const TryCatch&) = delete;
7969
+ void operator=(const TryCatch&) = delete;
7060
7970
  void* operator new(size_t size);
7061
7971
  void operator delete(void*, size_t);
7062
7972
 
7063
- v8::internal::Isolate* isolate_;
7064
- v8::TryCatch* next_;
7973
+ private:
7974
+ void ResetInternal();
7975
+
7976
+ internal::Isolate* isolate_;
7977
+ TryCatch* next_;
7065
7978
  void* exception_;
7066
7979
  void* message_obj_;
7067
7980
  void* js_stack_comparable_address_;
@@ -7071,7 +7984,7 @@ class V8_EXPORT TryCatch {
7071
7984
  bool rethrow_ : 1;
7072
7985
  bool has_terminated_ : 1;
7073
7986
 
7074
- friend class v8::internal::Isolate;
7987
+ friend class internal::Isolate;
7075
7988
  };
7076
7989
 
7077
7990
 
@@ -7095,7 +8008,6 @@ class V8_EXPORT ExtensionConfiguration {
7095
8008
  const char** names_;
7096
8009
  };
7097
8010
 
7098
-
7099
8011
  /**
7100
8012
  * A sandboxed execution context with its own set of built-in objects
7101
8013
  * and functions.
@@ -7142,9 +8054,55 @@ class V8_EXPORT Context {
7142
8054
  */
7143
8055
  static Local<Context> New(
7144
8056
  Isolate* isolate, ExtensionConfiguration* extensions = NULL,
7145
- Local<ObjectTemplate> global_template = Local<ObjectTemplate>(),
7146
- Local<Value> global_object = Local<Value>(),
7147
- size_t context_snapshot_index = 0);
8057
+ MaybeLocal<ObjectTemplate> global_template = MaybeLocal<ObjectTemplate>(),
8058
+ MaybeLocal<Value> global_object = MaybeLocal<Value>());
8059
+
8060
+ /**
8061
+ * Create a new context from a (non-default) context snapshot. There
8062
+ * is no way to provide a global object template since we do not create
8063
+ * a new global object from template, but we can reuse a global object.
8064
+ *
8065
+ * \param isolate See v8::Context::New.
8066
+ *
8067
+ * \param context_snapshot_index The index of the context snapshot to
8068
+ * deserialize from. Use v8::Context::New for the default snapshot.
8069
+ *
8070
+ * \param internal_fields_deserializer Optional callback to deserialize
8071
+ * internal fields. It should match the SerializeInternalFieldCallback used
8072
+ * to serialize.
8073
+ *
8074
+ * \param extensions See v8::Context::New.
8075
+ *
8076
+ * \param global_object See v8::Context::New.
8077
+ */
8078
+
8079
+ static MaybeLocal<Context> FromSnapshot(
8080
+ Isolate* isolate, size_t context_snapshot_index,
8081
+ DeserializeInternalFieldsCallback internal_fields_deserializer =
8082
+ DeserializeInternalFieldsCallback(),
8083
+ ExtensionConfiguration* extensions = nullptr,
8084
+ MaybeLocal<Value> global_object = MaybeLocal<Value>());
8085
+
8086
+ /**
8087
+ * Returns an global object that isn't backed by an actual context.
8088
+ *
8089
+ * The global template needs to have access checks with handlers installed.
8090
+ * If an existing global object is passed in, the global object is detached
8091
+ * from its context.
8092
+ *
8093
+ * Note that this is different from a detached context where all accesses to
8094
+ * the global proxy will fail. Instead, the access check handlers are invoked.
8095
+ *
8096
+ * It is also not possible to detach an object returned by this method.
8097
+ * Instead, the access check handlers need to return nothing to achieve the
8098
+ * same effect.
8099
+ *
8100
+ * It is possible, however, to create a new context from the global object
8101
+ * returned by this method.
8102
+ */
8103
+ static MaybeLocal<Object> NewRemoteContext(
8104
+ Isolate* isolate, Local<ObjectTemplate> global_template,
8105
+ MaybeLocal<Value> global_object = MaybeLocal<Value>());
7148
8106
 
7149
8107
  /**
7150
8108
  * Sets the security token for the context. To access an object in
@@ -7173,7 +8131,7 @@ class V8_EXPORT Context {
7173
8131
  void Exit();
7174
8132
 
7175
8133
  /** Returns an isolate associated with a current context. */
7176
- v8::Isolate* GetIsolate();
8134
+ Isolate* GetIsolate();
7177
8135
 
7178
8136
  /**
7179
8137
  * The field at kDebugIdIndex is reserved for V8 debugger implementation.
@@ -7206,7 +8164,7 @@ class V8_EXPORT Context {
7206
8164
 
7207
8165
  /**
7208
8166
  * Gets a 2-byte-aligned native pointer from the embedder data with the given
7209
- * index, which must have bees set by a previous call to
8167
+ * index, which must have been set by a previous call to
7210
8168
  * SetAlignedPointerInEmbedderData with the same index. Note that index 0
7211
8169
  * currently has a special meaning for Chrome's debugger.
7212
8170
  */
@@ -7286,7 +8244,7 @@ class V8_EXPORT Context {
7286
8244
  * It is up to the user of V8 to ensure, perhaps with locking, that this
7287
8245
  * constraint is not violated. In addition to any other synchronization
7288
8246
  * mechanism that may be used, the v8::Locker and v8::Unlocker classes must be
7289
- * used to signal thead switches to V8.
8247
+ * used to signal thread switches to V8.
7290
8248
  *
7291
8249
  * v8::Locker is a scoped lock object. While it's active, i.e. between its
7292
8250
  * construction and destruction, the current thread is allowed to use the locked
@@ -7389,16 +8347,16 @@ class V8_EXPORT Locker {
7389
8347
  */
7390
8348
  static bool IsActive();
7391
8349
 
8350
+ // Disallow copying and assigning.
8351
+ Locker(const Locker&) = delete;
8352
+ void operator=(const Locker&) = delete;
8353
+
7392
8354
  private:
7393
8355
  void Initialize(Isolate* isolate);
7394
8356
 
7395
8357
  bool has_lock_;
7396
8358
  bool top_level_;
7397
8359
  internal::Isolate* isolate_;
7398
-
7399
- // Disallow copying and assigning.
7400
- Locker(const Locker&);
7401
- void operator=(const Locker&);
7402
8360
  };
7403
8361
 
7404
8362
 
@@ -7499,7 +8457,7 @@ class Internals {
7499
8457
  1 * kApiPointerSize + kApiIntSize;
7500
8458
  static const int kStringResourceOffset = 3 * kApiPointerSize;
7501
8459
 
7502
- static const int kOddballKindOffset = 5 * kApiPointerSize + sizeof(double);
8460
+ static const int kOddballKindOffset = 4 * kApiPointerSize + sizeof(double);
7503
8461
  static const int kForeignAddressOffset = kApiPointerSize;
7504
8462
  static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
7505
8463
  static const int kFixedArrayHeaderSize = 2 * kApiPointerSize;
@@ -7531,11 +8489,10 @@ class Internals {
7531
8489
  static const int kNodeStateIsPendingValue = 3;
7532
8490
  static const int kNodeStateIsNearDeathValue = 4;
7533
8491
  static const int kNodeIsIndependentShift = 3;
7534
- static const int kNodeIsPartiallyDependentShift = 4;
7535
8492
  static const int kNodeIsActiveShift = 4;
7536
8493
 
7537
- static const int kJSObjectType = 0xb7;
7538
- static const int kJSApiObjectType = 0xb6;
8494
+ static const int kJSApiObjectType = 0xbb;
8495
+ static const int kJSObjectType = 0xbc;
7539
8496
  static const int kFirstNonstringType = 0x80;
7540
8497
  static const int kOddballType = 0x83;
7541
8498
  static const int kForeignType = 0x87;
@@ -7827,17 +8784,6 @@ void PersistentBase<T>::MarkIndependent() {
7827
8784
  I::kNodeIsIndependentShift);
7828
8785
  }
7829
8786
 
7830
-
7831
- template <class T>
7832
- void PersistentBase<T>::MarkPartiallyDependent() {
7833
- typedef internal::Internals I;
7834
- if (this->IsEmpty()) return;
7835
- I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
7836
- true,
7837
- I::kNodeIsPartiallyDependentShift);
7838
- }
7839
-
7840
-
7841
8787
  template <class T>
7842
8788
  void PersistentBase<T>::MarkActive() {
7843
8789
  typedef internal::Internals I;
@@ -8065,17 +9011,16 @@ ScriptOrigin::ScriptOrigin(Local<Value> resource_name,
8065
9011
  Local<Integer> resource_column_offset,
8066
9012
  Local<Boolean> resource_is_shared_cross_origin,
8067
9013
  Local<Integer> script_id,
8068
- Local<Boolean> resource_is_embedder_debug_script,
8069
9014
  Local<Value> source_map_url,
8070
- Local<Boolean> resource_is_opaque)
9015
+ Local<Boolean> resource_is_opaque,
9016
+ Local<Boolean> is_wasm)
8071
9017
  : resource_name_(resource_name),
8072
9018
  resource_line_offset_(resource_line_offset),
8073
9019
  resource_column_offset_(resource_column_offset),
8074
- options_(!resource_is_embedder_debug_script.IsEmpty() &&
8075
- resource_is_embedder_debug_script->IsTrue(),
8076
- !resource_is_shared_cross_origin.IsEmpty() &&
9020
+ options_(!resource_is_shared_cross_origin.IsEmpty() &&
8077
9021
  resource_is_shared_cross_origin->IsTrue(),
8078
- !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue()),
9022
+ !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue(),
9023
+ !is_wasm.IsEmpty() && is_wasm->IsTrue()),
8079
9024
  script_id_(script_id),
8080
9025
  source_map_url_(source_map_url) {}
8081
9026
 
@@ -8129,9 +9074,8 @@ Local<Boolean> Boolean::New(Isolate* isolate, bool value) {
8129
9074
  return value ? True(isolate) : False(isolate);
8130
9075
  }
8131
9076
 
8132
-
8133
- void Template::Set(Isolate* isolate, const char* name, v8::Local<Data> value) {
8134
- Set(v8::String::NewFromUtf8(isolate, name, NewStringType::kNormal)
9077
+ void Template::Set(Isolate* isolate, const char* name, Local<Data> value) {
9078
+ Set(String::NewFromUtf8(isolate, name, NewStringType::kNormal)
8135
9079
  .ToLocalChecked(),
8136
9080
  value);
8137
9081
  }
@@ -8175,7 +9119,6 @@ void* Object::GetAlignedPointerFromInternalField(int index) {
8175
9119
  return SlowGetAlignedPointerFromInternalField(index);
8176
9120
  }
8177
9121
 
8178
-
8179
9122
  String* String::Cast(v8::Value* value) {
8180
9123
  #ifdef V8_ENABLE_CHECKS
8181
9124
  CheckCast(value);
@@ -8266,6 +9209,23 @@ bool Value::QuickIsNull() const {
8266
9209
  return (I::GetOddballKind(obj) == I::kNullOddballKind);
8267
9210
  }
8268
9211
 
9212
+ bool Value::IsNullOrUndefined() const {
9213
+ #ifdef V8_ENABLE_CHECKS
9214
+ return FullIsNull() || FullIsUndefined();
9215
+ #else
9216
+ return QuickIsNullOrUndefined();
9217
+ #endif
9218
+ }
9219
+
9220
+ bool Value::QuickIsNullOrUndefined() const {
9221
+ typedef internal::Object O;
9222
+ typedef internal::Internals I;
9223
+ O* obj = *reinterpret_cast<O* const*>(this);
9224
+ if (!I::HasHeapObjectTag(obj)) return false;
9225
+ if (I::GetInstanceType(obj) != I::kOddballType) return false;
9226
+ int kind = I::GetOddballKind(obj);
9227
+ return kind == I::kNullOddballKind || kind == I::kUndefinedOddballKind;
9228
+ }
8269
9229
 
8270
9230
  bool Value::IsString() const {
8271
9231
  #ifdef V8_ENABLE_CHECKS
@@ -8488,6 +9448,12 @@ Proxy* Proxy::Cast(v8::Value* value) {
8488
9448
  return static_cast<Proxy*>(value);
8489
9449
  }
8490
9450
 
9451
+ WasmCompiledModule* WasmCompiledModule::Cast(v8::Value* value) {
9452
+ #ifdef V8_ENABLE_CHECKS
9453
+ CheckCast(value);
9454
+ #endif
9455
+ return static_cast<WasmCompiledModule*>(value);
9456
+ }
8491
9457
 
8492
9458
  Promise::Resolver* Promise::Resolver::Cast(v8::Value* value) {
8493
9459
  #ifdef V8_ENABLE_CHECKS
@@ -8735,7 +9701,7 @@ template<typename T>
8735
9701
  void Isolate::SetObjectGroupId(const Persistent<T>& object,
8736
9702
  UniqueId id) {
8737
9703
  TYPE_CHECK(Value, T);
8738
- SetObjectGroupId(reinterpret_cast<v8::internal::Object**>(object.val_), id);
9704
+ SetObjectGroupId(reinterpret_cast<internal::Object**>(object.val_), id);
8739
9705
  }
8740
9706
 
8741
9707
 
@@ -8743,8 +9709,7 @@ template<typename T>
8743
9709
  void Isolate::SetReferenceFromGroup(UniqueId id,
8744
9710
  const Persistent<T>& object) {
8745
9711
  TYPE_CHECK(Value, T);
8746
- SetReferenceFromGroup(id,
8747
- reinterpret_cast<v8::internal::Object**>(object.val_));
9712
+ SetReferenceFromGroup(id, reinterpret_cast<internal::Object**>(object.val_));
8748
9713
  }
8749
9714
 
8750
9715
 
@@ -8753,8 +9718,8 @@ void Isolate::SetReference(const Persistent<T>& parent,
8753
9718
  const Persistent<S>& child) {
8754
9719
  TYPE_CHECK(Object, T);
8755
9720
  TYPE_CHECK(Value, S);
8756
- SetReference(reinterpret_cast<v8::internal::Object**>(parent.val_),
8757
- reinterpret_cast<v8::internal::Object**>(child.val_));
9721
+ SetReference(reinterpret_cast<internal::Object**>(parent.val_),
9722
+ reinterpret_cast<internal::Object**>(child.val_));
8758
9723
  }
8759
9724
 
8760
9725
 
@@ -8828,18 +9793,17 @@ void V8::SetFatalErrorHandler(FatalErrorCallback callback) {
8828
9793
  isolate->SetFatalErrorHandler(callback);
8829
9794
  }
8830
9795
 
8831
-
8832
9796
  void V8::RemoveGCPrologueCallback(GCCallback callback) {
8833
9797
  Isolate* isolate = Isolate::GetCurrent();
8834
9798
  isolate->RemoveGCPrologueCallback(
8835
- reinterpret_cast<v8::Isolate::GCCallback>(callback));
9799
+ reinterpret_cast<Isolate::GCCallback>(callback));
8836
9800
  }
8837
9801
 
8838
9802
 
8839
9803
  void V8::RemoveGCEpilogueCallback(GCCallback callback) {
8840
9804
  Isolate* isolate = Isolate::GetCurrent();
8841
9805
  isolate->RemoveGCEpilogueCallback(
8842
- reinterpret_cast<v8::Isolate::GCCallback>(callback));
9806
+ reinterpret_cast<Isolate::GCCallback>(callback));
8843
9807
  }
8844
9808
 
8845
9809
  void V8::TerminateExecution(Isolate* isolate) { isolate->TerminateExecution(); }