diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-05-24 11:40:17 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-05-24 12:42:11 +0000 |
commit | 5d87695f37678f96492b258bbab36486c59866b4 (patch) | |
tree | be9783bbaf04fb930c4d74ca9c00b5e7954c8bc6 /chromium/v8/include | |
parent | 6c11fb357ec39bf087b8b632e2b1e375aef1b38b (diff) | |
download | qtwebengine-chromium-5d87695f37678f96492b258bbab36486c59866b4.tar.gz |
BASELINE: Update Chromium to 75.0.3770.56
Change-Id: I86d2007fd27a45d5797eee06f4c9369b8b50ac4f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'chromium/v8/include')
-rw-r--r-- | chromium/v8/include/v8-internal.h | 59 | ||||
-rw-r--r-- | chromium/v8/include/v8-profiler.h | 47 | ||||
-rw-r--r-- | chromium/v8/include/v8-util.h | 2 | ||||
-rw-r--r-- | chromium/v8/include/v8-version.h | 4 | ||||
-rw-r--r-- | chromium/v8/include/v8.h | 206 | ||||
-rw-r--r-- | chromium/v8/include/v8config.h | 4 |
6 files changed, 188 insertions, 134 deletions
diff --git a/chromium/v8/include/v8-internal.h b/chromium/v8/include/v8-internal.h index bb69bb915dd..8e700a4d4d4 100644 --- a/chromium/v8/include/v8-internal.h +++ b/chromium/v8/include/v8-internal.h @@ -7,6 +7,7 @@ #include <stddef.h> #include <stdint.h> +#include <string.h> #include <type_traits> #include "v8-version.h" // NOLINT(build/include) @@ -29,7 +30,6 @@ static const Address kNullAddress = 0; * Configuration of tagging scheme. */ const int kApiSystemPointerSize = sizeof(void*); -const int kApiTaggedSize = kApiSystemPointerSize; const int kApiDoubleSize = sizeof(double); const int kApiInt32Size = sizeof(int32_t); const int kApiInt64Size = sizeof(int64_t); @@ -92,6 +92,9 @@ struct SmiTagging<8> { static_assert( kApiSystemPointerSize == kApiInt64Size, "Pointer compression can be enabled only for 64-bit architectures"); +const int kApiTaggedSize = kApiInt32Size; +#else +const int kApiTaggedSize = kApiSystemPointerSize; #endif #ifdef V8_31BIT_SMIS_ON_64BIT_ARCH @@ -131,11 +134,7 @@ class Internals { static const int kJSObjectHeaderSize = 3 * kApiTaggedSize; static const int kFixedArrayHeaderSize = 2 * kApiTaggedSize; static const int kEmbedderDataArrayHeaderSize = 2 * kApiTaggedSize; - static const int kEmbedderDataSlotSize = -#ifdef V8_COMPRESS_POINTERS - 2 * -#endif - kApiSystemPointerSize; + static const int kEmbedderDataSlotSize = kApiSystemPointerSize; static const int kNativeContextEmbedderDataOffset = 7 * kApiTaggedSize; static const int kFullStringRepresentationMask = 0x0f; static const int kStringEncodingMask = 0x8; @@ -166,7 +165,6 @@ class Internals { static const int kNodeStateMask = 0x7; static const int kNodeStateIsWeakValue = 2; static const int kNodeStateIsPendingValue = 3; - static const int kNodeStateIsNearDeathValue = 4; static const int kNodeIsIndependentShift = 3; static const int kNodeIsActiveShift = 4; @@ -277,6 +275,17 @@ class Internals { V8_INLINE static T ReadRawField(internal::Address heap_object_ptr, int offset) { internal::Address addr = heap_object_ptr + offset - kHeapObjectTag; +#ifdef V8_COMPRESS_POINTERS + if (sizeof(T) > kApiTaggedSize) { + // TODO(ishell, v8:8875): When pointer compression is enabled 8-byte size + // fields (external pointers, doubles and BigInt data) are only + // kTaggedSize aligned so we have to use unaligned pointer friendly way of + // accessing them in order to avoid undefined behavior in C++ code. + T r; + memcpy(&r, reinterpret_cast<void*>(addr), sizeof(T)); + return r; + } +#endif return *reinterpret_cast<const T*>(addr); } @@ -301,22 +310,8 @@ class Internals { #endif } - V8_INLINE static internal::Address ReadTaggedAnyField( - internal::Address heap_object_ptr, int offset) { -#ifdef V8_COMPRESS_POINTERS - int32_t value = ReadRawField<int32_t>(heap_object_ptr, offset); - internal::Address root_mask = static_cast<internal::Address>( - -static_cast<intptr_t>(value & kSmiTagMask)); - internal::Address root_or_zero = - root_mask & GetRootFromOnHeapAddress(heap_object_ptr); - return root_or_zero + - static_cast<internal::Address>(static_cast<intptr_t>(value)); -#else - return ReadRawField<internal::Address>(heap_object_ptr, offset); -#endif - } - #ifdef V8_COMPRESS_POINTERS + // See v8:7703 or src/ptr-compr.* for details about pointer compression. static constexpr size_t kPtrComprHeapReservationSize = size_t{1} << 32; static constexpr size_t kPtrComprIsolateRootBias = kPtrComprHeapReservationSize / 2; @@ -328,18 +323,14 @@ class Internals { -static_cast<intptr_t>(kPtrComprIsolateRootAlignment); } -#else - - template <typename T> - V8_INLINE static T ReadEmbedderData(const v8::Context* context, int index) { - typedef internal::Address A; - typedef internal::Internals I; - A ctx = *reinterpret_cast<const A*>(context); - A embedder_data = - I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset); - int value_offset = - I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index); - return I::ReadRawField<T>(embedder_data, value_offset); + V8_INLINE static internal::Address DecompressTaggedAnyField( + internal::Address heap_object_ptr, int32_t value) { + internal::Address root_mask = static_cast<internal::Address>( + -static_cast<intptr_t>(value & kSmiTagMask)); + internal::Address root_or_zero = + root_mask & GetRootFromOnHeapAddress(heap_object_ptr); + return root_or_zero + + static_cast<internal::Address>(static_cast<intptr_t>(value)); } #endif // V8_COMPRESS_POINTERS }; diff --git a/chromium/v8/include/v8-profiler.h b/chromium/v8/include/v8-profiler.h index 3adce79be56..672a694e079 100644 --- a/chromium/v8/include/v8-profiler.h +++ b/chromium/v8/include/v8-profiler.h @@ -48,7 +48,7 @@ template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>; namespace v8 { // TickSample captures the information collected for each sample. -struct TickSample { +struct V8_EXPORT TickSample { // Internal profiling (with --prof + tools/$OS-tick-processor) wants to // include the runtime function we're calling. Externally exposed tick // samples don't care. @@ -129,6 +129,20 @@ class V8_EXPORT CpuProfileNode { unsigned int hit_count; }; + // An annotation hinting at the source of a CpuProfileNode. + enum SourceType { + // User-supplied script with associated resource information. + kScript = 0, + // Native scripts and provided builtins. + kBuiltin = 1, + // Callbacks into native code. + kCallback = 2, + // VM-internal functions or state. + kInternal = 3, + // A node that failed to symbolize. + kUnresolved = 4, + }; + /** Returns function name (empty string for anonymous functions.) */ Local<String> GetFunctionName() const; @@ -153,6 +167,12 @@ class V8_EXPORT CpuProfileNode { const char* GetScriptResourceNameStr() const; /** + * Return true if the script from where the function originates is flagged as + * being shared cross-origin. + */ + bool IsScriptSharedCrossOrigin() const; + + /** * Returns the number, 1-based, of the line where the function originates. * kNoLineNumberInfo if no line number information is available. */ @@ -194,12 +214,20 @@ class V8_EXPORT CpuProfileNode { /** Returns id of the node. The id is unique within the tree */ unsigned GetNodeId() const; + /** + * Gets the type of the source which the node was captured from. + */ + SourceType GetSourceType() const; + /** Returns child nodes count of the node. */ int GetChildrenCount() const; /** Retrieves a child node by index. */ const CpuProfileNode* GetChild(int index) const; + /** Retrieves the ancestor node, or null if the root. */ + const CpuProfileNode* GetParent() const; + /** Retrieves deopt infos for the node. */ const std::vector<CpuProfileDeoptInfo>& GetDeoptInfos() const; @@ -302,6 +330,15 @@ class V8_EXPORT CpuProfiler { void SetSamplingInterval(int us); /** + * Sets whether or not the profiler should prioritize consistency of sample + * periodicity on Windows. Disabling this can greatly reduce CPU usage, but + * may result in greater variance in sample timings from the platform's + * scheduler. Defaults to enabled. This method must be called when there are + * no profiles being recorded. + */ + void SetUsePreciseSampling(bool); + + /** * Starts collecting CPU profile. Title may be an empty string. It * is allowed to have several profiles being collected at * once. Attempts to start collecting several profiles with the same @@ -756,10 +793,6 @@ class V8_EXPORT HeapProfiler { v8::EmbedderGraph* graph, void* data); - /** TODO(addaleax): Remove */ - typedef void (*LegacyBuildEmbedderGraphCallback)(v8::Isolate* isolate, - v8::EmbedderGraph* graph); - /** Returns the number of snapshots taken. */ int GetSnapshotCount(); @@ -898,10 +931,6 @@ class V8_EXPORT HeapProfiler { */ void DeleteAllHeapSnapshots(); - V8_DEPRECATED( - "Use AddBuildEmbedderGraphCallback to provide info about embedder nodes", - void SetBuildEmbedderGraphCallback( - LegacyBuildEmbedderGraphCallback callback)); void AddBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback, void* data); void RemoveBuildEmbedderGraphCallback(BuildEmbedderGraphCallback callback, diff --git a/chromium/v8/include/v8-util.h b/chromium/v8/include/v8-util.h index 466b99fd6b7..24962607076 100644 --- a/chromium/v8/include/v8-util.h +++ b/chromium/v8/include/v8-util.h @@ -198,7 +198,7 @@ class PersistentValueMapBase { * Call V8::RegisterExternallyReferencedObject with the map value for given * key. */ - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Used TracedGlobal and EmbedderHeapTracer::RegisterEmbedderReference", inline void RegisterExternallyReferencedObject(K& key)); diff --git a/chromium/v8/include/v8-version.h b/chromium/v8/include/v8-version.h index a02ab4bb989..dfcd5b467db 100644 --- a/chromium/v8/include/v8-version.h +++ b/chromium/v8/include/v8-version.h @@ -9,9 +9,9 @@ // NOTE these macros are used by some of the tool scripts and the build // system so their names cannot be changed without changing the scripts. #define V8_MAJOR_VERSION 7 -#define V8_MINOR_VERSION 4 +#define V8_MINOR_VERSION 5 #define V8_BUILD_NUMBER 288 -#define V8_PATCH_LEVEL 28 +#define V8_PATCH_LEVEL 22 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/chromium/v8/include/v8.h b/chromium/v8/include/v8.h index 6ecc48af332..b4b920555b2 100644 --- a/chromium/v8/include/v8.h +++ b/chromium/v8/include/v8.h @@ -118,6 +118,7 @@ class Arguments; class DeferredHandles; class Heap; class HeapObject; +class ExternalString; class Isolate; class LocalEmbedderHeapTracer; class MicrotaskQueue; @@ -549,7 +550,7 @@ template <class T> class PersistentBase { * is alive. Only allowed when the embedder is asked to trace its heap by * EmbedderHeapTracer. */ - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Used TracedGlobal and EmbedderHeapTracer::RegisterEmbedderReference", V8_INLINE void RegisterExternalReference(Isolate* isolate) const); @@ -572,14 +573,10 @@ template <class T> class PersistentBase { * * This bit is cleared after the each garbage collection pass. */ - V8_DEPRECATE_SOON("Use TracedGlobal.", V8_INLINE void MarkActive()); + V8_DEPRECATED("Use TracedGlobal.", V8_INLINE void MarkActive()); V8_DEPRECATED("See MarkIndependent.", V8_INLINE bool IsIndependent() const); - /** Checks if the handle holds the only reference to an object. */ - V8_DEPRECATED("Garbage collection internal state should not be relied on.", - V8_INLINE bool IsNearDeath() const); - /** Returns true if the handle's reference is weak. */ V8_INLINE bool IsWeak() const; @@ -1535,7 +1532,12 @@ class V8_EXPORT ScriptCompiler { public: enum Encoding { ONE_BYTE, TWO_BYTE, UTF8 }; - StreamedSource(ExternalSourceStream* source_stream, Encoding encoding); + V8_DEPRECATE_SOON( + "This class takes ownership of source_stream, so use the constructor " + "taking a unique_ptr to make these semantics clearer", + StreamedSource(ExternalSourceStream* source_stream, Encoding encoding)); + StreamedSource(std::unique_ptr<ExternalSourceStream> source_stream, + Encoding encoding); ~StreamedSource(); internal::ScriptStreamingData* impl() const { return impl_.get(); } @@ -2518,9 +2520,9 @@ class V8_EXPORT Value : public Data { V8_WARN_UNUSED_RESULT MaybeLocal<BigInt> ToBigInt( Local<Context> context) const; - V8_DEPRECATE_SOON("ToBoolean can never throw. Use Local version.", - V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean( - Local<Context> context) const); + V8_DEPRECATED("ToBoolean can never throw. Use Local version.", + V8_WARN_UNUSED_RESULT MaybeLocal<Boolean> ToBoolean( + Local<Context> context) const); V8_WARN_UNUSED_RESULT MaybeLocal<Number> ToNumber( Local<Context> context) const; V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString( @@ -2536,16 +2538,16 @@ class V8_EXPORT Value : public Data { V8_WARN_UNUSED_RESULT MaybeLocal<Int32> ToInt32(Local<Context> context) const; Local<Boolean> ToBoolean(Isolate* isolate) const; - V8_DEPRECATE_SOON("Use maybe version", - Local<Number> ToNumber(Isolate* isolate) const); - V8_DEPRECATE_SOON("Use maybe version", - Local<String> ToString(Isolate* isolate) const); - V8_DEPRECATE_SOON("Use maybe version", - Local<Object> ToObject(Isolate* isolate) const); - V8_DEPRECATE_SOON("Use maybe version", - Local<Integer> ToInteger(Isolate* isolate) const); - V8_DEPRECATE_SOON("Use maybe version", - Local<Int32> ToInt32(Isolate* isolate) const); + V8_DEPRECATED("Use maybe version", + Local<Number> ToNumber(Isolate* isolate) const); + V8_DEPRECATED("Use maybe version", + Local<String> ToString(Isolate* isolate) const); + V8_DEPRECATED("Use maybe version", + Local<Object> ToObject(Isolate* isolate) const); + V8_DEPRECATED("Use maybe version", + Local<Integer> ToInteger(Isolate* isolate) const); + V8_DEPRECATED("Use maybe version", + Local<Int32> ToInt32(Isolate* isolate) const); /** * Attempts to convert a string to an array index. @@ -2796,7 +2798,7 @@ class V8_EXPORT String : public Name { void operator=(const ExternalStringResourceBase&) = delete; private: - friend class internal::Heap; + friend class internal::ExternalString; friend class v8::String; friend class internal::ScopedExternalStringLock; }; @@ -2904,7 +2906,7 @@ class V8_EXPORT String : public Name { int length = -1); /** Allocates a new string from UTF-16 data.*/ - static V8_DEPRECATE_SOON( + static V8_DEPRECATED( "Use maybe version", Local<String> NewFromTwoByte(Isolate* isolate, const uint16_t* data, NewStringType type = kNormalString, @@ -2953,7 +2955,7 @@ class V8_EXPORT String : public Name { * should the underlying buffer be deallocated or modified except through the * destructor of the external string resource. */ - static V8_DEPRECATE_SOON( + static V8_DEPRECATED( "Use maybe version", Local<String> NewExternal(Isolate* isolate, ExternalOneByteStringResource* resource)); @@ -4527,9 +4529,6 @@ class V8_EXPORT WasmModuleObject : public Object { static void CheckCast(Value* obj); }; -V8_DEPRECATED("Use WasmModuleObject", - typedef WasmModuleObject WasmCompiledModule); - /** * The V8 interface for WebAssembly streaming compilation. When streaming * compilation is initiated, V8 passes a {WasmStreaming} object to the embedder @@ -5165,8 +5164,7 @@ class V8_EXPORT SharedArrayBuffer : public Object { allocation_length_(0), allocation_mode_(Allocator::AllocationMode::kNormal), deleter_(nullptr), - deleter_data_(nullptr), - is_growable_(false) {} + deleter_data_(nullptr) {} void* AllocationBase() const { return allocation_base_; } size_t AllocationLength() const { return allocation_length_; } @@ -5178,13 +5176,12 @@ class V8_EXPORT SharedArrayBuffer : public Object { size_t ByteLength() const { return byte_length_; } DeleterCallback Deleter() const { return deleter_; } void* DeleterData() const { return deleter_data_; } - bool IsGrowable() const { return is_growable_; } private: Contents(void* data, size_t byte_length, void* allocation_base, size_t allocation_length, Allocator::AllocationMode allocation_mode, DeleterCallback deleter, - void* deleter_data, bool is_growable); + void* deleter_data); void* data_; size_t byte_length_; @@ -5193,7 +5190,6 @@ class V8_EXPORT SharedArrayBuffer : public Object { Allocator::AllocationMode allocation_mode_; DeleterCallback deleter_; void* deleter_data_; - bool is_growable_; friend class SharedArrayBuffer; }; @@ -5225,9 +5221,11 @@ class V8_EXPORT SharedArrayBuffer : public Object { * Create a new SharedArrayBuffer over an existing memory block. Propagate * flags to indicate whether the underlying buffer can be grown. */ - static Local<SharedArrayBuffer> New( - Isolate* isolate, const SharedArrayBuffer::Contents&, - ArrayBufferCreationMode mode = ArrayBufferCreationMode::kExternalized); + V8_DEPRECATED("Use New method with data, and byte_length instead.", + static Local<SharedArrayBuffer> New( + Isolate* isolate, const SharedArrayBuffer::Contents&, + ArrayBufferCreationMode mode = + ArrayBufferCreationMode::kExternalized)); /** * Returns true if SharedArrayBuffer is externalized, that is, does not @@ -5316,11 +5314,10 @@ class V8_EXPORT Date : public Object { * This API should not be called more than needed as it will * negatively impact the performance of date operations. */ - V8_DEPRECATE_SOON( - "Use Isolate::DateTimeConfigurationChangeNotification", - static void DateTimeConfigurationChangeNotification( - Isolate* isolate, - TimeZoneDetection time_zone_detection = TimeZoneDetection::kSkip)); + V8_DEPRECATED("Use Isolate::DateTimeConfigurationChangeNotification", + static void DateTimeConfigurationChangeNotification( + Isolate* isolate, TimeZoneDetection time_zone_detection = + TimeZoneDetection::kSkip)); private: static void CheckCast(Value* obj); @@ -6500,10 +6497,6 @@ class V8_EXPORT Extension { // NOLINT bool auto_enable_; }; -V8_DEPRECATED( - "Use unique_ptr version or stop using extension (http://crbug.com/334679).", - void V8_EXPORT RegisterExtension(Extension* extension)); - void V8_EXPORT RegisterExtension(std::unique_ptr<Extension>); // --- Statics --- @@ -6686,7 +6679,7 @@ typedef void (*HostInitializeImportMetaObjectCallback)(Local<Context> context, * first accessed. The return value will be used as the stack value. If this * callback is registed, the |Error.prepareStackTrace| API will be disabled. * |sites| is an array of call sites, specified in - * https://github.com/v8/v8/wiki/Stack-Trace-API + * https://v8.dev/docs/stack-trace-api */ typedef MaybeLocal<Value> (*PrepareStackTraceCallback)(Local<Context> context, Local<Value> error, @@ -6724,11 +6717,8 @@ enum PromiseRejectEvent { class PromiseRejectMessage { public: PromiseRejectMessage(Local<Promise> promise, PromiseRejectEvent event, - Local<Value> value, Local<StackTrace> stack_trace) - : promise_(promise), - event_(event), - value_(value), - stack_trace_(stack_trace) {} + Local<Value> value) + : promise_(promise), event_(event), value_(value) {} V8_INLINE Local<Promise> GetPromise() const { return promise_; } V8_INLINE PromiseRejectEvent GetEvent() const { return event_; } @@ -6738,13 +6728,13 @@ class PromiseRejectMessage { Local<Promise> promise_; PromiseRejectEvent event_; Local<Value> value_; - Local<StackTrace> stack_trace_; }; typedef void (*PromiseRejectCallback)(PromiseRejectMessage message); // --- Microtasks Callbacks --- -typedef void (*MicrotasksCompletedCallback)(Isolate*); +V8_DEPRECATE_SOON("Use *WithData version.", + typedef void (*MicrotasksCompletedCallback)(Isolate*)); typedef void (*MicrotasksCompletedCallbackWithData)(Isolate*, void*); typedef void (*MicrotaskCallback)(void* data); @@ -6778,7 +6768,8 @@ class V8_EXPORT MicrotaskQueue { /** * Creates an empty MicrotaskQueue instance. */ - static std::unique_ptr<MicrotaskQueue> New(); + static std::unique_ptr<MicrotaskQueue> New( + Isolate* isolate, MicrotasksPolicy policy = MicrotasksPolicy::kAuto); virtual ~MicrotaskQueue() = default; @@ -6826,6 +6817,12 @@ class V8_EXPORT MicrotaskQueue { */ virtual bool IsRunningMicrotasks() const = 0; + /** + * Returns the current depth of nested MicrotasksScope that has + * kRunMicrotasks. + */ + virtual int GetMicrotasksScopeDepth() const = 0; + private: friend class internal::MicrotaskQueue; MicrotaskQueue() = default; @@ -7174,6 +7171,13 @@ enum JitCodeEventOptions { */ typedef void (*JitCodeEventHandler)(const JitCodeEvent* event); +/** + * Callback function passed to SetUnhandledExceptionCallback. + */ +#if defined(V8_OS_WIN) +typedef int (*UnhandledExceptionCallback)( + _EXCEPTION_POINTERS* exception_pointers); +#endif /** * Interface for iterating through all external resources in the heap. @@ -8231,12 +8235,20 @@ class V8_EXPORT Isolate { * Executing scripts inside the callback will not re-trigger microtasks and * the callback. */ - void AddMicrotasksCompletedCallback(MicrotasksCompletedCallback callback); + V8_DEPRECATE_SOON("Use *WithData version.", + void AddMicrotasksCompletedCallback( + MicrotasksCompletedCallback callback)); + void AddMicrotasksCompletedCallback( + MicrotasksCompletedCallbackWithData callback, void* data = nullptr); /** * Removes callback that was installed by AddMicrotasksCompletedCallback. */ - void RemoveMicrotasksCompletedCallback(MicrotasksCompletedCallback callback); + V8_DEPRECATE_SOON("Use *WithData version.", + void RemoveMicrotasksCompletedCallback( + MicrotasksCompletedCallback callback)); + void RemoveMicrotasksCompletedCallback( + MicrotasksCompletedCallbackWithData callback, void* data = nullptr); /** * Sets a callback for counting the number of times a feature of V8 is used. @@ -8380,13 +8392,13 @@ class V8_EXPORT Isolate { /** * Returns a memory range that can potentially contain jitted code. Code for * V8's 'builtins' will not be in this range if embedded builtins is enabled. - * Instead, see GetEmbeddedCodeRange. * * On Win64, embedders are advised to install function table callbacks for * these ranges, as default SEH won't be able to unwind through jitted code. - * * The first page of the code range is reserved for the embedder and is - * committed, writable, and executable. + * committed, writable, and executable, to be used to store unwind data, as + * documented in + * https://docs.microsoft.com/en-us/cpp/build/exception-handling-x64. * * Might be empty on other platforms. * @@ -8519,17 +8531,6 @@ class V8_EXPORT Isolate { /** * Iterates through all the persistent handles in the current isolate's heap - * that have class_ids and are candidates to be marked as partially dependent - * handles. This will visit handles to young objects created since the last - * garbage collection but is free to visit an arbitrary superset of these - * objects. - */ - V8_DEPRECATED( - "Use VisitHandlesWithClassIds", - void VisitHandlesForPartialDependence(PersistentHandleVisitor* visitor)); - - /** - * Iterates through all the persistent handles in the current isolate's heap * that have class_ids and are weak to be marked as inactive if there is no * pending activity for the handle. */ @@ -8797,6 +8798,20 @@ class V8_EXPORT V8 { */ static bool EnableWebAssemblyTrapHandler(bool use_v8_signal_handler); +#if defined(V8_OS_WIN) + /** + * On Win64, by default V8 does not emit unwinding data for jitted code, + * which means the OS cannot walk the stack frames and the system Structured + * Exception Handling (SEH) cannot unwind through V8-generated code: + * https://code.google.com/p/v8/issues/detail?id=3598. + * + * This function allows embedders to register a custom exception handler for + * exceptions in V8-generated code. + */ + static void SetUnhandledExceptionCallback( + UnhandledExceptionCallback unhandled_exception_callback); +#endif + private: V8(); @@ -9782,17 +9797,6 @@ bool PersistentBase<T>::IsIndependent() const { } template <class T> -bool PersistentBase<T>::IsNearDeath() const { - typedef internal::Internals I; - if (this->IsEmpty()) return false; - uint8_t node_state = - I::GetNodeState(reinterpret_cast<internal::Address*>(this->val_)); - return node_state == I::kNodeStateIsNearDeathValue || - node_state == I::kNodeStateIsPendingValue; -} - - -template <class T> bool PersistentBase<T>::IsWeak() const { typedef internal::Internals I; if (this->IsEmpty()) return false; @@ -10313,7 +10317,7 @@ AccessorSignature* AccessorSignature::Cast(Data* data) { } Local<Value> Object::GetInternalField(int index) { -#if !defined(V8_ENABLE_CHECKS) && !defined(V8_COMPRESS_POINTERS) +#ifndef V8_ENABLE_CHECKS typedef internal::Address A; typedef internal::Internals I; A obj = *reinterpret_cast<A*>(this); @@ -10324,7 +10328,12 @@ Local<Value> Object::GetInternalField(int index) { instance_type == I::kJSApiObjectType || instance_type == I::kJSSpecialApiObjectType) { int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index); - A value = I::ReadTaggedAnyField(obj, offset); + A value = I::ReadRawField<A>(obj, offset); +#ifdef V8_COMPRESS_POINTERS + // We read the full pointer value and then decompress it in order to avoid + // dealing with potential endiannes issues. + value = I::DecompressTaggedAnyField(obj, static_cast<int32_t>(value)); +#endif internal::Isolate* isolate = internal::IsolateFromNeverReadOnlySpaceObject(obj); A* result = HandleScope::CreateHandle(isolate, value); @@ -10336,7 +10345,7 @@ Local<Value> Object::GetInternalField(int index) { void* Object::GetAlignedPointerFromInternalField(int index) { -#if !defined(V8_ENABLE_CHECKS) && !defined(V8_COMPRESS_POINTERS) +#ifndef V8_ENABLE_CHECKS typedef internal::Address A; typedef internal::Internals I; A obj = *reinterpret_cast<A*>(this); @@ -10925,7 +10934,11 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory( reinterpret_cast<int64_t*>(reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryAtLastMarkCompactOffset); - const int64_t amount = *external_memory + change_in_bytes; + // Embedders are weird: we see both over- and underflows here. Perform the + // addition with unsigned types to avoid undefined behavior. + const int64_t amount = + static_cast<int64_t>(static_cast<uint64_t>(change_in_bytes) + + static_cast<uint64_t>(*external_memory)); *external_memory = amount; int64_t allocation_diff_since_last_mc = @@ -10947,13 +10960,24 @@ int64_t Isolate::AdjustAmountOfExternalAllocatedMemory( } Local<Value> Context::GetEmbedderData(int index) { -#if !defined(V8_ENABLE_CHECKS) && !defined(V8_COMPRESS_POINTERS) +#ifndef V8_ENABLE_CHECKS typedef internal::Address A; typedef internal::Internals I; + A ctx = *reinterpret_cast<const A*>(this); + A embedder_data = + I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset); + int value_offset = + I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index); + A value = I::ReadRawField<A>(embedder_data, value_offset); +#ifdef V8_COMPRESS_POINTERS + // We read the full pointer value and then decompress it in order to avoid + // dealing with potential endiannes issues. + value = + I::DecompressTaggedAnyField(embedder_data, static_cast<int32_t>(value)); +#endif internal::Isolate* isolate = internal::IsolateFromNeverReadOnlySpaceObject( *reinterpret_cast<A*>(this)); - A* result = - HandleScope::CreateHandle(isolate, I::ReadEmbedderData<A>(this, index)); + A* result = HandleScope::CreateHandle(isolate, value); return Local<Value>(reinterpret_cast<Value*>(result)); #else return SlowGetEmbedderData(index); @@ -10962,9 +10986,15 @@ Local<Value> Context::GetEmbedderData(int index) { void* Context::GetAlignedPointerFromEmbedderData(int index) { -#if !defined(V8_ENABLE_CHECKS) && !defined(V8_COMPRESS_POINTERS) +#ifndef V8_ENABLE_CHECKS + typedef internal::Address A; typedef internal::Internals I; - return I::ReadEmbedderData<void*>(this, index); + A ctx = *reinterpret_cast<const A*>(this); + A embedder_data = + I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset); + int value_offset = + I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index); + return I::ReadRawField<void*>(embedder_data, value_offset); #else return SlowGetAlignedPointerFromEmbedderData(index); #endif diff --git a/chromium/v8/include/v8config.h b/chromium/v8/include/v8config.h index e30a582e8f2..5ec0480cf5c 100644 --- a/chromium/v8/include/v8config.h +++ b/chromium/v8/include/v8config.h @@ -64,6 +64,7 @@ // V8_OS_FUCHSIA - Fuchsia // V8_OS_LINUX - Linux // V8_OS_MACOSX - Mac OS X +// V8_OS_IOS - iOS // V8_OS_NETBSD - NetBSD // V8_OS_OPENBSD - OpenBSD // V8_OS_POSIX - POSIX compatible (mostly everything except Windows) @@ -80,6 +81,9 @@ # define V8_OS_BSD 1 # define V8_OS_MACOSX 1 # define V8_OS_POSIX 1 +# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE +# define V8_OS_IOS 1 +# endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE #elif defined(__CYGWIN__) # define V8_OS_CYGWIN 1 # define V8_OS_POSIX 1 |