diff options
Diffstat (limited to 'deps/v8/include')
-rw-r--r-- | deps/v8/include/OWNERS | 2 | ||||
-rw-r--r-- | deps/v8/include/libplatform/libplatform.h | 5 | ||||
-rw-r--r-- | deps/v8/include/v8-inspector.h | 2 | ||||
-rw-r--r-- | deps/v8/include/v8-profiler.h | 20 | ||||
-rw-r--r-- | deps/v8/include/v8-version.h | 8 | ||||
-rw-r--r-- | deps/v8/include/v8.h | 422 | ||||
-rw-r--r-- | deps/v8/include/v8config.h | 2 |
7 files changed, 159 insertions, 302 deletions
diff --git a/deps/v8/include/OWNERS b/deps/v8/include/OWNERS index a7ac912c0a..d20fb79fe1 100644 --- a/deps/v8/include/OWNERS +++ b/deps/v8/include/OWNERS @@ -7,7 +7,9 @@ yangguo@chromium.org per-file v8-inspector.h=dgozman@chromium.org per-file v8-inspector.h=pfeldman@chromium.org +per-file v8-inspector.h=kozyatinskiy@chromium.org per-file v8-inspector-protocol.h=dgozman@chromium.org per-file v8-inspector-protocol.h=pfeldman@chromium.org +per-file v8-inspector-protocol.h=kozyatinskiy@chromium.org # COMPONENT: Blink>JavaScript>API diff --git a/deps/v8/include/libplatform/libplatform.h b/deps/v8/include/libplatform/libplatform.h index a381b97f88..2b167cb9e5 100644 --- a/deps/v8/include/libplatform/libplatform.h +++ b/deps/v8/include/libplatform/libplatform.h @@ -62,11 +62,6 @@ V8_PLATFORM_EXPORT bool PumpMessageLoop( v8::Platform* platform, v8::Isolate* isolate, MessageLoopBehavior behavior = MessageLoopBehavior::kDoNotWait); -V8_PLATFORM_EXPORT V8_DEPRECATED( - "This function has become obsolete and is essentially a nop", - void EnsureEventLoopInitialized(v8::Platform* platform, - v8::Isolate* isolate)); - /** * Runs pending idle tasks for at most |idle_time_in_seconds| seconds. * diff --git a/deps/v8/include/v8-inspector.h b/deps/v8/include/v8-inspector.h index ad04d01bd2..e06963949a 100644 --- a/deps/v8/include/v8-inspector.h +++ b/deps/v8/include/v8-inspector.h @@ -245,6 +245,8 @@ class V8_EXPORT V8Inspector { virtual void contextCreated(const V8ContextInfo&) = 0; virtual void contextDestroyed(v8::Local<v8::Context>) = 0; virtual void resetContextGroup(int contextGroupId) = 0; + virtual v8::MaybeLocal<v8::Context> contextById(int groupId, + v8::Maybe<int> contextId) = 0; // Various instrumentation. virtual void idleStarted() = 0; diff --git a/deps/v8/include/v8-profiler.h b/deps/v8/include/v8-profiler.h index b486683c27..9981061a44 100644 --- a/deps/v8/include/v8-profiler.h +++ b/deps/v8/include/v8-profiler.h @@ -47,24 +47,6 @@ template class V8_EXPORT std::vector<v8::CpuProfileDeoptInfo>; namespace v8 { -/** - * TracingCpuProfiler monitors tracing being enabled/disabled - * and emits CpuProfile trace events once v8.cpu_profiler tracing category - * is enabled. It has no overhead unless the category is enabled. - */ -class V8_EXPORT TracingCpuProfiler { - public: - V8_DEPRECATED( - "The profiler is created automatically with the isolate.\n" - "No need to create it explicitly.", - static std::unique_ptr<TracingCpuProfiler> Create(Isolate*)); - - virtual ~TracingCpuProfiler() = default; - - protected: - TracingCpuProfiler() = default; -}; - // TickSample captures the information collected for each sample. struct TickSample { // Internal profiling (with --prof + tools/$OS-tick-processor) wants to @@ -915,7 +897,7 @@ class V8_EXPORT HeapProfiler { "Use AddBuildEmbedderGraphCallback to provide info about embedder nodes", void SetGetRetainerInfosCallback(GetRetainerInfosCallback callback)); - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use AddBuildEmbedderGraphCallback to provide info about embedder nodes", void SetBuildEmbedderGraphCallback( LegacyBuildEmbedderGraphCallback callback)); diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 57fbc62964..b4c837cda4 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -8,10 +8,10 @@ // These macros define the version number for the current version. // 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 6 -#define V8_MINOR_VERSION 9 -#define V8_BUILD_NUMBER 427 -#define V8_PATCH_LEVEL 23 +#define V8_MAJOR_VERSION 7 +#define V8_MINOR_VERSION 0 +#define V8_BUILD_NUMBER 276 +#define V8_PATCH_LEVEL 20 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/include/v8.h b/deps/v8/include/v8.h index 20a65afcbc..63edc67edf 100644 --- a/deps/v8/include/v8.h +++ b/deps/v8/include/v8.h @@ -155,7 +155,7 @@ class FunctionCallbackArguments; class GlobalHandles; namespace wasm { -class CompilationResultResolver; +class NativeModule; class StreamingDecoder; } // namespace wasm @@ -203,7 +203,7 @@ struct SmiTagging<4> { V8_INLINE static internal::Object* IntToSmi(int value) { return internal::IntToSmi<kSmiShiftSize>(value); } - V8_INLINE static bool IsValidSmi(intptr_t value) { + V8_INLINE static constexpr bool IsValidSmi(intptr_t value) { // To be representable as an tagged small integer, the two // most-significant bits of 'value' must be either 00 or 11 due to // sign-extension. To check this we add 01 to the two @@ -233,7 +233,7 @@ struct SmiTagging<8> { V8_INLINE static internal::Object* IntToSmi(int value) { return internal::IntToSmi<kSmiShiftSize>(value); } - V8_INLINE static bool IsValidSmi(intptr_t value) { + V8_INLINE static constexpr bool IsValidSmi(intptr_t value) { // To be representable as a long smi, the value must be a 32-bit integer. return (value == static_cast<int32_t>(value)); } @@ -1125,10 +1125,6 @@ class V8_EXPORT PrimitiveArray { int Length() const; void Set(Isolate* isolate, int index, Local<Primitive> item); Local<Primitive> Get(Isolate* isolate, int index); - - V8_DEPRECATE_SOON("Use Isolate version", - void Set(int index, Local<Primitive> item)); - V8_DEPRECATE_SOON("Use Isolate version", Local<Primitive> Get(int index)); }; /** @@ -1356,23 +1352,15 @@ class V8_EXPORT Script { /** * A shorthand for ScriptCompiler::Compile(). */ - static V8_DEPRECATED("Use maybe version", - Local<Script> Compile(Local<String> source, - ScriptOrigin* origin = nullptr)); static V8_WARN_UNUSED_RESULT MaybeLocal<Script> Compile( Local<Context> context, Local<String> source, ScriptOrigin* origin = nullptr); - static Local<Script> V8_DEPRECATED("Use maybe version", - Compile(Local<String> source, - Local<String> file_name)); - /** * Runs the script returning the resulting value. It will be run in the * context in which it was created (ScriptCompiler::CompileBound or * UnboundScript::BindToCurrentContext()). */ - V8_DEPRECATED("Use maybe version", Local<Value> Run()); V8_WARN_UNUSED_RESULT MaybeLocal<Value> Run(Local<Context> context); /** @@ -1688,13 +1676,6 @@ class V8_EXPORT ScriptCompiler { * It is possible to specify multiple context extensions (obj in the above * example). */ - static V8_DEPRECATED("Use maybe version", - Local<Function> CompileFunctionInContext( - Isolate* isolate, Source* source, - Local<Context> context, size_t arguments_count, - Local<String> arguments[], - size_t context_extension_count, - Local<Object> context_extensions[])); static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunctionInContext( Local<Context> context, Source* source, size_t arguments_count, Local<String> arguments[], size_t context_extension_count, @@ -1717,10 +1698,6 @@ class V8_EXPORT ScriptCompiler { static CachedData* CreateCodeCache( Local<UnboundModuleScript> unbound_module_script); - V8_DEPRECATED("Source string is no longer required", - static CachedData* CreateCodeCache( - Local<UnboundScript> unbound_script, Local<String> source)); - /** * Creates and returns code cache for the specified function that was * previously produced by CompileFunctionInContext. @@ -1729,10 +1706,6 @@ class V8_EXPORT ScriptCompiler { */ static CachedData* CreateCodeCacheForFunction(Local<Function> function); - V8_DEPRECATED("Source string is no longer required", - static CachedData* CreateCodeCacheForFunction( - Local<Function> function, Local<String> source)); - private: static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundInternal( Isolate* isolate, Source* source, CompileOptions options, @@ -1747,7 +1720,11 @@ class V8_EXPORT Message { public: Local<String> Get() const; - V8_DEPRECATED("Use maybe version", Local<String> GetSourceLine() const); + /** + * Return the isolate to which the Message belongs. + */ + Isolate* GetIsolate() const; + V8_WARN_UNUSED_RESULT MaybeLocal<String> GetSourceLine( Local<Context> context) const; @@ -1773,7 +1750,6 @@ class V8_EXPORT Message { /** * Returns the number, 1-based, of the line where the error occurred. */ - V8_DEPRECATED("Use maybe version", int GetLineNumber() const); V8_WARN_UNUSED_RESULT Maybe<int> GetLineNumber(Local<Context> context) const; /** @@ -1853,8 +1829,6 @@ class V8_EXPORT StackTrace { /** * Returns a StackFrame at a particular index. */ - V8_DEPRECATE_SOON("Use Isolate version", - Local<StackFrame> GetFrame(uint32_t index) const); Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const; /** @@ -2563,13 +2537,6 @@ class V8_EXPORT Value : public Data { V8_DEPRECATE_SOON("Use maybe version", Local<Int32> ToInt32(Isolate* isolate) const); - inline V8_DEPRECATE_SOON("Use maybe version", - Local<Boolean> ToBoolean() const); - inline V8_DEPRECATE_SOON("Use maybe version", Local<String> ToString() const); - inline V8_DEPRECATE_SOON("Use maybe version", Local<Object> ToObject() const); - inline V8_DEPRECATE_SOON("Use maybe version", - Local<Integer> ToInteger() const); - /** * Attempts to convert a string to an array index. * Returns an empty handle if the conversion fails. @@ -2585,14 +2552,7 @@ class V8_EXPORT Value : public Data { Local<Context> context) const; V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const; - V8_DEPRECATE_SOON("Use maybe version", bool BooleanValue() const); - V8_DEPRECATE_SOON("Use maybe version", double NumberValue() const); - V8_DEPRECATE_SOON("Use maybe version", int64_t IntegerValue() const); - V8_DEPRECATE_SOON("Use maybe version", uint32_t Uint32Value() const); - V8_DEPRECATE_SOON("Use maybe version", int32_t Int32Value() const); - /** JS == */ - V8_DEPRECATE_SOON("Use maybe version", bool Equals(Local<Value> that) const); V8_WARN_UNUSED_RESULT Maybe<bool> Equals(Local<Context> context, Local<Value> that) const; bool StrictEquals(Local<Value> that) const; @@ -2699,8 +2659,6 @@ class V8_EXPORT String : public Name { * Returns the number of bytes in the UTF-8 encoded * representation of this string. */ - V8_DEPRECATE_SOON("Use Isolate version instead", int Utf8Length() const); - int Utf8Length(Isolate* isolate) const; /** @@ -2757,23 +2715,12 @@ class V8_EXPORT String : public Name { // 16-bit character codes. int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1, int options = NO_OPTIONS) const; - V8_DEPRECATE_SOON("Use Isolate* version", - int Write(uint16_t* buffer, int start = 0, int length = -1, - int options = NO_OPTIONS) const); // One byte characters. int WriteOneByte(Isolate* isolate, uint8_t* buffer, int start = 0, int length = -1, int options = NO_OPTIONS) const; - V8_DEPRECATE_SOON("Use Isolate* version", - int WriteOneByte(uint8_t* buffer, int start = 0, - int length = -1, int options = NO_OPTIONS) - const); // UTF-8 encoded characters. int WriteUtf8(Isolate* isolate, char* buffer, int length = -1, int* nchars_ref = NULL, int options = NO_OPTIONS) const; - V8_DEPRECATE_SOON("Use Isolate* version", - int WriteUtf8(char* buffer, int length = -1, - int* nchars_ref = NULL, - int options = NO_OPTIONS) const); /** * A zero length string. @@ -2937,9 +2884,6 @@ class V8_EXPORT String : public Name { */ static Local<String> Concat(Isolate* isolate, Local<String> left, Local<String> right); - static V8_DEPRECATE_SOON("Use Isolate* version", - Local<String> Concat(Local<String> left, - Local<String> right)); /** * Creates a new external string using the data defined in the given @@ -2995,6 +2939,11 @@ class V8_EXPORT String : public Name { bool CanMakeExternal(); /** + * Returns true if the strings values are equal. Same as JS ==/===. + */ + bool StringEquals(Local<String> str); + + /** * Converts an object to a UTF-8-encoded character array. Useful if * you want to print the object. If conversion to a string fails * (e.g. due to an exception in the toString() method of the object) @@ -3003,8 +2952,6 @@ class V8_EXPORT String : public Name { */ class V8_EXPORT Utf8Value { public: - V8_DEPRECATED("Use Isolate version", - explicit Utf8Value(Local<v8::Value> obj)); Utf8Value(Isolate* isolate, Local<v8::Value> obj); ~Utf8Value(); char* operator*() { return str_; } @@ -3028,7 +2975,6 @@ class V8_EXPORT String : public Name { */ class V8_EXPORT Value { public: - V8_DEPRECATED("Use Isolate version", explicit Value(Local<v8::Value> obj)); Value(Isolate* isolate, Local<v8::Value> obj); ~Value(); uint16_t* operator*() { return str_; } @@ -3048,6 +2994,12 @@ class V8_EXPORT String : public Name { void VerifyExternalStringResourceBase(ExternalStringResourceBase* v, Encoding encoding) const; void VerifyExternalStringResource(ExternalStringResource* val) const; + ExternalStringResource* GetExternalStringResourceSlow() const; + ExternalStringResourceBase* GetExternalStringResourceBaseSlow( + String::Encoding* encoding_out) const; + const ExternalOneByteStringResource* GetExternalOneByteStringResourceSlow() + const; + static void CheckCast(v8::Value* obj); }; @@ -4204,8 +4156,6 @@ class V8_EXPORT Promise : public Object { /** * Create a new resolver, along with an associated promise in pending state. */ - static V8_DEPRECATED("Use maybe version", - Local<Resolver> New(Isolate* isolate)); static V8_WARN_UNUSED_RESULT MaybeLocal<Resolver> New( Local<Context> context); @@ -4218,11 +4168,9 @@ class V8_EXPORT Promise : public Object { * Resolve/reject the associated promise with a given value. * Ignored if the promise is no longer pending. */ - V8_DEPRECATED("Use maybe version", void Resolve(Local<Value> value)); V8_WARN_UNUSED_RESULT Maybe<bool> Resolve(Local<Context> context, Local<Value> value); - V8_DEPRECATED("Use maybe version", void Reject(Local<Value> value)); V8_WARN_UNUSED_RESULT Maybe<bool> Reject(Local<Context> context, Local<Value> value); @@ -4375,9 +4323,9 @@ class V8_EXPORT WasmCompiledModule : public Object { public: typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> SerializedModule; -// The COMMA macro allows us to use ',' inside of the V8_DEPRECATE_SOON macro. +// The COMMA macro allows us to use ',' inside of the V8_DEPRECATED macro. #define COMMA , - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use BufferReference.", typedef std::pair<const uint8_t * COMMA size_t> CallerOwnedBuffer); #undef COMMA @@ -4391,10 +4339,10 @@ class V8_EXPORT WasmCompiledModule : public Object { BufferReference(const uint8_t* start, size_t size) : start(start), size(size) {} // Temporarily allow conversion to and from CallerOwnedBuffer. - V8_DEPRECATE_SOON( + V8_DEPRECATED( "Use BufferReference directly.", inline BufferReference(CallerOwnedBuffer)); // NOLINT(runtime/explicit) - V8_DEPRECATE_SOON("Use BufferReference directly.", + V8_DEPRECATED("Use BufferReference directly.", inline operator CallerOwnedBuffer()); }; @@ -4411,13 +4359,17 @@ class V8_EXPORT WasmCompiledModule : public Object { TransferrableModule& operator=(const TransferrableModule& src) = delete; private: + typedef std::shared_ptr<internal::wasm::NativeModule> SharedModule; typedef std::pair<std::unique_ptr<const uint8_t[]>, size_t> OwnedBuffer; friend class WasmCompiledModule; - TransferrableModule(OwnedBuffer code, OwnedBuffer bytes) - : compiled_code(std::move(code)), wire_bytes(std::move(bytes)) {} - - OwnedBuffer compiled_code = {nullptr, 0}; - OwnedBuffer wire_bytes = {nullptr, 0}; + explicit TransferrableModule(SharedModule shared_module) + : shared_module_(std::move(shared_module)) {} + TransferrableModule(OwnedBuffer serialized, OwnedBuffer bytes) + : serialized_(std::move(serialized)), wire_bytes_(std::move(bytes)) {} + + SharedModule shared_module_; + OwnedBuffer serialized_ = {nullptr, 0}; + OwnedBuffer wire_bytes_ = {nullptr, 0}; }; /** @@ -4438,7 +4390,7 @@ class V8_EXPORT WasmCompiledModule : public Object { * Get the wasm-encoded bytes that were used to compile this module. */ BufferReference GetWasmWireBytesRef(); - V8_DEPRECATE_SOON("Use GetWasmWireBytesRef version.", + V8_DEPRECATED("Use GetWasmWireBytesRef version.", Local<String> GetWasmWireBytes()); /** @@ -4472,7 +4424,7 @@ class V8_EXPORT WasmCompiledModule : public Object { static void CheckCast(Value* obj); }; -// TODO(clemensh): Remove after M69 branch. +// TODO(clemensh): Remove after M70 branch. WasmCompiledModule::BufferReference::BufferReference( WasmCompiledModule::CallerOwnedBuffer buf) : BufferReference(buf.first, buf.second) {} @@ -4645,17 +4597,22 @@ class V8_EXPORT ArrayBuffer : public Object { * returns an instance of this class, populated, with a pointer to data * and byte length. * - * The Data pointer of ArrayBuffer::Contents is always allocated with - * Allocator::Allocate that is set via Isolate::CreateParams. + * The Data pointer of ArrayBuffer::Contents must be freed using the provided + * deleter, which will call ArrayBuffer::Allocator::Free if the buffer + * was allocated with ArraryBuffer::Allocator::Allocate. */ class V8_EXPORT Contents { // NOLINT public: + using DeleterCallback = void (*)(void* buffer, size_t length, void* info); + Contents() : data_(nullptr), byte_length_(0), allocation_base_(nullptr), allocation_length_(0), - allocation_mode_(Allocator::AllocationMode::kNormal) {} + allocation_mode_(Allocator::AllocationMode::kNormal), + deleter_(nullptr), + deleter_data_(nullptr) {} void* AllocationBase() const { return allocation_base_; } size_t AllocationLength() const { return allocation_length_; } @@ -4665,13 +4622,22 @@ class V8_EXPORT ArrayBuffer : public Object { void* Data() const { return data_; } size_t ByteLength() const { return byte_length_; } + DeleterCallback Deleter() const { return deleter_; } + void* DeleterData() const { return deleter_data_; } private: + Contents(void* data, size_t byte_length, void* allocation_base, + size_t allocation_length, + Allocator::AllocationMode allocation_mode, DeleterCallback deleter, + void* deleter_data); + void* data_; size_t byte_length_; void* allocation_base_; size_t allocation_length_; Allocator::AllocationMode allocation_mode_; + DeleterCallback deleter_; + void* deleter_data_; friend class ArrayBuffer; }; @@ -4728,8 +4694,9 @@ class V8_EXPORT ArrayBuffer : public Object { * had been externalized, it does no longer own the memory block. The caller * should take steps to free memory when it is no longer needed. * - * The memory block is guaranteed to be allocated with |Allocator::Allocate| - * that has been set via Isolate::CreateParams. + * The Data pointer of ArrayBuffer::Contents must be freed using the provided + * deleter, which will call ArrayBuffer::Allocator::Free if the buffer + * was allocated with ArraryBuffer::Allocator::Allocate. */ Contents Externalize(); @@ -4740,8 +4707,6 @@ class V8_EXPORT ArrayBuffer : public Object { * * The embedder should make sure to hold a strong reference to the * ArrayBuffer while accessing this pointer. - * - * The memory block is guaranteed to be allocated with |Allocator::Allocate|. */ Contents GetContents(); @@ -5048,41 +5013,54 @@ class V8_EXPORT SharedArrayBuffer : public Object { * |SharedArrayBuffer| returns an instance of this class, populated, with a * pointer to data and byte length. * - * The Data pointer of SharedArrayBuffer::Contents is always allocated with - * |ArrayBuffer::Allocator::Allocate| by the allocator specified in - * v8::Isolate::CreateParams::array_buffer_allocator. + * The Data pointer of ArrayBuffer::Contents must be freed using the provided + * deleter, which will call ArrayBuffer::Allocator::Free if the buffer + * was allocated with ArraryBuffer::Allocator::Allocate. * * This API is experimental and may change significantly. */ class V8_EXPORT Contents { // NOLINT public: + using Allocator = v8::ArrayBuffer::Allocator; + using DeleterCallback = void (*)(void* buffer, size_t length, void* info); + Contents() : data_(nullptr), byte_length_(0), allocation_base_(nullptr), allocation_length_(0), - allocation_mode_(ArrayBuffer::Allocator::AllocationMode::kNormal) {} + allocation_mode_(Allocator::AllocationMode::kNormal), + deleter_(nullptr), + deleter_data_(nullptr) {} void* AllocationBase() const { return allocation_base_; } size_t AllocationLength() const { return allocation_length_; } - ArrayBuffer::Allocator::AllocationMode AllocationMode() const { + Allocator::AllocationMode AllocationMode() const { return allocation_mode_; } void* Data() const { return data_; } size_t ByteLength() const { return byte_length_; } + DeleterCallback Deleter() const { return deleter_; } + void* DeleterData() const { return deleter_data_; } private: + Contents(void* data, size_t byte_length, void* allocation_base, + size_t allocation_length, + Allocator::AllocationMode allocation_mode, DeleterCallback deleter, + void* deleter_data); + void* data_; size_t byte_length_; void* allocation_base_; size_t allocation_length_; - ArrayBuffer::Allocator::AllocationMode allocation_mode_; + Allocator::AllocationMode allocation_mode_; + DeleterCallback deleter_; + void* deleter_data_; friend class SharedArrayBuffer; }; - /** * Data length in bytes. */ @@ -5239,8 +5217,6 @@ class V8_EXPORT BooleanObject : public Object { class V8_EXPORT StringObject : public Object { public: static Local<Value> New(Isolate* isolate, Local<String> value); - static V8_DEPRECATE_SOON("Use Isolate* version", - Local<Value> New(Local<String> value)); Local<String> ValueOf() const; @@ -5296,8 +5272,6 @@ class V8_EXPORT RegExp : public Object { * static_cast<RegExp::Flags>(kGlobal | kMultiline)) * is equivalent to evaluating "/foo/gm". */ - static V8_DEPRECATED("Use maybe version", - Local<RegExp> New(Local<String> pattern, Flags flags)); static V8_WARN_UNUSED_RESULT MaybeLocal<RegExp> New(Local<Context> context, Local<String> pattern, Flags flags); @@ -5441,57 +5415,8 @@ class V8_EXPORT Template : public Data { friend class FunctionTemplate; }; - -/** - * NamedProperty[Getter|Setter] are used as interceptors on object. - * See ObjectTemplate::SetNamedPropertyHandler. - */ -typedef void (*NamedPropertyGetterCallback)( - Local<String> property, - const PropertyCallbackInfo<Value>& info); - - -/** - * Returns the value if the setter intercepts the request. - * Otherwise, returns an empty handle. - */ -typedef void (*NamedPropertySetterCallback)( - Local<String> property, - Local<Value> value, - const PropertyCallbackInfo<Value>& info); - - -/** - * Returns a non-empty handle if the interceptor intercepts the request. - * The result is an integer encoding property attributes (like v8::None, - * v8::DontEnum, etc.) - */ -typedef void (*NamedPropertyQueryCallback)( - Local<String> property, - const PropertyCallbackInfo<Integer>& info); - - -/** - * Returns a non-empty handle if the deleter intercepts the request. - * The return value is true if the property could be deleted and false - * otherwise. - */ -typedef void (*NamedPropertyDeleterCallback)( - Local<String> property, - const PropertyCallbackInfo<Boolean>& info); - -/** - * Returns an array containing the names of the properties the named - * property getter intercepts. - * - * Note: The values in the array must be of type v8::Name. - */ -typedef void (*NamedPropertyEnumeratorCallback)( - const PropertyCallbackInfo<Array>& info); - - -// TODO(dcarney): Deprecate and remove previous typedefs, and replace -// GenericNamedPropertyFooCallback with just NamedPropertyFooCallback. +// TODO(dcarney): Replace GenericNamedPropertyFooCallback with just +// NamedPropertyFooCallback. /** * Interceptor for get requests on an object. @@ -6200,39 +6125,6 @@ class V8_EXPORT ObjectTemplate : public Template { /** * Sets a named property handler on the object template. * - * Whenever a property whose name is a string is accessed on objects created - * from this object template, the provided callback is invoked instead of - * accessing the property directly on the JavaScript object. - * - * SetNamedPropertyHandler() is different from SetHandler(), in - * that the latter can intercept symbol-named properties as well as - * string-named properties when called with a - * NamedPropertyHandlerConfiguration. New code should use SetHandler(). - * - * \param getter The callback to invoke when getting a property. - * \param setter The callback to invoke when setting a property. - * \param query The callback to invoke to check if a property is present, - * and if present, get its attributes. - * \param deleter The callback to invoke when deleting a property. - * \param enumerator The callback to invoke to enumerate all the named - * properties of an object. - * \param data A piece of data that will be passed to the callbacks - * whenever they are invoked. - */ - V8_DEPRECATED( - "Use SetHandler(const NamedPropertyHandlerConfiguration) " - "with the kOnlyInterceptStrings flag set.", - void SetNamedPropertyHandler( - NamedPropertyGetterCallback getter, - NamedPropertySetterCallback setter = 0, - NamedPropertyQueryCallback query = 0, - NamedPropertyDeleterCallback deleter = 0, - NamedPropertyEnumeratorCallback enumerator = 0, - Local<Value> data = Local<Value>())); - - /** - * Sets a named property handler on the object template. - * * Whenever a property whose name is a string or a symbol is accessed on * objects created from this object template, the provided callback is * invoked instead of accessing the property directly on the JavaScript @@ -6401,9 +6293,8 @@ class V8_EXPORT AccessorSignature : public Data { // --- Extensions --- -V8_DEPRECATE_SOON("Implementation detail", - class ExternalOneByteStringResourceImpl); -class V8_EXPORT ExternalOneByteStringResourceImpl +V8_DEPRECATE_SOON("Implementation detail", class) +V8_EXPORT ExternalOneByteStringResourceImpl : public String::ExternalOneByteStringResource { public: ExternalOneByteStringResourceImpl() : data_(0), length_(0) {} @@ -6613,7 +6504,6 @@ typedef void (*AddHistogramSampleCallback)(void* histogram, int sample); // --- Enter/Leave Script Callback --- typedef void (*BeforeCallEnteredCallback)(Isolate*); typedef void (*CallCompletedCallback)(Isolate*); -typedef void (*DeprecatedCallCompletedCallback)(); /** * HostImportModuleDynamicallyCallback is called when we require the @@ -6787,6 +6677,9 @@ typedef void (*ApiImplementationCallback)(const FunctionCallbackInfo<Value>&); // --- Callback for WebAssembly.compileStreaming --- typedef void (*WasmStreamingCallback)(const FunctionCallbackInfo<Value>&); +// --- Callback for checking if WebAssembly threads are enabled --- +typedef bool (*WasmThreadsEnabledCallback)(Local<Context> context); + // --- Garbage Collection Callbacks --- /** @@ -6859,6 +6752,7 @@ class V8_EXPORT HeapStatistics { size_t used_heap_size() { return used_heap_size_; } size_t heap_size_limit() { return heap_size_limit_; } size_t malloced_memory() { return malloced_memory_; } + size_t external_memory() { return external_memory_; } size_t peak_malloced_memory() { return peak_malloced_memory_; } size_t number_of_native_contexts() { return number_of_native_contexts_; } size_t number_of_detached_contexts() { return number_of_detached_contexts_; } @@ -6877,6 +6771,7 @@ class V8_EXPORT HeapStatistics { size_t used_heap_size_; size_t heap_size_limit_; size_t malloced_memory_; + size_t external_memory_; size_t peak_malloced_memory_; bool does_zap_garbage_; size_t number_of_native_contexts_; @@ -7102,18 +6997,21 @@ class V8_EXPORT PersistentHandleVisitor { // NOLINT enum class MemoryPressureLevel { kNone, kModerate, kCritical }; /** - * Interface for tracing through the embedder heap. During a v8 garbage - * collection, v8 collects hidden fields of all potential wrappers, and at the + * Interface for tracing through the embedder heap. During a V8 garbage + * collection, V8 collects hidden fields of all potential wrappers, and at the * end of its marking phase iterates the collection and asks the embedder to * trace through its heap and use reporter to report each JavaScript object * reachable from any of the given wrappers. - * - * Before the first call to the TraceWrappersFrom function TracePrologue will be - * called. When the garbage collection cycle is finished, TraceEpilogue will be - * called. */ class V8_EXPORT EmbedderHeapTracer { public: + // Indicator for the stack state of the embedder. + enum EmbedderStackState { + kUnknown, + kNonEmpty, + kEmpty, + }; + enum ForceCompletionAction { FORCE_COMPLETION, DO_NOT_FORCE_COMPLETION }; struct AdvanceTracingActions { @@ -7123,6 +7021,8 @@ class V8_EXPORT EmbedderHeapTracer { ForceCompletionAction force_completion; }; + virtual ~EmbedderHeapTracer() = default; + /** * Called by v8 to register internal fields of found wrappers. * @@ -7138,7 +7038,7 @@ class V8_EXPORT EmbedderHeapTracer { virtual void TracePrologue() = 0; /** - * Called to to make a tracing step in the embedder. + * Called to make a tracing step in the embedder. * * The embedder is expected to trace its heap starting from wrappers reported * by RegisterV8References method, and report back all reachable wrappers. @@ -7146,15 +7046,36 @@ class V8_EXPORT EmbedderHeapTracer { * deadline. * * Returns true if there is still work to do. + * + * Note: Only one of the AdvanceTracing methods needs to be overriden by the + * embedder. + */ + V8_DEPRECATE_SOON("Use void AdvanceTracing(deadline_in_ms)", + virtual bool AdvanceTracing( + double deadline_in_ms, AdvanceTracingActions actions)) { + return false; + } + + /** + * Called to advance tracing in the embedder. + * + * The embedder is expected to trace its heap starting from wrappers reported + * by RegisterV8References method, and report back all reachable wrappers. + * Furthermore, the embedder is expected to stop tracing by the given + * deadline. A deadline of infinity means that tracing should be finished. + * + * Returns |true| if tracing is done, and false otherwise. + * + * Note: Only one of the AdvanceTracing methods needs to be overriden by the + * embedder. */ - virtual bool AdvanceTracing(double deadline_in_ms, - AdvanceTracingActions actions) = 0; + virtual bool AdvanceTracing(double deadline_in_ms); /* * Returns true if there no more tracing work to be done (see AdvanceTracing) * and false otherwise. */ - virtual bool IsTracingDone() { return NumberOfWrappersToTrace() == 0; } + virtual bool IsTracingDone(); /** * Called at the end of a GC cycle. @@ -7166,8 +7087,13 @@ class V8_EXPORT EmbedderHeapTracer { /** * Called upon entering the final marking pause. No more incremental marking * steps will follow this call. + * + * Note: Only one of the EnterFinalPause methods needs to be overriden by the + * embedder. */ - virtual void EnterFinalPause() = 0; + V8_DEPRECATE_SOON("Use void EnterFinalPause(EmbedderStackState)", + virtual void EnterFinalPause()) {} + virtual void EnterFinalPause(EmbedderStackState stack_state); /** * Called when tracing is aborted. @@ -7178,7 +7104,7 @@ class V8_EXPORT EmbedderHeapTracer { virtual void AbortTracing() = 0; /* - * Called by the embedder to request immediaet finalization of the currently + * Called by the embedder to request immediate finalization of the currently * running tracing phase that has been started with TracePrologue and not * yet finished with TraceEpilogue. * @@ -7189,6 +7115,13 @@ class V8_EXPORT EmbedderHeapTracer { void FinalizeTracing(); /* + * Called by the embedder to immediately perform a full garbage collection. + * + * Should only be used in testing code. + */ + void GarbageCollectionForTesting(EmbedderStackState stack_state); + + /* * Returns the v8::Isolate this tracer is attached too and |nullptr| if it * is not attached to any v8::Isolate. */ @@ -7198,11 +7131,11 @@ class V8_EXPORT EmbedderHeapTracer { * Returns the number of wrappers that are still to be traced by the embedder. */ V8_DEPRECATE_SOON("Use IsTracingDone", - virtual size_t NumberOfWrappersToTrace() { return 0; }); + virtual size_t NumberOfWrappersToTrace()) { + return 0; + } protected: - virtual ~EmbedderHeapTracer() = default; - v8::Isolate* isolate_ = nullptr; friend class internal::LocalEmbedderHeapTracer; @@ -7500,6 +7433,8 @@ class V8_EXPORT Isolate { kDeoptimizerDisableSpeculation = 47, kArrayPrototypeSortJSArrayModifiedPrototype = 48, kFunctionTokenOffsetTooLongForToString = 49, + kWasmSharedMemory = 50, + kWasmThreadOpcodes = 51, // If you add new values here, you'll also need to update Chromium's: // web_feature.mojom, UseCounterCallback.cpp, and enums.xml. V8 changes to @@ -7768,16 +7703,6 @@ class V8_EXPORT Isolate { */ Local<Context> GetCurrentContext(); - /** - * Returns the context of the calling JavaScript code. That is the - * context of the top-most JavaScript frame. If there are no - * JavaScript frames an empty handle is returned. - */ - V8_DEPRECATED( - "Calling context concept is not compatible with tail calls, and will be " - "removed.", - Local<Context> GetCallingContext()); - /** Returns the last context entered through V8's C++ API. */ Local<Context> GetEnteredContext(); @@ -8029,17 +7954,11 @@ class V8_EXPORT Isolate { * further callbacks. */ void AddCallCompletedCallback(CallCompletedCallback callback); - V8_DEPRECATED( - "Use callback with parameter", - void AddCallCompletedCallback(DeprecatedCallCompletedCallback callback)); /** * Removes callback that was installed by AddCallCompletedCallback. */ void RemoveCallCompletedCallback(CallCompletedCallback callback); - V8_DEPRECATED("Use callback with parameter", - void RemoveCallCompletedCallback( - DeprecatedCallCompletedCallback callback)); /** * Set the PromiseHook callback for various promise lifecycle @@ -8073,14 +7992,11 @@ class V8_EXPORT Isolate { * Controls how Microtasks are invoked. See MicrotasksPolicy for details. */ void SetMicrotasksPolicy(MicrotasksPolicy policy); - V8_DEPRECATED("Use SetMicrotasksPolicy", - void SetAutorunMicrotasks(bool autorun)); /** * Returns the policy controlling how Microtasks are invoked. */ MicrotasksPolicy GetMicrotasksPolicy() const; - V8_DEPRECATED("Use GetMicrotasksPolicy", bool WillAutorunMicrotasks() const); /** * Adds a callback to notify the host application after @@ -8303,6 +8219,8 @@ class V8_EXPORT Isolate { void SetWasmStreamingCallback(WasmStreamingCallback callback); + void SetWasmThreadsEnabledCallback(WasmThreadsEnabledCallback callback); + /** * Check if V8 is dead and therefore unusable. This is the case after * fatal errors such as out-of-memory situations. @@ -8467,28 +8385,6 @@ class V8_EXPORT V8 { static void SetNativesDataBlob(StartupData* startup_blob); static void SetSnapshotDataBlob(StartupData* startup_blob); - /** - * Bootstrap an isolate and a context from scratch to create a startup - * snapshot. Include the side-effects of running the optional script. - * Returns { NULL, 0 } on failure. - * The caller acquires ownership of the data array in the return value. - */ - V8_DEPRECATED("Use SnapshotCreator", - static StartupData CreateSnapshotDataBlob( - const char* embedded_source = NULL)); - - /** - * Bootstrap an isolate and a context from the cold startup blob, run the - * warm-up script to trigger code compilation. The side effects are then - * discarded. The resulting startup snapshot will include compiled code. - * Returns { NULL, 0 } on failure. - * The caller acquires ownership of the data array in the return value. - * The argument startup blob is untouched. - */ - V8_DEPRECATED("Use SnapshotCreator", - static StartupData WarmUpSnapshotDataBlob( - StartupData cold_startup_blob, const char* warmup_source)); - /** Set the callback to invoke in case of Dcheck failures. */ static void SetDcheckErrorHandler(DcheckErrorCallback that); @@ -8956,7 +8852,6 @@ class V8_EXPORT TryCatch { * Returns the .stack property of the thrown object. If no .stack * property is present an empty handle is returned. */ - V8_DEPRECATED("Use maybe version.", Local<Value> StackTrace() const); V8_WARN_UNUSED_RESULT MaybeLocal<Value> StackTrace( Local<Context> context) const; @@ -9535,7 +9430,7 @@ class Internals { return PlatformSmiTagging::IntToSmi(value); } - V8_INLINE static bool IsValidSmi(intptr_t value) { + V8_INLINE static constexpr bool IsValidSmi(intptr_t value) { return PlatformSmiTagging::IsValidSmi(value); } @@ -10209,12 +10104,13 @@ String::ExternalStringResource* String::GetExternalStringResource() const { typedef internal::Object O; typedef internal::Internals I; O* obj = *reinterpret_cast<O* const*>(this); - String::ExternalStringResource* result; + + ExternalStringResource* result; if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) { void* value = I::ReadField<void*>(obj, I::kStringResourceOffset); result = reinterpret_cast<String::ExternalStringResource*>(value); } else { - result = NULL; + result = GetExternalStringResourceSlow(); } #ifdef V8_ENABLE_CHECKS VerifyExternalStringResource(result); @@ -10230,14 +10126,16 @@ String::ExternalStringResourceBase* String::GetExternalStringResourceBase( O* obj = *reinterpret_cast<O* const*>(this); int type = I::GetInstanceType(obj) & I::kFullStringRepresentationMask; *encoding_out = static_cast<Encoding>(type & I::kStringEncodingMask); - ExternalStringResourceBase* resource = NULL; + ExternalStringResourceBase* resource; if (type == I::kExternalOneByteRepresentationTag || type == I::kExternalTwoByteRepresentationTag) { void* value = I::ReadField<void*>(obj, I::kStringResourceOffset); resource = static_cast<ExternalStringResourceBase*>(value); + } else { + resource = GetExternalStringResourceBaseSlow(encoding_out); } #ifdef V8_ENABLE_CHECKS - VerifyExternalStringResourceBase(resource, *encoding_out); + VerifyExternalStringResourceBase(resource, *encoding_out); #endif return resource; } @@ -10318,30 +10216,6 @@ template <class T> Value* Value::Cast(T* value) { } -Local<Boolean> Value::ToBoolean() const { - return ToBoolean(Isolate::GetCurrent()->GetCurrentContext()) - .FromMaybe(Local<Boolean>()); -} - - -Local<String> Value::ToString() const { - return ToString(Isolate::GetCurrent()->GetCurrentContext()) - .FromMaybe(Local<String>()); -} - - -Local<Object> Value::ToObject() const { - return ToObject(Isolate::GetCurrent()->GetCurrentContext()) - .FromMaybe(Local<Object>()); -} - - -Local<Integer> Value::ToInteger() const { - return ToInteger(Isolate::GetCurrent()->GetCurrentContext()) - .FromMaybe(Local<Integer>()); -} - - Boolean* Boolean::Cast(v8::Value* value) { #ifdef V8_ENABLE_CHECKS CheckCast(value); diff --git a/deps/v8/include/v8config.h b/deps/v8/include/v8config.h index d8e1f36c12..75fd5aa7e7 100644 --- a/deps/v8/include/v8config.h +++ b/deps/v8/include/v8config.h @@ -214,6 +214,8 @@ # define V8_HAS_ATTRIBUTE_ALIGNED (__has_attribute(aligned)) # define V8_HAS_ATTRIBUTE_ALWAYS_INLINE (__has_attribute(always_inline)) # define V8_HAS_ATTRIBUTE_DEPRECATED (__has_attribute(deprecated)) +# define V8_HAS_ATTRIBUTE_DEPRECATED_MESSAGE \ + (__has_extension(attribute_deprecated_with_message)) # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline)) # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused)) # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility)) |