@@ -123,6 +123,7 @@ class ExternalString;
123123class Isolate ;
124124class LocalEmbedderHeapTracer ;
125125class MicrotaskQueue ;
126+ class NeverReadOnlySpaceObject ;
126127struct ScriptStreamingData ;
127128template <typename T> class CustomArguments ;
128129class PropertyCallbackArguments ;
@@ -546,6 +547,38 @@ template <class T> class PersistentBase {
546547 */
547548 V8_INLINE void AnnotateStrongRetainer (const char * label);
548549
550+ /* *
551+ * Allows the embedder to tell the v8 garbage collector that a certain object
552+ * is alive. Only allowed when the embedder is asked to trace its heap by
553+ * EmbedderHeapTracer.
554+ */
555+ V8_DEPRECATED (
556+ " Used TracedGlobal and EmbedderHeapTracer::RegisterEmbedderReference" ,
557+ V8_INLINE void RegisterExternalReference (Isolate* isolate) const );
558+
559+ /* *
560+ * Marks the reference to this object independent. Garbage collector is free
561+ * to ignore any object groups containing this object. Weak callback for an
562+ * independent handle should not assume that it will be preceded by a global
563+ * GC prologue callback or followed by a global GC epilogue callback.
564+ */
565+ V8_DEPRECATED (
566+ " Weak objects are always considered independent. "
567+ " Use TracedGlobal when trying to use EmbedderHeapTracer. "
568+ " Use a strong handle when trying to keep an object alive." ,
569+ V8_INLINE void MarkIndependent ());
570+
571+ /* *
572+ * Marks the reference to this object as active. The scavenge garbage
573+ * collection should not reclaim the objects marked as active, even if the
574+ * object held by the handle is otherwise unreachable.
575+ *
576+ * This bit is cleared after the each garbage collection pass.
577+ */
578+ V8_DEPRECATED (" Use TracedGlobal." , V8_INLINE void MarkActive ());
579+
580+ V8_DEPRECATED (" See MarkIndependent." , V8_INLINE bool IsIndependent () const );
581+
549582 /* * Returns true if the handle's reference is weak. */
550583 V8_INLINE bool IsWeak () const ;
551584
@@ -2613,6 +2646,9 @@ class V8_EXPORT Value : public Data {
26132646
26142647 V8_WARN_UNUSED_RESULT MaybeLocal<BigInt> ToBigInt (
26152648 Local<Context> context) const ;
2649+ V8_DEPRECATED (" ToBoolean can never throw. Use Local version." ,
2650+ V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean (
2651+ Local<Context> context) const );
26162652 V8_WARN_UNUSED_RESULT MaybeLocal<Number> ToNumber (
26172653 Local<Context> context) const ;
26182654 V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString (
@@ -2628,6 +2664,16 @@ class V8_EXPORT Value : public Data {
26282664 V8_WARN_UNUSED_RESULT MaybeLocal<Int32> ToInt32 (Local<Context> context) const ;
26292665
26302666 Local<Boolean> ToBoolean (Isolate* isolate) const ;
2667+ V8_DEPRECATED (" Use maybe version" ,
2668+ Local<Number> ToNumber (Isolate* isolate) const );
2669+ V8_DEPRECATED (" Use maybe version" ,
2670+ Local<String> ToString (Isolate* isolate) const );
2671+ V8_DEPRECATED (" Use maybe version" ,
2672+ Local<Object> ToObject (Isolate* isolate) const );
2673+ V8_DEPRECATED (" Use maybe version" ,
2674+ Local<Integer> ToInteger (Isolate* isolate) const );
2675+ V8_DEPRECATED (" Use maybe version" ,
2676+ Local<Int32> ToInt32 (Isolate* isolate) const );
26312677
26322678 /* *
26332679 * Attempts to convert a string to an array index.
@@ -2638,6 +2684,9 @@ class V8_EXPORT Value : public Data {
26382684
26392685 bool BooleanValue (Isolate* isolate) const ;
26402686
2687+ V8_DEPRECATED (" BooleanValue can never throw. Use Isolate version." ,
2688+ V8_WARN_UNUSED_RESULT Maybe<bool > BooleanValue (
2689+ Local<Context> context) const );
26412690 V8_WARN_UNUSED_RESULT Maybe<double > NumberValue (Local<Context> context) const ;
26422691 V8_WARN_UNUSED_RESULT Maybe<int64_t > IntegerValue (
26432692 Local<Context> context) const ;
@@ -2957,23 +3006,43 @@ class V8_EXPORT String : public Name {
29573006
29583007 V8_INLINE static String* Cast (v8::Value* obj);
29593008
3009+ // TODO(dcarney): remove with deprecation of New functions.
3010+ enum NewStringType {
3011+ kNormalString = static_cast <int >(v8::NewStringType::kNormal ),
3012+ kInternalizedString = static_cast <int >(v8::NewStringType::kInternalized )
3013+ };
3014+
3015+ /* * Allocates a new string from UTF-8 data.*/
3016+ static V8_DEPRECATED (
3017+ " Use maybe version" ,
3018+ Local<String> NewFromUtf8 (Isolate* isolate, const char * data,
3019+ NewStringType type = kNormalString ,
3020+ int length = -1 ));
3021+
29603022 /* * Allocates a new string from UTF-8 data. Only returns an empty value when
29613023 * length > kMaxLength. **/
29623024 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromUtf8 (
2963- Isolate* isolate, const char * data,
2964- NewStringType type = NewStringType:: kNormal , int length = -1 );
3025+ Isolate* isolate, const char * data, v8::NewStringType type,
3026+ int length = -1 );
29653027
29663028 /* * Allocates a new string from Latin-1 data. Only returns an empty value
29673029 * when length > kMaxLength. **/
29683030 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromOneByte (
2969- Isolate* isolate, const uint8_t * data,
2970- NewStringType type = NewStringType::kNormal , int length = -1 );
3031+ Isolate* isolate, const uint8_t * data, v8::NewStringType type,
3032+ int length = -1 );
3033+
3034+ /* * Allocates a new string from UTF-16 data.*/
3035+ static V8_DEPRECATED (
3036+ " Use maybe version" ,
3037+ Local<String> NewFromTwoByte (Isolate* isolate, const uint16_t * data,
3038+ NewStringType type = kNormalString ,
3039+ int length = -1 ));
29713040
29723041 /* * Allocates a new string from UTF-16 data. Only returns an empty value when
29733042 * length > kMaxLength. **/
29743043 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromTwoByte (
2975- Isolate* isolate, const uint16_t * data,
2976- NewStringType type = NewStringType:: kNormal , int length = -1 );
3044+ Isolate* isolate, const uint16_t * data, v8::NewStringType type,
3045+ int length = -1 );
29773046
29783047 /* *
29793048 * Creates a new string by concatenating the left and the right strings
@@ -3012,6 +3081,10 @@ class V8_EXPORT String : public Name {
30123081 * should the underlying buffer be deallocated or modified except through the
30133082 * destructor of the external string resource.
30143083 */
3084+ static V8_DEPRECATED (
3085+ " Use maybe version" ,
3086+ Local<String> NewExternal (Isolate* isolate,
3087+ ExternalOneByteStringResource* resource));
30153088 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalOneByte (
30163089 Isolate* isolate, ExternalOneByteStringResource* resource);
30173090
@@ -3954,6 +4027,9 @@ class ReturnValue {
39544027 }
39554028 // Local setters
39564029 template <typename S>
4030+ V8_INLINE V8_DEPRECATED (" Use Global<> instead" ,
4031+ void Set (const Persistent<S>& handle));
4032+ template <typename S>
39574033 V8_INLINE void Set (const Global<S>& handle);
39584034 template <typename S>
39594035 V8_INLINE void Set (const TracedGlobal<S>& handle);
@@ -5344,6 +5420,38 @@ class V8_EXPORT Date : public Object {
53445420
53455421 V8_INLINE static Date* Cast (Value* obj);
53465422
5423+ /* *
5424+ * Time zone redetection indicator for
5425+ * DateTimeConfigurationChangeNotification.
5426+ *
5427+ * kSkip indicates V8 that the notification should not trigger redetecting
5428+ * host time zone. kRedetect indicates V8 that host time zone should be
5429+ * redetected, and used to set the default time zone.
5430+ *
5431+ * The host time zone detection may require file system access or similar
5432+ * operations unlikely to be available inside a sandbox. If v8 is run inside a
5433+ * sandbox, the host time zone has to be detected outside the sandbox before
5434+ * calling DateTimeConfigurationChangeNotification function.
5435+ */
5436+ enum class TimeZoneDetection { kSkip , kRedetect };
5437+
5438+ /* *
5439+ * Notification that the embedder has changed the time zone,
5440+ * daylight savings time, or other date / time configuration
5441+ * parameters. V8 keeps a cache of various values used for
5442+ * date / time computation. This notification will reset
5443+ * those cached values for the current context so that date /
5444+ * time configuration changes would be reflected in the Date
5445+ * object.
5446+ *
5447+ * This API should not be called more than needed as it will
5448+ * negatively impact the performance of date operations.
5449+ */
5450+ V8_DEPRECATED (" Use Isolate::DateTimeConfigurationChangeNotification" ,
5451+ static void DateTimeConfigurationChangeNotification (
5452+ Isolate* isolate, TimeZoneDetection time_zone_detection =
5453+ TimeZoneDetection::kSkip ));
5454+
53475455 private:
53485456 static void CheckCast (Value* obj);
53495457};
@@ -6057,6 +6165,21 @@ class V8_EXPORT FunctionTemplate : public Template {
60576165 */
60586166 void SetAcceptAnyReceiver (bool value);
60596167
6168+ /* *
6169+ * Determines whether the __proto__ accessor ignores instances of
6170+ * the function template. If instances of the function template are
6171+ * ignored, __proto__ skips all instances and instead returns the
6172+ * next object in the prototype chain.
6173+ *
6174+ * Call with a value of true to make the __proto__ accessor ignore
6175+ * instances of the function template. Call with a value of false
6176+ * to make the __proto__ accessor not ignore instances of the
6177+ * function template. By default, instances of a function template
6178+ * are not ignored.
6179+ */
6180+ V8_DEPRECATED (" This feature is incompatible with ES6+." ,
6181+ void SetHiddenPrototype (bool value));
6182+
60606183 /* *
60616184 * Sets the ReadOnly flag in the attributes of the 'prototype' property
60626185 * of functions created from this FunctionTemplate to true.
@@ -8905,9 +9028,7 @@ class V8_EXPORT V8 {
89059028 * Sets V8 flags from a string.
89069029 */
89079030 static void SetFlagsFromString (const char * str);
8908- static void SetFlagsFromString (const char * str, size_t length);
8909- V8_DEPRECATED (" use size_t version" ,
8910- static void SetFlagsFromString (const char * str, int length));
9031+ static void SetFlagsFromString (const char * str, int length);
89119032
89129033 /* *
89139034 * Sets V8 flags from the command line.
@@ -9081,6 +9202,9 @@ class V8_EXPORT V8 {
90819202 const char * label);
90829203 static Value* Eternalize (Isolate* isolate, Value* handle);
90839204
9205+ static void RegisterExternallyReferencedObject (internal::Address* location,
9206+ internal::Isolate* isolate);
9207+
90849208 template <class K , class V , class T >
90859209 friend class PersistentValueMapBase ;
90869210
@@ -10036,6 +10160,14 @@ void Persistent<T, M>::Copy(const Persistent<S, M2>& that) {
1003610160 M::Copy (that, this );
1003710161}
1003810162
10163+ template <class T >
10164+ bool PersistentBase<T>::IsIndependent() const {
10165+ typedef internal::Internals I;
10166+ if (this ->IsEmpty ()) return false ;
10167+ return I::GetNodeFlag (reinterpret_cast <internal::Address*>(this ->val_ ),
10168+ I::kNodeIsIndependentShift );
10169+ }
10170+
1003910171template <class T >
1004010172bool PersistentBase<T>::IsWeak() const {
1004110173 typedef internal::Internals I;
@@ -10102,6 +10234,31 @@ void PersistentBase<T>::AnnotateStrongRetainer(const char* label) {
1010210234 label);
1010310235}
1010410236
10237+ template <class T >
10238+ void PersistentBase<T>::RegisterExternalReference(Isolate* isolate) const {
10239+ if (IsEmpty ()) return ;
10240+ V8::RegisterExternallyReferencedObject (
10241+ reinterpret_cast <internal::Address*>(this ->val_ ),
10242+ reinterpret_cast <internal::Isolate*>(isolate));
10243+ }
10244+
10245+ template <class T >
10246+ void PersistentBase<T>::MarkIndependent() {
10247+ typedef internal::Internals I;
10248+ if (this ->IsEmpty ()) return ;
10249+ I::UpdateNodeFlag (reinterpret_cast <internal::Address*>(this ->val_ ), true ,
10250+ I::kNodeIsIndependentShift );
10251+ }
10252+
10253+ template <class T >
10254+ void PersistentBase<T>::MarkActive() {
10255+ typedef internal::Internals I;
10256+ if (this ->IsEmpty ()) return ;
10257+ I::UpdateNodeFlag (reinterpret_cast <internal::Address*>(this ->val_ ), true ,
10258+ I::kNodeIsActiveShift );
10259+ }
10260+
10261+
1010510262template <class T >
1010610263void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) {
1010710264 typedef internal::Internals I;
@@ -10252,6 +10409,17 @@ void TracedGlobal<T>::SetFinalizationCallback(
1025210409template <typename T>
1025310410ReturnValue<T>::ReturnValue(internal::Address* slot) : value_(slot) {}
1025410411
10412+ template <typename T>
10413+ template <typename S>
10414+ void ReturnValue<T>::Set(const Persistent<S>& handle) {
10415+ TYPE_CHECK (T, S);
10416+ if (V8_UNLIKELY (handle.IsEmpty ())) {
10417+ *value_ = GetDefaultValue ();
10418+ } else {
10419+ *value_ = *reinterpret_cast <internal::Address*>(*handle);
10420+ }
10421+ }
10422+
1025510423template <typename T>
1025610424template <typename S>
1025710425void ReturnValue<T>::Set(const Global<S>& handle) {
0 commit comments