| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent bb616bb commit 499ccdc
13 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,7 +38,7 @@ | |||
| 38 | 38 | ||
| 39 | 39 | # Reset this number to 0 on major V8 upgrades. | |
| 40 | 40 | # Increment by one for each non-official patch applied to deps/v8. | |
| 41 | - 'v8_embedder_string': '-node.18', | ||
| 41 | + 'v8_embedder_string': '-node.19', | ||
| 42 | 42 | ||
| 43 | 43 | ##### V8 defaults for Node.js ##### | |
| 44 | 44 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -181,6 +181,8 @@ class Internals { | |||
| 181 | 181 | static const int kNodeStateMask = 0x7; | |
| 182 | 182 | static const int kNodeStateIsWeakValue = 2; | |
| 183 | 183 | static const int kNodeStateIsPendingValue = 3; | |
| 184 | + static const int kNodeIsIndependentShift = 3; | ||
| 185 | + static const int kNodeIsActiveShift = 4; | ||
| 184 | 186 | ||
| 185 | 187 | static const int kFirstNonstringType = 0x40; | |
| 186 | 188 | static const int kOddballType = 0x43; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -304,9 +304,12 @@ class V8_EXPORT CpuProfiler { | |||
| 304 | 304 | * initialized. The profiler object must be disposed after use by calling | |
| 305 | 305 | * |Dispose| method. | |
| 306 | 306 | */ | |
| 307 | + static CpuProfiler* New(Isolate* isolate); | ||
| 307 | 308 | static CpuProfiler* New(Isolate* isolate, | |
| 308 | - CpuProfilingNamingMode = kDebugNaming, | ||
| 309 | - CpuProfilingLoggingMode = kLazyLogging); | ||
| 309 | + CpuProfilingNamingMode mode); | ||
| 310 | + static CpuProfiler* New(Isolate* isolate, | ||
| 311 | + CpuProfilingNamingMode namingMode, | ||
| 312 | + CpuProfilingLoggingMode loggingMode); | ||
| 310 | 313 | ||
| 311 | 314 | /** | |
| 312 | 315 | * Synchronously collect current stack sample in all profilers attached to | |
@@ -355,8 +358,10 @@ class V8_EXPORT CpuProfiler { | |||
| 355 | 358 | * discarded. | |
| 356 | 359 | */ | |
| 357 | 360 | void StartProfiling( | |
| 358 | - Local<String> title, CpuProfilingMode mode, bool record_samples = false, | ||
| 359 | - unsigned max_samples = CpuProfilingOptions::kNoSampleLimit); | ||
| 361 | + Local<String> title, CpuProfilingMode mode, bool record_samples = false); | ||
| 362 | + void StartProfiling( | ||
| 363 | + Local<String> title, CpuProfilingMode mode, bool record_samples, | ||
| 364 | + unsigned max_samples); | ||
| 360 | 365 | /** | |
| 361 | 366 | * The same as StartProfiling above, but the CpuProfilingMode defaults to | |
| 362 | 367 | * kLeafNodeLineNumbers mode, which was the previous default behavior of the | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -194,6 +194,14 @@ class PersistentValueMapBase { | |||
| 194 | 194 | return SetReturnValueFromVal(&returnValue, Traits::Get(&impl_, key)); | |
| 195 | 195 | } | |
| 196 | 196 | ||
| 197 | + /** | ||
| 198 | + * Call V8::RegisterExternallyReferencedObject with the map value for given | ||
| 199 | + * key. | ||
| 200 | + */ | ||
| 201 | + V8_DEPRECATED( | ||
| 202 | + "Used TracedGlobal and EmbedderHeapTracer::RegisterEmbedderReference", | ||
| 203 | + inline void RegisterExternallyReferencedObject(K& key)); | ||
| 204 | + | ||
| 197 | 205 | /** | |
| 198 | 206 | * Return value for key and remove it from the map. | |
| 199 | 207 | */ | |
@@ -344,6 +352,16 @@ class PersistentValueMapBase { | |||
| 344 | 352 | const char* label_; | |
| 345 | 353 | }; | |
| 346 | 354 | ||
| 355 | + template <typename K, typename V, typename Traits> | ||
| 356 | + inline void | ||
| 357 | + PersistentValueMapBase<K, V, Traits>::RegisterExternallyReferencedObject( | ||
| 358 | + K& key) { | ||
| 359 | + assert(Contains(key)); | ||
| 360 | + V8::RegisterExternallyReferencedObject( | ||
| 361 | + reinterpret_cast<internal::Address*>(FromVal(Traits::Get(&impl_, key))), | ||
| 362 | + reinterpret_cast<internal::Isolate*>(GetIsolate())); | ||
| 363 | + } | ||
| 364 | + | ||
| 347 | 365 | template <typename K, typename V, typename Traits> | |
| 348 | 366 | class PersistentValueMap : public PersistentValueMapBase<K, V, Traits> { | |
| 349 | 367 | public: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -123,6 +123,7 @@ class ExternalString; | |||
| 123 | 123 | class Isolate; | |
| 124 | 124 | class LocalEmbedderHeapTracer; | |
| 125 | 125 | class MicrotaskQueue; | |
| 126 | + class NeverReadOnlySpaceObject; | ||
| 126 | 127 | struct ScriptStreamingData; | |
| 127 | 128 | template<typename T> class CustomArguments; | |
| 128 | 129 | class PropertyCallbackArguments; | |
@@ -546,6 +547,38 @@ template <class T> class PersistentBase { | |||
| 546 | 547 | */ | |
| 547 | 548 | V8_INLINE void AnnotateStrongRetainer(const char* label); | |
| 548 | 549 | ||
| 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 | + | ||
| 549 | 582 | /** Returns true if the handle's reference is weak. */ | |
| 550 | 583 | V8_INLINE bool IsWeak() const; | |
| 551 | 584 | ||
@@ -2613,6 +2646,9 @@ class V8_EXPORT Value : public Data { | |||
| 2613 | 2646 | ||
| 2614 | 2647 | V8_WARN_UNUSED_RESULT MaybeLocal<BigInt> ToBigInt( | |
| 2615 | 2648 | 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); | ||
| 2616 | 2652 | V8_WARN_UNUSED_RESULT MaybeLocal<Number> ToNumber( | |
| 2617 | 2653 | Local<Context> context) const; | |
| 2618 | 2654 | V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString( | |
@@ -2628,6 +2664,16 @@ class V8_EXPORT Value : public Data { | |||
| 2628 | 2664 | V8_WARN_UNUSED_RESULT MaybeLocal<Int32> ToInt32(Local<Context> context) const; | |
| 2629 | 2665 | ||
| 2630 | 2666 | 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); | ||
| 2631 | 2677 | ||
| 2632 | 2678 | /** | |
| 2633 | 2679 | * Attempts to convert a string to an array index. | |
@@ -2638,6 +2684,9 @@ class V8_EXPORT Value : public Data { | |||
| 2638 | 2684 | ||
| 2639 | 2685 | bool BooleanValue(Isolate* isolate) const; | |
| 2640 | 2686 | ||
| 2687 | + V8_DEPRECATED("BooleanValue can never throw. Use Isolate version.", | ||
| 2688 | + V8_WARN_UNUSED_RESULT Maybe<bool> BooleanValue( | ||
| 2689 | + Local<Context> context) const); | ||
| 2641 | 2690 | V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const; | |
| 2642 | 2691 | V8_WARN_UNUSED_RESULT Maybe<int64_t> IntegerValue( | |
| 2643 | 2692 | Local<Context> context) const; | |
@@ -2957,23 +3006,43 @@ class V8_EXPORT String : public Name { | |||
| 2957 | 3006 | ||
| 2958 | 3007 | V8_INLINE static String* Cast(v8::Value* obj); | |
| 2959 | 3008 | ||
| 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 | + | ||
| 2960 | 3022 | /** Allocates a new string from UTF-8 data. Only returns an empty value when | |
| 2961 | 3023 | * length > kMaxLength. **/ | |
| 2962 | 3024 | 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); | ||
| 2965 | 3027 | ||
| 2966 | 3028 | /** Allocates a new string from Latin-1 data. Only returns an empty value | |
| 2967 | 3029 | * when length > kMaxLength. **/ | |
| 2968 | 3030 | 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)); | ||
| 2971 | 3040 | ||
| 2972 | 3041 | /** Allocates a new string from UTF-16 data. Only returns an empty value when | |
| 2973 | 3042 | * length > kMaxLength. **/ | |
| 2974 | 3043 | 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); | ||
| 2977 | 3046 | ||
| 2978 | 3047 | /** | |
| 2979 | 3048 | * Creates a new string by concatenating the left and the right strings | |
@@ -3012,6 +3081,10 @@ class V8_EXPORT String : public Name { | |||
| 3012 | 3081 | * should the underlying buffer be deallocated or modified except through the | |
| 3013 | 3082 | * destructor of the external string resource. | |
| 3014 | 3083 | */ | |
| 3084 | + static V8_DEPRECATED( | ||
| 3085 | + "Use maybe version", | ||
| 3086 | + Local<String> NewExternal(Isolate* isolate, | ||
| 3087 | + ExternalOneByteStringResource* resource)); | ||
| 3015 | 3088 | static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalOneByte( | |
| 3016 | 3089 | Isolate* isolate, ExternalOneByteStringResource* resource); | |
| 3017 | 3090 | ||
@@ -3954,6 +4027,9 @@ class ReturnValue { | |||
| 3954 | 4027 | } | |
| 3955 | 4028 | // Local setters | |
| 3956 | 4029 | template <typename S> | |
| 4030 | + V8_INLINE V8_DEPRECATED("Use Global<> instead", | ||
| 4031 | + void Set(const Persistent<S>& handle)); | ||
| 4032 | + template <typename S> | ||
| 3957 | 4033 | V8_INLINE void Set(const Global<S>& handle); | |
| 3958 | 4034 | template <typename S> | |
| 3959 | 4035 | V8_INLINE void Set(const TracedGlobal<S>& handle); | |
@@ -5344,6 +5420,38 @@ class V8_EXPORT Date : public Object { | |||
| 5344 | 5420 | ||
| 5345 | 5421 | V8_INLINE static Date* Cast(Value* obj); | |
| 5346 | 5422 | ||
| 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 | + | ||
| 5347 | 5455 | private: | |
| 5348 | 5456 | static void CheckCast(Value* obj); | |
| 5349 | 5457 | }; | |
@@ -6057,6 +6165,21 @@ class V8_EXPORT FunctionTemplate : public Template { | |||
| 6057 | 6165 | */ | |
| 6058 | 6166 | void SetAcceptAnyReceiver(bool value); | |
| 6059 | 6167 | ||
| 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 | + | ||
| 6060 | 6183 | /** | |
| 6061 | 6184 | * Sets the ReadOnly flag in the attributes of the 'prototype' property | |
| 6062 | 6185 | * of functions created from this FunctionTemplate to true. | |
@@ -8905,9 +9028,7 @@ class V8_EXPORT V8 { | |||
| 8905 | 9028 | * Sets V8 flags from a string. | |
| 8906 | 9029 | */ | |
| 8907 | 9030 | 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); | ||
| 8911 | 9032 | ||
| 8912 | 9033 | /** | |
| 8913 | 9034 | * Sets V8 flags from the command line. | |
@@ -9081,6 +9202,9 @@ class V8_EXPORT V8 { | |||
| 9081 | 9202 | const char* label); | |
| 9082 | 9203 | static Value* Eternalize(Isolate* isolate, Value* handle); | |
| 9083 | 9204 | ||
| 9205 | + static void RegisterExternallyReferencedObject(internal::Address* location, | ||
| 9206 | + internal::Isolate* isolate); | ||
| 9207 | + | ||
| 9084 | 9208 | template <class K, class V, class T> | |
| 9085 | 9209 | friend class PersistentValueMapBase; | |
| 9086 | 9210 | ||
@@ -10036,6 +10160,14 @@ void Persistent<T, M>::Copy(const Persistent<S, M2>& that) { | |||
| 10036 | 10160 | M::Copy(that, this); | |
| 10037 | 10161 | } | |
| 10038 | 10162 | ||
| 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 | + | ||
| 10039 | 10171 | template <class T> | |
| 10040 | 10172 | bool PersistentBase<T>::IsWeak() const { | |
| 10041 | 10173 | typedef internal::Internals I; | |
@@ -10102,6 +10234,31 @@ void PersistentBase<T>::AnnotateStrongRetainer(const char* label) { | |||
| 10102 | 10234 | label); | |
| 10103 | 10235 | } | |
| 10104 | 10236 | ||
| 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 | + | ||
| 10105 | 10262 | template <class T> | |
| 10106 | 10263 | void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) { | |
| 10107 | 10264 | typedef internal::Internals I; | |
@@ -10252,6 +10409,17 @@ void TracedGlobal<T>::SetFinalizationCallback( | |||
| 10252 | 10409 | template <typename T> | |
| 10253 | 10410 | ReturnValue<T>::ReturnValue(internal::Address* slot) : value_(slot) {} | |
| 10254 | 10411 | ||
| 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 | + | ||
| 10255 | 10423 | template <typename T> | |
| 10256 | 10424 | template <typename S> | |
| 10257 | 10425 | void ReturnValue<T>::Set(const Global<S>& handle) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments