Commit e677c91f authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[include][cleanup] Replace typedef by using

The rest of the code base was already migrated last year in
https://crrev.com/c/1631409. In the API we have to be more careful to
not break embedders. According to the standard there is no semantic
difference between typedef and using ([decl.typedef#2]):
  A typedef-name can also be introduced by an alias-declaration. The
  identifier following the using keyword becomes a typedef-name and the
  optional attribute-specifier-seq following the identifier appertains
  to that typedef-name. Such a typedef-name has the same semantics as if
  it were introduced by the typedef specifier.

Thus this CL replaces all typedefs in include/v8.h by the equivalent
using declaration. This improves readability, especially for function
pointer types.

R=ulan@chromium.org
CC=leszeks@chromium.org

Bug: v8:11074
Change-Id: Id917b6aa5c8cd289c60bda5da1e3667e747936e7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2563880
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71719}
parent 9d7de198
...@@ -436,7 +436,7 @@ static const int kEmbedderFieldsInWeakCallback = 2; ...@@ -436,7 +436,7 @@ static const int kEmbedderFieldsInWeakCallback = 2;
template <typename T> template <typename T>
class WeakCallbackInfo { class WeakCallbackInfo {
public: public:
typedef void (*Callback)(const WeakCallbackInfo<T>& data); using Callback = void (*)(const WeakCallbackInfo<T>& data);
WeakCallbackInfo(Isolate* isolate, T* parameter, WeakCallbackInfo(Isolate* isolate, T* parameter,
void* embedder_fields[kEmbedderFieldsInWeakCallback], void* embedder_fields[kEmbedderFieldsInWeakCallback],
...@@ -630,7 +630,7 @@ template <class T> class PersistentBase { ...@@ -630,7 +630,7 @@ template <class T> class PersistentBase {
template<class T> template<class T>
class NonCopyablePersistentTraits { class NonCopyablePersistentTraits {
public: public:
typedef Persistent<T, NonCopyablePersistentTraits<T> > NonCopyablePersistent; using NonCopyablePersistent = Persistent<T, NonCopyablePersistentTraits<T>>;
static const bool kResetInDestructor = false; static const bool kResetInDestructor = false;
template<class S, class M> template<class S, class M>
V8_INLINE static void Copy(const Persistent<S, M>& source, V8_INLINE static void Copy(const Persistent<S, M>& source,
...@@ -647,7 +647,7 @@ class NonCopyablePersistentTraits { ...@@ -647,7 +647,7 @@ class NonCopyablePersistentTraits {
*/ */
template<class T> template<class T>
struct CopyablePersistentTraits { struct CopyablePersistentTraits {
typedef Persistent<T, CopyablePersistentTraits<T> > CopyablePersistent; using CopyablePersistent = Persistent<T, CopyablePersistentTraits<T>>;
static const bool kResetInDestructor = true; static const bool kResetInDestructor = true;
template<class S, class M> template<class S, class M>
static V8_INLINE void Copy(const Persistent<S, M>& source, static V8_INLINE void Copy(const Persistent<S, M>& source,
...@@ -809,7 +809,7 @@ class Global : public PersistentBase<T> { ...@@ -809,7 +809,7 @@ class Global : public PersistentBase<T> {
/* /*
* For compatibility with Chromium's base::Bind (base::Passed). * For compatibility with Chromium's base::Bind (base::Passed).
*/ */
typedef void MoveOnlyTypeForCPP03; using MoveOnlyTypeForCPP03 = void;
Global(const Global&) = delete; Global(const Global&) = delete;
void operator=(const Global&) = delete; void operator=(const Global&) = delete;
...@@ -1629,11 +1629,10 @@ class V8_EXPORT Module : public Data { ...@@ -1629,11 +1629,10 @@ class V8_EXPORT Module : public Data {
*/ */
int GetIdentityHash() const; int GetIdentityHash() const;
V8_DEPRECATE_SOON("Use ResolveModuleCallback") using ResolveCallback V8_DEPRECATE_SOON("Use ResolveModuleCallback") =
typedef MaybeLocal<Module> (*ResolveCallback)(Local<Context> context, MaybeLocal<Module> (*)(Local<Context> context, Local<String> specifier,
Local<String> specifier, Local<Module> referrer);
Local<Module> referrer); using ResolveModuleCallback = MaybeLocal<Module> (*)(
typedef MaybeLocal<Module> (*ResolveModuleCallback)(
Local<Context> context, Local<String> specifier, Local<Context> context, Local<String> specifier,
Local<FixedArray> import_assertions, Local<Module> referrer); Local<FixedArray> import_assertions, Local<Module> referrer);
...@@ -1709,8 +1708,8 @@ class V8_EXPORT Module : public Data { ...@@ -1709,8 +1708,8 @@ class V8_EXPORT Module : public Data {
* exception was thrown) and return an empy MaybeLocal to indicate falure * exception was thrown) and return an empy MaybeLocal to indicate falure
* (where an exception was thrown). * (where an exception was thrown).
*/ */
typedef MaybeLocal<Value> (*SyntheticModuleEvaluationSteps)( using SyntheticModuleEvaluationSteps =
Local<Context> context, Local<Module> module); MaybeLocal<Value> (*)(Local<Context> context, Local<Module> module);
/** /**
* Creates a new SyntheticModule with the specified export names, where * Creates a new SyntheticModule with the specified export names, where
...@@ -3758,23 +3757,17 @@ enum PropertyAttribute { ...@@ -3758,23 +3757,17 @@ enum PropertyAttribute {
* setting|getting a particular property. See Object and ObjectTemplate's * setting|getting a particular property. See Object and ObjectTemplate's
* method SetAccessor. * method SetAccessor.
*/ */
typedef void (*AccessorGetterCallback)( using AccessorGetterCallback =
Local<String> property, void (*)(Local<String> property, const PropertyCallbackInfo<Value>& info);
const PropertyCallbackInfo<Value>& info); using AccessorNameGetterCallback =
typedef void (*AccessorNameGetterCallback)( void (*)(Local<Name> property, const PropertyCallbackInfo<Value>& info);
Local<Name> property,
const PropertyCallbackInfo<Value>& info);
typedef void (*AccessorSetterCallback)(
Local<String> property,
Local<Value> value,
const PropertyCallbackInfo<void>& info);
typedef void (*AccessorNameSetterCallback)(
Local<Name> property,
Local<Value> value,
const PropertyCallbackInfo<void>& info);
using AccessorSetterCallback = void (*)(Local<String> property,
Local<Value> value,
const PropertyCallbackInfo<void>& info);
using AccessorNameSetterCallback =
void (*)(Local<Name> property, Local<Value> value,
const PropertyCallbackInfo<void>& info);
/** /**
* Access control specifications. * Access control specifications.
...@@ -4626,8 +4619,7 @@ class PropertyCallbackInfo { ...@@ -4626,8 +4619,7 @@ class PropertyCallbackInfo {
internal::Address* args_; internal::Address* args_;
}; };
using FunctionCallback = void (*)(const FunctionCallbackInfo<Value>& info);
typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info);
enum class ConstructorBehavior { kThrow, kAllow }; enum class ConstructorBehavior { kThrow, kAllow };
...@@ -6344,8 +6336,8 @@ class V8_EXPORT Template : public Data { ...@@ -6344,8 +6336,8 @@ class V8_EXPORT Template : public Data {
* *
* See also `ObjectTemplate::SetHandler`. * See also `ObjectTemplate::SetHandler`.
*/ */
typedef void (*GenericNamedPropertyGetterCallback)( using GenericNamedPropertyGetterCallback =
Local<Name> property, const PropertyCallbackInfo<Value>& info); void (*)(Local<Name> property, const PropertyCallbackInfo<Value>& info);
/** /**
* Interceptor for set requests on an object. * Interceptor for set requests on an object.
...@@ -6368,9 +6360,9 @@ typedef void (*GenericNamedPropertyGetterCallback)( ...@@ -6368,9 +6360,9 @@ typedef void (*GenericNamedPropertyGetterCallback)(
* See also * See also
* `ObjectTemplate::SetHandler.` * `ObjectTemplate::SetHandler.`
*/ */
typedef void (*GenericNamedPropertySetterCallback)( using GenericNamedPropertySetterCallback =
Local<Name> property, Local<Value> value, void (*)(Local<Name> property, Local<Value> value,
const PropertyCallbackInfo<Value>& info); const PropertyCallbackInfo<Value>& info);
/** /**
* Intercepts all requests that query the attributes of the * Intercepts all requests that query the attributes of the
...@@ -6393,8 +6385,8 @@ typedef void (*GenericNamedPropertySetterCallback)( ...@@ -6393,8 +6385,8 @@ typedef void (*GenericNamedPropertySetterCallback)(
* See also * See also
* `ObjectTemplate::SetHandler.` * `ObjectTemplate::SetHandler.`
*/ */
typedef void (*GenericNamedPropertyQueryCallback)( using GenericNamedPropertyQueryCallback =
Local<Name> property, const PropertyCallbackInfo<Integer>& info); void (*)(Local<Name> property, const PropertyCallbackInfo<Integer>& info);
/** /**
* Interceptor for delete requests on an object. * Interceptor for delete requests on an object.
...@@ -6417,8 +6409,8 @@ typedef void (*GenericNamedPropertyQueryCallback)( ...@@ -6417,8 +6409,8 @@ typedef void (*GenericNamedPropertyQueryCallback)(
* *
* See also `ObjectTemplate::SetHandler.` * See also `ObjectTemplate::SetHandler.`
*/ */
typedef void (*GenericNamedPropertyDeleterCallback)( using GenericNamedPropertyDeleterCallback =
Local<Name> property, const PropertyCallbackInfo<Boolean>& info); void (*)(Local<Name> property, const PropertyCallbackInfo<Boolean>& info);
/** /**
* Returns an array containing the names of the properties the named * Returns an array containing the names of the properties the named
...@@ -6426,8 +6418,8 @@ typedef void (*GenericNamedPropertyDeleterCallback)( ...@@ -6426,8 +6418,8 @@ typedef void (*GenericNamedPropertyDeleterCallback)(
* *
* Note: The values in the array must be of type v8::Name. * Note: The values in the array must be of type v8::Name.
*/ */
typedef void (*GenericNamedPropertyEnumeratorCallback)( using GenericNamedPropertyEnumeratorCallback =
const PropertyCallbackInfo<Array>& info); void (*)(const PropertyCallbackInfo<Array>& info);
/** /**
* Interceptor for defineProperty requests on an object. * Interceptor for defineProperty requests on an object.
...@@ -6449,9 +6441,9 @@ typedef void (*GenericNamedPropertyEnumeratorCallback)( ...@@ -6449,9 +6441,9 @@ typedef void (*GenericNamedPropertyEnumeratorCallback)(
* *
* See also `ObjectTemplate::SetHandler`. * See also `ObjectTemplate::SetHandler`.
*/ */
typedef void (*GenericNamedPropertyDefinerCallback)( using GenericNamedPropertyDefinerCallback =
Local<Name> property, const PropertyDescriptor& desc, void (*)(Local<Name> property, const PropertyDescriptor& desc,
const PropertyCallbackInfo<Value>& info); const PropertyCallbackInfo<Value>& info);
/** /**
* Interceptor for getOwnPropertyDescriptor requests on an object. * Interceptor for getOwnPropertyDescriptor requests on an object.
...@@ -6472,37 +6464,33 @@ typedef void (*GenericNamedPropertyDefinerCallback)( ...@@ -6472,37 +6464,33 @@ typedef void (*GenericNamedPropertyDefinerCallback)(
* *
* See also `ObjectTemplate::SetHandler`. * See also `ObjectTemplate::SetHandler`.
*/ */
typedef void (*GenericNamedPropertyDescriptorCallback)( using GenericNamedPropertyDescriptorCallback =
Local<Name> property, const PropertyCallbackInfo<Value>& info); void (*)(Local<Name> property, const PropertyCallbackInfo<Value>& info);
/** /**
* See `v8::GenericNamedPropertyGetterCallback`. * See `v8::GenericNamedPropertyGetterCallback`.
*/ */
typedef void (*IndexedPropertyGetterCallback)( using IndexedPropertyGetterCallback =
uint32_t index, void (*)(uint32_t index, const PropertyCallbackInfo<Value>& info);
const PropertyCallbackInfo<Value>& info);
/** /**
* See `v8::GenericNamedPropertySetterCallback`. * See `v8::GenericNamedPropertySetterCallback`.
*/ */
typedef void (*IndexedPropertySetterCallback)( using IndexedPropertySetterCallback =
uint32_t index, void (*)(uint32_t index, Local<Value> value,
Local<Value> value, const PropertyCallbackInfo<Value>& info);
const PropertyCallbackInfo<Value>& info);
/** /**
* See `v8::GenericNamedPropertyQueryCallback`. * See `v8::GenericNamedPropertyQueryCallback`.
*/ */
typedef void (*IndexedPropertyQueryCallback)( using IndexedPropertyQueryCallback =
uint32_t index, void (*)(uint32_t index, const PropertyCallbackInfo<Integer>& info);
const PropertyCallbackInfo<Integer>& info);
/** /**
* See `v8::GenericNamedPropertyDeleterCallback`. * See `v8::GenericNamedPropertyDeleterCallback`.
*/ */
typedef void (*IndexedPropertyDeleterCallback)( using IndexedPropertyDeleterCallback =
uint32_t index, void (*)(uint32_t index, const PropertyCallbackInfo<Boolean>& info);
const PropertyCallbackInfo<Boolean>& info);
/** /**
* Returns an array containing the indices of the properties the indexed * Returns an array containing the indices of the properties the indexed
...@@ -6510,21 +6498,21 @@ typedef void (*IndexedPropertyDeleterCallback)( ...@@ -6510,21 +6498,21 @@ typedef void (*IndexedPropertyDeleterCallback)(
* *
* Note: The values in the array must be uint32_t. * Note: The values in the array must be uint32_t.
*/ */
typedef void (*IndexedPropertyEnumeratorCallback)( using IndexedPropertyEnumeratorCallback =
const PropertyCallbackInfo<Array>& info); void (*)(const PropertyCallbackInfo<Array>& info);
/** /**
* See `v8::GenericNamedPropertyDefinerCallback`. * See `v8::GenericNamedPropertyDefinerCallback`.
*/ */
typedef void (*IndexedPropertyDefinerCallback)( using IndexedPropertyDefinerCallback =
uint32_t index, const PropertyDescriptor& desc, void (*)(uint32_t index, const PropertyDescriptor& desc,
const PropertyCallbackInfo<Value>& info); const PropertyCallbackInfo<Value>& info);
/** /**
* See `v8::GenericNamedPropertyDescriptorCallback`. * See `v8::GenericNamedPropertyDescriptorCallback`.
*/ */
typedef void (*IndexedPropertyDescriptorCallback)( using IndexedPropertyDescriptorCallback =
uint32_t index, const PropertyCallbackInfo<Value>& info); void (*)(uint32_t index, const PropertyCallbackInfo<Value>& info);
/** /**
* Access type specification. * Access type specification.
...@@ -6542,9 +6530,9 @@ enum AccessType { ...@@ -6542,9 +6530,9 @@ enum AccessType {
* Returns true if the given context should be allowed to access the given * Returns true if the given context should be allowed to access the given
* object. * object.
*/ */
typedef bool (*AccessCheckCallback)(Local<Context> accessing_context, using AccessCheckCallback = bool (*)(Local<Context> accessing_context,
Local<Object> accessed_object, Local<Object> accessed_object,
Local<Value> data); Local<Value> data);
/** /**
* A FunctionTemplate is used to create functions at runtime. There * A FunctionTemplate is used to create functions at runtime. There
...@@ -7348,19 +7336,18 @@ class V8_EXPORT ResourceConstraints { ...@@ -7348,19 +7336,18 @@ class V8_EXPORT ResourceConstraints {
// --- Exceptions --- // --- Exceptions ---
using FatalErrorCallback = void (*)(const char* location, const char* message);
typedef void (*FatalErrorCallback)(const char* location, const char* message); using OOMErrorCallback = void (*)(const char* location, bool is_heap_oom);
typedef void (*OOMErrorCallback)(const char* location, bool is_heap_oom); using DcheckErrorCallback = void (*)(const char* file, int line,
const char* message);
typedef void (*DcheckErrorCallback)(const char* file, int line, using MessageCallback = void (*)(Local<Message> message, Local<Value> data);
const char* message);
typedef void (*MessageCallback)(Local<Message> message, Local<Value> data);
// --- Tracing --- // --- Tracing ---
typedef void (*LogEventCallback)(const char* name, int event); using LogEventCallback = void (*)(const char* name, int event);
/** /**
* Create new error objects by calling the corresponding error object * Create new error objects by calling the corresponding error object
...@@ -7394,14 +7381,12 @@ class V8_EXPORT Exception { ...@@ -7394,14 +7381,12 @@ class V8_EXPORT Exception {
// --- Counters Callbacks --- // --- Counters Callbacks ---
typedef int* (*CounterLookupCallback)(const char* name); using CounterLookupCallback = int* (*)(const char* name);
typedef void* (*CreateHistogramCallback)(const char* name, using CreateHistogramCallback = void* (*)(const char* name, int min, int max,
int min, size_t buckets);
int max,
size_t buckets);
typedef void (*AddHistogramSampleCallback)(void* histogram, int sample); using AddHistogramSampleCallback = void (*)(void* histogram, int sample);
// --- Crashkeys Callback --- // --- Crashkeys Callback ---
enum class CrashKeyId { enum class CrashKeyId {
...@@ -7412,11 +7397,11 @@ enum class CrashKeyId { ...@@ -7412,11 +7397,11 @@ enum class CrashKeyId {
kDumpType, kDumpType,
}; };
typedef void (*AddCrashKeyCallback)(CrashKeyId id, const std::string& value); using AddCrashKeyCallback = void (*)(CrashKeyId id, const std::string& value);
// --- Enter/Leave Script Callback --- // --- Enter/Leave Script Callback ---
typedef void (*BeforeCallEnteredCallback)(Isolate*); using BeforeCallEnteredCallback = void (*)(Isolate*);
typedef void (*CallCompletedCallback)(Isolate*); using CallCompletedCallback = void (*)(Isolate*);
/** /**
* HostImportModuleDynamicallyCallback is called when we require the * HostImportModuleDynamicallyCallback is called when we require the
...@@ -7438,7 +7423,7 @@ typedef void (*CallCompletedCallback)(Isolate*); ...@@ -7438,7 +7423,7 @@ typedef void (*CallCompletedCallback)(Isolate*);
* fails (e.g. due to stack overflow), the embedder must propagate * fails (e.g. due to stack overflow), the embedder must propagate
* that exception by returning an empty MaybeLocal. * that exception by returning an empty MaybeLocal.
*/ */
typedef MaybeLocal<Promise> (*HostImportModuleDynamicallyCallback)( using HostImportModuleDynamicallyCallback = MaybeLocal<Promise> (*)(
Local<Context> context, Local<ScriptOrModule> referrer, Local<Context> context, Local<ScriptOrModule> referrer,
Local<String> specifier); Local<String> specifier);
...@@ -7452,9 +7437,9 @@ typedef MaybeLocal<Promise> (*HostImportModuleDynamicallyCallback)( ...@@ -7452,9 +7437,9 @@ typedef MaybeLocal<Promise> (*HostImportModuleDynamicallyCallback)(
* The embedder should use v8::Object::CreateDataProperty to add properties on * The embedder should use v8::Object::CreateDataProperty to add properties on
* the meta object. * the meta object.
*/ */
typedef void (*HostInitializeImportMetaObjectCallback)(Local<Context> context, using HostInitializeImportMetaObjectCallback = void (*)(Local<Context> context,
Local<Module> module, Local<Module> module,
Local<Object> meta); Local<Object> meta);
/** /**
* PrepareStackTraceCallback is called when the stack property of an error is * PrepareStackTraceCallback is called when the stack property of an error is
...@@ -7463,9 +7448,9 @@ typedef void (*HostInitializeImportMetaObjectCallback)(Local<Context> context, ...@@ -7463,9 +7448,9 @@ typedef void (*HostInitializeImportMetaObjectCallback)(Local<Context> context,
* |sites| is an array of call sites, specified in * |sites| is an array of call sites, specified in
* https://v8.dev/docs/stack-trace-api * https://v8.dev/docs/stack-trace-api
*/ */
typedef MaybeLocal<Value> (*PrepareStackTraceCallback)(Local<Context> context, using PrepareStackTraceCallback = MaybeLocal<Value> (*)(Local<Context> context,
Local<Value> error, Local<Value> error,
Local<Array> sites); Local<Array> sites);
/** /**
* PromiseHook with type kInit is called when a new promise is * PromiseHook with type kInit is called when a new promise is
...@@ -7485,8 +7470,8 @@ typedef MaybeLocal<Value> (*PrepareStackTraceCallback)(Local<Context> context, ...@@ -7485,8 +7470,8 @@ typedef MaybeLocal<Value> (*PrepareStackTraceCallback)(Local<Context> context,
*/ */
enum class PromiseHookType { kInit, kResolve, kBefore, kAfter }; enum class PromiseHookType { kInit, kResolve, kBefore, kAfter };
typedef void (*PromiseHook)(PromiseHookType type, Local<Promise> promise, using PromiseHook = void (*)(PromiseHookType type, Local<Promise> promise,
Local<Value> parent); Local<Value> parent);
// --- Promise Reject Callback --- // --- Promise Reject Callback ---
enum PromiseRejectEvent { enum PromiseRejectEvent {
...@@ -7512,11 +7497,11 @@ class PromiseRejectMessage { ...@@ -7512,11 +7497,11 @@ class PromiseRejectMessage {
Local<Value> value_; Local<Value> value_;
}; };
typedef void (*PromiseRejectCallback)(PromiseRejectMessage message); using PromiseRejectCallback = void (*)(PromiseRejectMessage message);
// --- Microtasks Callbacks --- // --- Microtasks Callbacks ---
typedef void (*MicrotasksCompletedCallbackWithData)(Isolate*, void*); using MicrotasksCompletedCallbackWithData = void (*)(Isolate*, void*);
typedef void (*MicrotaskCallback)(void* data); using MicrotaskCallback = void (*)(void* data);
/** /**
* Policy for running microtasks: * Policy for running microtasks:
...@@ -7654,9 +7639,8 @@ class V8_EXPORT V8_NODISCARD MicrotasksScope { ...@@ -7654,9 +7639,8 @@ class V8_EXPORT V8_NODISCARD MicrotasksScope {
}; };
// --- Failed Access Check Callback --- // --- Failed Access Check Callback ---
typedef void (*FailedAccessCheckCallback)(Local<Object> target, using FailedAccessCheckCallback = void (*)(Local<Object> target,
AccessType type, AccessType type, Local<Value> data);
Local<Value> data);
// --- AllowCodeGenerationFromStrings callbacks --- // --- AllowCodeGenerationFromStrings callbacks ---
...@@ -7664,8 +7648,8 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target, ...@@ -7664,8 +7648,8 @@ typedef void (*FailedAccessCheckCallback)(Local<Object> target,
* Callback to check if code generation from strings is allowed. See * Callback to check if code generation from strings is allowed. See
* Context::AllowCodeGenerationFromStrings. * Context::AllowCodeGenerationFromStrings.
*/ */
typedef bool (*AllowCodeGenerationFromStringsCallback)(Local<Context> context, using AllowCodeGenerationFromStringsCallback = bool (*)(Local<Context> context,
Local<String> source); Local<String> source);
struct ModifyCodeGenerationFromStringsResult { struct ModifyCodeGenerationFromStringsResult {
// If true, proceed with the codegen algorithm. Otherwise, block it. // If true, proceed with the codegen algorithm. Otherwise, block it.
...@@ -7680,36 +7664,36 @@ struct ModifyCodeGenerationFromStringsResult { ...@@ -7680,36 +7664,36 @@ struct ModifyCodeGenerationFromStringsResult {
* Callback to check if codegen is allowed from a source object, and convert * Callback to check if codegen is allowed from a source object, and convert
* the source to string if necessary. See: ModifyCodeGenerationFromStrings. * the source to string if necessary. See: ModifyCodeGenerationFromStrings.
*/ */
typedef ModifyCodeGenerationFromStringsResult ( using ModifyCodeGenerationFromStringsCallback =
*ModifyCodeGenerationFromStringsCallback)(Local<Context> context, ModifyCodeGenerationFromStringsResult (*)(Local<Context> context,
Local<Value> source); Local<Value> source);
typedef ModifyCodeGenerationFromStringsResult ( using ModifyCodeGenerationFromStringsCallback2 =
*ModifyCodeGenerationFromStringsCallback2)(Local<Context> context, ModifyCodeGenerationFromStringsResult (*)(Local<Context> context,
Local<Value> source, Local<Value> source,
bool is_code_like); bool is_code_like);
// --- WebAssembly compilation callbacks --- // --- WebAssembly compilation callbacks ---
typedef bool (*ExtensionCallback)(const FunctionCallbackInfo<Value>&); using ExtensionCallback = bool (*)(const FunctionCallbackInfo<Value>&);
typedef bool (*AllowWasmCodeGenerationCallback)(Local<Context> context, using AllowWasmCodeGenerationCallback = bool (*)(Local<Context> context,
Local<String> source); Local<String> source);
// --- Callback for APIs defined on v8-supported objects, but implemented // --- Callback for APIs defined on v8-supported objects, but implemented
// by the embedder. Example: WebAssembly.{compile|instantiate}Streaming --- // by the embedder. Example: WebAssembly.{compile|instantiate}Streaming ---
typedef void (*ApiImplementationCallback)(const FunctionCallbackInfo<Value>&); using ApiImplementationCallback = void (*)(const FunctionCallbackInfo<Value>&);
// --- Callback for WebAssembly.compileStreaming --- // --- Callback for WebAssembly.compileStreaming ---
typedef void (*WasmStreamingCallback)(const FunctionCallbackInfo<Value>&); using WasmStreamingCallback = void (*)(const FunctionCallbackInfo<Value>&);
// --- Callback for checking if WebAssembly threads are enabled --- // --- Callback for checking if WebAssembly threads are enabled ---
typedef bool (*WasmThreadsEnabledCallback)(Local<Context> context); using WasmThreadsEnabledCallback = bool (*)(Local<Context> context);
// --- Callback for loading source map file for Wasm profiling support // --- Callback for loading source map file for Wasm profiling support
typedef Local<String> (*WasmLoadSourceMapCallback)(Isolate* isolate, using WasmLoadSourceMapCallback = Local<String> (*)(Isolate* isolate,
const char* name); const char* name);
// --- Callback for checking if WebAssembly Simd is enabled --- // --- Callback for checking if WebAssembly Simd is enabled ---
typedef bool (*WasmSimdEnabledCallback)(Local<Context> context); using WasmSimdEnabledCallback = bool (*)(Local<Context> context);
// --- Garbage Collection Callbacks --- // --- Garbage Collection Callbacks ---
...@@ -7753,9 +7737,9 @@ enum GCCallbackFlags { ...@@ -7753,9 +7737,9 @@ enum GCCallbackFlags {
kGCCallbackScheduleIdleGarbageCollection = 1 << 6, kGCCallbackScheduleIdleGarbageCollection = 1 << 6,
}; };
typedef void (*GCCallback)(GCType type, GCCallbackFlags flags); using GCCallback = void (*)(GCType type, GCCallbackFlags flags);
typedef void (*InterruptCallback)(Isolate* isolate, void* data); using InterruptCallback = void (*)(Isolate* isolate, void* data);
/** /**
* This callback is invoked when the heap size is close to the heap limit and * This callback is invoked when the heap size is close to the heap limit and
...@@ -7764,8 +7748,8 @@ typedef void (*InterruptCallback)(Isolate* isolate, void* data); ...@@ -7764,8 +7748,8 @@ typedef void (*InterruptCallback)(Isolate* isolate, void* data);
* than the current_heap_limit. The initial heap limit is the limit that was * than the current_heap_limit. The initial heap limit is the limit that was
* set after heap setup. * set after heap setup.
*/ */
typedef size_t (*NearHeapLimitCallback)(void* data, size_t current_heap_limit, using NearHeapLimitCallback = size_t (*)(void* data, size_t current_heap_limit,
size_t initial_heap_limit); size_t initial_heap_limit);
/** /**
* Collection of shared per-process V8 memory information. * Collection of shared per-process V8 memory information.
...@@ -8019,14 +8003,14 @@ enum JitCodeEventOptions { ...@@ -8019,14 +8003,14 @@ enum JitCodeEventOptions {
* *
* \param event code add, move or removal event. * \param event code add, move or removal event.
*/ */
typedef void (*JitCodeEventHandler)(const JitCodeEvent* event); using JitCodeEventHandler = void (*)(const JitCodeEvent* event);
/** /**
* Callback function passed to SetUnhandledExceptionCallback. * Callback function passed to SetUnhandledExceptionCallback.
*/ */
#if defined(V8_OS_WIN) #if defined(V8_OS_WIN)
typedef int (*UnhandledExceptionCallback)( using UnhandledExceptionCallback =
_EXCEPTION_POINTERS* exception_pointers); int (*)(_EXCEPTION_POINTERS* exception_pointers);
#endif #endif
/** /**
...@@ -8253,8 +8237,8 @@ class V8_EXPORT EmbedderHeapTracer { ...@@ -8253,8 +8237,8 @@ class V8_EXPORT EmbedderHeapTracer {
* serialized verbatim. * serialized verbatim.
*/ */
struct SerializeInternalFieldsCallback { struct SerializeInternalFieldsCallback {
typedef StartupData (*CallbackFunction)(Local<Object> holder, int index, using CallbackFunction = StartupData (*)(Local<Object> holder, int index,
void* data); void* data);
SerializeInternalFieldsCallback(CallbackFunction function = nullptr, SerializeInternalFieldsCallback(CallbackFunction function = nullptr,
void* data_arg = nullptr) void* data_arg = nullptr)
: callback(function), data(data_arg) {} : callback(function), data(data_arg) {}
...@@ -8263,15 +8247,15 @@ struct SerializeInternalFieldsCallback { ...@@ -8263,15 +8247,15 @@ struct SerializeInternalFieldsCallback {
}; };
// Note that these fields are called "internal fields" in the API and called // Note that these fields are called "internal fields" in the API and called
// "embedder fields" within V8. // "embedder fields" within V8.
typedef SerializeInternalFieldsCallback SerializeEmbedderFieldsCallback; using SerializeEmbedderFieldsCallback = SerializeInternalFieldsCallback;
/** /**
* Callback and supporting data used to implement embedder logic to deserialize * Callback and supporting data used to implement embedder logic to deserialize
* internal fields. * internal fields.
*/ */
struct DeserializeInternalFieldsCallback { struct DeserializeInternalFieldsCallback {
typedef void (*CallbackFunction)(Local<Object> holder, int index, using CallbackFunction = void (*)(Local<Object> holder, int index,
StartupData payload, void* data); StartupData payload, void* data);
DeserializeInternalFieldsCallback(CallbackFunction function = nullptr, DeserializeInternalFieldsCallback(CallbackFunction function = nullptr,
void* data_arg = nullptr) void* data_arg = nullptr)
: callback(function), data(data_arg) {} : callback(function), data(data_arg) {}
...@@ -8279,7 +8263,7 @@ struct DeserializeInternalFieldsCallback { ...@@ -8279,7 +8263,7 @@ struct DeserializeInternalFieldsCallback {
void* data); void* data);
void* data; void* data;
}; };
typedef DeserializeInternalFieldsCallback DeserializeEmbedderFieldsCallback; using DeserializeEmbedderFieldsCallback = DeserializeInternalFieldsCallback;
/** /**
* Controls how the default MeasureMemoryDelegate reports the result of * Controls how the default MeasureMemoryDelegate reports the result of
...@@ -8686,8 +8670,8 @@ class V8_EXPORT Isolate { ...@@ -8686,8 +8670,8 @@ class V8_EXPORT Isolate {
kMessageWarning, kMessageWarning,
}; };
typedef void (*UseCounterCallback)(Isolate* isolate, using UseCounterCallback = void (*)(Isolate* isolate,
UseCounterFeature feature); UseCounterFeature feature);
/** /**
* Allocates a new isolate but does not initialize it. Does not change the * Allocates a new isolate but does not initialize it. Does not change the
...@@ -8753,7 +8737,7 @@ class V8_EXPORT Isolate { ...@@ -8753,7 +8737,7 @@ class V8_EXPORT Isolate {
* - the custom callback set returns true. * - the custom callback set returns true.
* Otherwise, the custom callback will not be called and V8 will not abort. * Otherwise, the custom callback will not be called and V8 will not abort.
*/ */
typedef bool (*AbortOnUncaughtExceptionCallback)(Isolate*); using AbortOnUncaughtExceptionCallback = bool (*)(Isolate*);
void SetAbortOnUncaughtExceptionCallback( void SetAbortOnUncaughtExceptionCallback(
AbortOnUncaughtExceptionCallback callback); AbortOnUncaughtExceptionCallback callback);
...@@ -9002,10 +8986,10 @@ class V8_EXPORT Isolate { ...@@ -9002,10 +8986,10 @@ class V8_EXPORT Isolate {
*/ */
Local<Value> ThrowException(Local<Value> exception); Local<Value> ThrowException(Local<Value> exception);
typedef void (*GCCallback)(Isolate* isolate, GCType type, using GCCallback = void (*)(Isolate* isolate, GCType type,
GCCallbackFlags flags); GCCallbackFlags flags);
typedef void (*GCCallbackWithData)(Isolate* isolate, GCType type, using GCCallbackWithData = void (*)(Isolate* isolate, GCType type,
GCCallbackFlags flags, void* data); GCCallbackFlags flags, void* data);
/** /**
* Enables the host application to receive a notification before a * Enables the host application to receive a notification before a
...@@ -9108,12 +9092,12 @@ class V8_EXPORT Isolate { ...@@ -9108,12 +9092,12 @@ class V8_EXPORT Isolate {
* This callback may schedule exceptions, *unless* |event| is equal to * This callback may schedule exceptions, *unless* |event| is equal to
* |kTerminatedExecution|. * |kTerminatedExecution|.
*/ */
typedef void (*AtomicsWaitCallback)(AtomicsWaitEvent event, using AtomicsWaitCallback = void (*)(AtomicsWaitEvent event,
Local<SharedArrayBuffer> array_buffer, Local<SharedArrayBuffer> array_buffer,
size_t offset_in_bytes, int64_t value, size_t offset_in_bytes, int64_t value,
double timeout_in_ms, double timeout_in_ms,
AtomicsWaitWakeHandle* stop_handle, AtomicsWaitWakeHandle* stop_handle,
void* data); void* data);
/** /**
* Set a new |AtomicsWaitCallback|. This overrides an earlier * Set a new |AtomicsWaitCallback|. This overrides an earlier
...@@ -9145,7 +9129,7 @@ class V8_EXPORT Isolate { ...@@ -9145,7 +9129,7 @@ class V8_EXPORT Isolate {
void* data = nullptr); void* data = nullptr);
void RemoveGCEpilogueCallback(GCCallback callback); void RemoveGCEpilogueCallback(GCCallback callback);
typedef size_t (*GetExternallyAllocatedMemoryInBytesCallback)(); using GetExternallyAllocatedMemoryInBytesCallback = size_t (*)();
/** /**
* Set the callback that tells V8 how much memory is currently allocated * Set the callback that tells V8 how much memory is currently allocated
...@@ -9746,7 +9730,7 @@ class V8_EXPORT StartupData { ...@@ -9746,7 +9730,7 @@ class V8_EXPORT StartupData {
* EntropySource is used as a callback function when v8 needs a source * EntropySource is used as a callback function when v8 needs a source
* of entropy. * of entropy.
*/ */
typedef bool (*EntropySource)(unsigned char* buffer, size_t length); using EntropySource = bool (*)(unsigned char* buffer, size_t length);
/** /**
* ReturnAddressLocationResolver is used as a callback function when v8 is * ReturnAddressLocationResolver is used as a callback function when v8 is
...@@ -9761,9 +9745,8 @@ typedef bool (*EntropySource)(unsigned char* buffer, size_t length); ...@@ -9761,9 +9745,8 @@ typedef bool (*EntropySource)(unsigned char* buffer, size_t length);
* *
* \note The resolver function must not cause garbage collection. * \note The resolver function must not cause garbage collection.
*/ */
typedef uintptr_t (*ReturnAddressLocationResolver)( using ReturnAddressLocationResolver =
uintptr_t return_addr_location); uintptr_t (*)(uintptr_t return_addr_location);
/** /**
* Container class for static utility functions. * Container class for static utility functions.
...@@ -10648,8 +10631,8 @@ class V8_EXPORT Context { ...@@ -10648,8 +10631,8 @@ class V8_EXPORT Context {
* context, call the specified callback, and throw an exception. * context, call the specified callback, and throw an exception.
* To unset abort, pass nullptr as callback. * To unset abort, pass nullptr as callback.
*/ */
typedef void (*AbortScriptExecutionCallback)(Isolate* isolate, using AbortScriptExecutionCallback = void (*)(Isolate* isolate,
Local<Context> context); Local<Context> context);
void SetAbortScriptExecution(AbortScriptExecutionCallback callback); void SetAbortScriptExecution(AbortScriptExecutionCallback callback);
/** /**
...@@ -10985,7 +10968,7 @@ void Persistent<T, M>::Copy(const Persistent<S, M2>& that) { ...@@ -10985,7 +10968,7 @@ void Persistent<T, M>::Copy(const Persistent<S, M2>& that) {
template <class T> template <class T>
bool PersistentBase<T>::IsWeak() const { bool PersistentBase<T>::IsWeak() const {
typedef internal::Internals I; using I = internal::Internals;
if (this->IsEmpty()) return false; if (this->IsEmpty()) return false;
return I::GetNodeState(reinterpret_cast<internal::Address*>(this->val_)) == return I::GetNodeState(reinterpret_cast<internal::Address*>(this->val_)) ==
I::kNodeStateIsWeakValue; I::kNodeStateIsWeakValue;
...@@ -11026,7 +11009,7 @@ template <typename P> ...@@ -11026,7 +11009,7 @@ template <typename P>
V8_INLINE void PersistentBase<T>::SetWeak( V8_INLINE void PersistentBase<T>::SetWeak(
P* parameter, typename WeakCallbackInfo<P>::Callback callback, P* parameter, typename WeakCallbackInfo<P>::Callback callback,
WeakCallbackType type) { WeakCallbackType type) {
typedef typename WeakCallbackInfo<void>::Callback Callback; using Callback = WeakCallbackInfo<void>::Callback;
#if (__GNUC__ >= 8) && !defined(__clang__) #if (__GNUC__ >= 8) && !defined(__clang__)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-function-type" #pragma GCC diagnostic ignored "-Wcast-function-type"
...@@ -11058,7 +11041,7 @@ void PersistentBase<T>::AnnotateStrongRetainer(const char* label) { ...@@ -11058,7 +11041,7 @@ void PersistentBase<T>::AnnotateStrongRetainer(const char* label) {
template <class T> template <class T>
void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) { void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) {
typedef internal::Internals I; using I = internal::Internals;
if (this->IsEmpty()) return; if (this->IsEmpty()) return;
internal::Address* obj = reinterpret_cast<internal::Address*>(this->val_); internal::Address* obj = reinterpret_cast<internal::Address*>(this->val_);
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset; uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
...@@ -11068,7 +11051,7 @@ void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) { ...@@ -11068,7 +11051,7 @@ void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) {
template <class T> template <class T>
uint16_t PersistentBase<T>::WrapperClassId() const { uint16_t PersistentBase<T>::WrapperClassId() const {
typedef internal::Internals I; using I = internal::Internals;
if (this->IsEmpty()) return 0; if (this->IsEmpty()) return 0;
internal::Address* obj = reinterpret_cast<internal::Address*>(this->val_); internal::Address* obj = reinterpret_cast<internal::Address*>(this->val_);
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset; uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
...@@ -11266,7 +11249,7 @@ TracedReference<T>& TracedReference<T>::operator=(const TracedReference& rhs) { ...@@ -11266,7 +11249,7 @@ TracedReference<T>& TracedReference<T>::operator=(const TracedReference& rhs) {
} }
void TracedReferenceBase::SetWrapperClassId(uint16_t class_id) { void TracedReferenceBase::SetWrapperClassId(uint16_t class_id) {
typedef internal::Internals I; using I = internal::Internals;
if (IsEmpty()) return; if (IsEmpty()) return;
internal::Address* obj = reinterpret_cast<internal::Address*>(val_); internal::Address* obj = reinterpret_cast<internal::Address*>(val_);
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset; uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
...@@ -11274,7 +11257,7 @@ void TracedReferenceBase::SetWrapperClassId(uint16_t class_id) { ...@@ -11274,7 +11257,7 @@ void TracedReferenceBase::SetWrapperClassId(uint16_t class_id) {
} }
uint16_t TracedReferenceBase::WrapperClassId() const { uint16_t TracedReferenceBase::WrapperClassId() const {
typedef internal::Internals I; using I = internal::Internals;
if (IsEmpty()) return 0; if (IsEmpty()) return 0;
internal::Address* obj = reinterpret_cast<internal::Address*>(val_); internal::Address* obj = reinterpret_cast<internal::Address*>(val_);
uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset; uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
...@@ -11334,7 +11317,7 @@ void ReturnValue<T>::Set(double i) { ...@@ -11334,7 +11317,7 @@ void ReturnValue<T>::Set(double i) {
template<typename T> template<typename T>
void ReturnValue<T>::Set(int32_t i) { void ReturnValue<T>::Set(int32_t i) {
static_assert(std::is_base_of<T, Integer>::value, "type check"); static_assert(std::is_base_of<T, Integer>::value, "type check");
typedef internal::Internals I; using I = internal::Internals;
if (V8_LIKELY(I::IsValidSmi(i))) { if (V8_LIKELY(I::IsValidSmi(i))) {
*value_ = I::IntToSmi(i); *value_ = I::IntToSmi(i);
return; return;
...@@ -11357,7 +11340,7 @@ void ReturnValue<T>::Set(uint32_t i) { ...@@ -11357,7 +11340,7 @@ void ReturnValue<T>::Set(uint32_t i) {
template<typename T> template<typename T>
void ReturnValue<T>::Set(bool value) { void ReturnValue<T>::Set(bool value) {
static_assert(std::is_base_of<T, Boolean>::value, "type check"); static_assert(std::is_base_of<T, Boolean>::value, "type check");
typedef internal::Internals I; using I = internal::Internals;
int root_index; int root_index;
if (value) { if (value) {
root_index = I::kTrueValueRootIndex; root_index = I::kTrueValueRootIndex;
...@@ -11370,21 +11353,21 @@ void ReturnValue<T>::Set(bool value) { ...@@ -11370,21 +11353,21 @@ void ReturnValue<T>::Set(bool value) {
template<typename T> template<typename T>
void ReturnValue<T>::SetNull() { void ReturnValue<T>::SetNull() {
static_assert(std::is_base_of<T, Primitive>::value, "type check"); static_assert(std::is_base_of<T, Primitive>::value, "type check");
typedef internal::Internals I; using I = internal::Internals;
*value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex); *value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex);
} }
template<typename T> template<typename T>
void ReturnValue<T>::SetUndefined() { void ReturnValue<T>::SetUndefined() {
static_assert(std::is_base_of<T, Primitive>::value, "type check"); static_assert(std::is_base_of<T, Primitive>::value, "type check");
typedef internal::Internals I; using I = internal::Internals;
*value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex); *value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex);
} }
template<typename T> template<typename T>
void ReturnValue<T>::SetEmptyString() { void ReturnValue<T>::SetEmptyString() {
static_assert(std::is_base_of<T, String>::value, "type check"); static_assert(std::is_base_of<T, String>::value, "type check");
typedef internal::Internals I; using I = internal::Internals;
*value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex); *value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex);
} }
...@@ -11396,7 +11379,7 @@ Isolate* ReturnValue<T>::GetIsolate() const { ...@@ -11396,7 +11379,7 @@ Isolate* ReturnValue<T>::GetIsolate() const {
template <typename T> template <typename T>
Local<Value> ReturnValue<T>::Get() const { Local<Value> ReturnValue<T>::Get() const {
typedef internal::Internals I; using I = internal::Internals;
if (*value_ == *I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex)) if (*value_ == *I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex))
return Local<Value>(*Undefined(GetIsolate())); return Local<Value>(*Undefined(GetIsolate()));
return Local<Value>::New(GetIsolate(), reinterpret_cast<Value*>(value_)); return Local<Value>::New(GetIsolate(), reinterpret_cast<Value*>(value_));
...@@ -11603,8 +11586,8 @@ AccessorSignature* AccessorSignature::Cast(Data* data) { ...@@ -11603,8 +11586,8 @@ AccessorSignature* AccessorSignature::Cast(Data* data) {
Local<Value> Object::GetInternalField(int index) { Local<Value> Object::GetInternalField(int index) {
#ifndef V8_ENABLE_CHECKS #ifndef V8_ENABLE_CHECKS
typedef internal::Address A; using A = internal::Address;
typedef internal::Internals I; using I = internal::Internals;
A obj = *reinterpret_cast<A*>(this); A obj = *reinterpret_cast<A*>(this);
// Fast path: If the object is a plain JSObject, which is the common case, we // Fast path: If the object is a plain JSObject, which is the common case, we
// know where to find the internal fields and can return the value directly. // know where to find the internal fields and can return the value directly.
...@@ -11631,8 +11614,8 @@ Local<Value> Object::GetInternalField(int index) { ...@@ -11631,8 +11614,8 @@ Local<Value> Object::GetInternalField(int index) {
void* Object::GetAlignedPointerFromInternalField(int index) { void* Object::GetAlignedPointerFromInternalField(int index) {
#ifndef V8_ENABLE_CHECKS #ifndef V8_ENABLE_CHECKS
typedef internal::Address A; using A = internal::Address;
typedef internal::Internals I; using I = internal::Internals;
A obj = *reinterpret_cast<A*>(this); A obj = *reinterpret_cast<A*>(this);
// Fast path: If the object is a plain JSObject, which is the common case, we // Fast path: If the object is a plain JSObject, which is the common case, we
// know where to find the internal fields and can return the value directly. // know where to find the internal fields and can return the value directly.
...@@ -11661,8 +11644,8 @@ String* String::Cast(v8::Data* data) { ...@@ -11661,8 +11644,8 @@ String* String::Cast(v8::Data* data) {
} }
Local<String> String::Empty(Isolate* isolate) { Local<String> String::Empty(Isolate* isolate) {
typedef internal::Address S; using S = internal::Address;
typedef internal::Internals I; using I = internal::Internals;
I::CheckInitialized(isolate); I::CheckInitialized(isolate);
S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex); S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex);
return Local<String>(reinterpret_cast<String*>(slot)); return Local<String>(reinterpret_cast<String*>(slot));
...@@ -11670,8 +11653,8 @@ Local<String> String::Empty(Isolate* isolate) { ...@@ -11670,8 +11653,8 @@ Local<String> String::Empty(Isolate* isolate) {
String::ExternalStringResource* String::GetExternalStringResource() const { String::ExternalStringResource* String::GetExternalStringResource() const {
typedef internal::Address A; using A = internal::Address;
typedef internal::Internals I; using I = internal::Internals;
A obj = *reinterpret_cast<const A*>(this); A obj = *reinterpret_cast<const A*>(this);
ExternalStringResource* result; ExternalStringResource* result;
...@@ -11693,8 +11676,8 @@ String::ExternalStringResource* String::GetExternalStringResource() const { ...@@ -11693,8 +11676,8 @@ String::ExternalStringResource* String::GetExternalStringResource() const {
String::ExternalStringResourceBase* String::GetExternalStringResourceBase( String::ExternalStringResourceBase* String::GetExternalStringResourceBase(
String::Encoding* encoding_out) const { String::Encoding* encoding_out) const {
typedef internal::Address A; using A = internal::Address;
typedef internal::Internals I; using I = internal::Internals;
A obj = *reinterpret_cast<const A*>(this); A obj = *reinterpret_cast<const A*>(this);
int type = I::GetInstanceType(obj) & I::kFullStringRepresentationMask; int type = I::GetInstanceType(obj) & I::kFullStringRepresentationMask;
*encoding_out = static_cast<Encoding>(type & I::kStringEncodingMask); *encoding_out = static_cast<Encoding>(type & I::kStringEncodingMask);
...@@ -11725,8 +11708,8 @@ bool Value::IsUndefined() const { ...@@ -11725,8 +11708,8 @@ bool Value::IsUndefined() const {
} }
bool Value::QuickIsUndefined() const { bool Value::QuickIsUndefined() const {
typedef internal::Address A; using A = internal::Address;
typedef internal::Internals I; using I = internal::Internals;
A obj = *reinterpret_cast<const A*>(this); A obj = *reinterpret_cast<const A*>(this);
if (!I::HasHeapObjectTag(obj)) return false; if (!I::HasHeapObjectTag(obj)) return false;
if (I::GetInstanceType(obj) != I::kOddballType) return false; if (I::GetInstanceType(obj) != I::kOddballType) return false;
...@@ -11743,8 +11726,8 @@ bool Value::IsNull() const { ...@@ -11743,8 +11726,8 @@ bool Value::IsNull() const {
} }
bool Value::QuickIsNull() const { bool Value::QuickIsNull() const {
typedef internal::Address A; using A = internal::Address;
typedef internal::Internals I; using I = internal::Internals;
A obj = *reinterpret_cast<const A*>(this); A obj = *reinterpret_cast<const A*>(this);
if (!I::HasHeapObjectTag(obj)) return false; if (!I::HasHeapObjectTag(obj)) return false;
if (I::GetInstanceType(obj) != I::kOddballType) return false; if (I::GetInstanceType(obj) != I::kOddballType) return false;
...@@ -11760,8 +11743,8 @@ bool Value::IsNullOrUndefined() const { ...@@ -11760,8 +11743,8 @@ bool Value::IsNullOrUndefined() const {
} }
bool Value::QuickIsNullOrUndefined() const { bool Value::QuickIsNullOrUndefined() const {
typedef internal::Address A; using A = internal::Address;
typedef internal::Internals I; using I = internal::Internals;
A obj = *reinterpret_cast<const A*>(this); A obj = *reinterpret_cast<const A*>(this);
if (!I::HasHeapObjectTag(obj)) return false; if (!I::HasHeapObjectTag(obj)) return false;
if (I::GetInstanceType(obj) != I::kOddballType) return false; if (I::GetInstanceType(obj) != I::kOddballType) return false;
...@@ -11778,8 +11761,8 @@ bool Value::IsString() const { ...@@ -11778,8 +11761,8 @@ bool Value::IsString() const {
} }
bool Value::QuickIsString() const { bool Value::QuickIsString() const {
typedef internal::Address A; using A = internal::Address;
typedef internal::Internals I; using I = internal::Internals;
A obj = *reinterpret_cast<const A*>(this); A obj = *reinterpret_cast<const A*>(this);
if (!I::HasHeapObjectTag(obj)) return false; if (!I::HasHeapObjectTag(obj)) return false;
return (I::GetInstanceType(obj) < I::kFirstNonstringType); return (I::GetInstanceType(obj) < I::kFirstNonstringType);
...@@ -12170,7 +12153,7 @@ ReturnValue<T> PropertyCallbackInfo<T>::GetReturnValue() const { ...@@ -12170,7 +12153,7 @@ ReturnValue<T> PropertyCallbackInfo<T>::GetReturnValue() const {
template <typename T> template <typename T>
bool PropertyCallbackInfo<T>::ShouldThrowOnError() const { bool PropertyCallbackInfo<T>::ShouldThrowOnError() const {
typedef internal::Internals I; using I = internal::Internals;
if (args_[kShouldThrowOnErrorIndex] != if (args_[kShouldThrowOnErrorIndex] !=
I::IntToSmi(I::kInferShouldThrowMode)) { I::IntToSmi(I::kInferShouldThrowMode)) {
return args_[kShouldThrowOnErrorIndex] != I::IntToSmi(I::kDontThrow); return args_[kShouldThrowOnErrorIndex] != I::IntToSmi(I::kDontThrow);
...@@ -12180,8 +12163,8 @@ bool PropertyCallbackInfo<T>::ShouldThrowOnError() const { ...@@ -12180,8 +12163,8 @@ bool PropertyCallbackInfo<T>::ShouldThrowOnError() const {
} }
Local<Primitive> Undefined(Isolate* isolate) { Local<Primitive> Undefined(Isolate* isolate) {
typedef internal::Address S; using S = internal::Address;
typedef internal::Internals I; using I = internal::Internals;
I::CheckInitialized(isolate); I::CheckInitialized(isolate);
S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex); S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex);
return Local<Primitive>(reinterpret_cast<Primitive*>(slot)); return Local<Primitive>(reinterpret_cast<Primitive*>(slot));
...@@ -12189,8 +12172,8 @@ Local<Primitive> Undefined(Isolate* isolate) { ...@@ -12189,8 +12172,8 @@ Local<Primitive> Undefined(Isolate* isolate) {
Local<Primitive> Null(Isolate* isolate) { Local<Primitive> Null(Isolate* isolate) {
typedef internal::Address S; using S = internal::Address;
typedef internal::Internals I; using I = internal::Internals;
I::CheckInitialized(isolate); I::CheckInitialized(isolate);
S* slot = I::GetRoot(isolate, I::kNullValueRootIndex); S* slot = I::GetRoot(isolate, I::kNullValueRootIndex);
return Local<Primitive>(reinterpret_cast<Primitive*>(slot)); return Local<Primitive>(reinterpret_cast<Primitive*>(slot));
...@@ -12198,8 +12181,8 @@ Local<Primitive> Null(Isolate* isolate) { ...@@ -12198,8 +12181,8 @@ Local<Primitive> Null(Isolate* isolate) {
Local<Boolean> True(Isolate* isolate) { Local<Boolean> True(Isolate* isolate) {
typedef internal::Address S; using S = internal::Address;
typedef internal::Internals I; using I = internal::Internals;
I::CheckInitialized(isolate); I::CheckInitialized(isolate);
S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex); S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex);
return Local<Boolean>(reinterpret_cast<Boolean*>(slot)); return Local<Boolean>(reinterpret_cast<Boolean*>(slot));
...@@ -12207,8 +12190,8 @@ Local<Boolean> True(Isolate* isolate) { ...@@ -12207,8 +12190,8 @@ Local<Boolean> True(Isolate* isolate) {
Local<Boolean> False(Isolate* isolate) { Local<Boolean> False(Isolate* isolate) {
typedef internal::Address S; using S = internal::Address;
typedef internal::Internals I; using I = internal::Internals;
I::CheckInitialized(isolate); I::CheckInitialized(isolate);
S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex); S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
return Local<Boolean>(reinterpret_cast<Boolean*>(slot)); return Local<Boolean>(reinterpret_cast<Boolean*>(slot));
...@@ -12216,19 +12199,19 @@ Local<Boolean> False(Isolate* isolate) { ...@@ -12216,19 +12199,19 @@ Local<Boolean> False(Isolate* isolate) {
void Isolate::SetData(uint32_t slot, void* data) { void Isolate::SetData(uint32_t slot, void* data) {
typedef internal::Internals I; using I = internal::Internals;
I::SetEmbedderData(this, slot, data); I::SetEmbedderData(this, slot, data);
} }
void* Isolate::GetData(uint32_t slot) { void* Isolate::GetData(uint32_t slot) {
typedef internal::Internals I; using I = internal::Internals;
return I::GetEmbedderData(this, slot); return I::GetEmbedderData(this, slot);
} }
uint32_t Isolate::GetNumberOfDataSlots() { uint32_t Isolate::GetNumberOfDataSlots() {
typedef internal::Internals I; using I = internal::Internals;
return I::kNumIsolateDataSlots; return I::kNumIsolateDataSlots;
} }
...@@ -12241,8 +12224,8 @@ MaybeLocal<T> Isolate::GetDataFromSnapshotOnce(size_t index) { ...@@ -12241,8 +12224,8 @@ MaybeLocal<T> Isolate::GetDataFromSnapshotOnce(size_t index) {
Local<Value> Context::GetEmbedderData(int index) { Local<Value> Context::GetEmbedderData(int index) {
#ifndef V8_ENABLE_CHECKS #ifndef V8_ENABLE_CHECKS
typedef internal::Address A; using A = internal::Address;
typedef internal::Internals I; using I = internal::Internals;
A ctx = *reinterpret_cast<const A*>(this); A ctx = *reinterpret_cast<const A*>(this);
A embedder_data = A embedder_data =
I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset); I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
...@@ -12267,8 +12250,8 @@ Local<Value> Context::GetEmbedderData(int index) { ...@@ -12267,8 +12250,8 @@ Local<Value> Context::GetEmbedderData(int index) {
void* Context::GetAlignedPointerFromEmbedderData(int index) { void* Context::GetAlignedPointerFromEmbedderData(int index) {
#ifndef V8_ENABLE_CHECKS #ifndef V8_ENABLE_CHECKS
typedef internal::Address A; using A = internal::Address;
typedef internal::Internals I; using I = internal::Internals;
A ctx = *reinterpret_cast<const A*>(this); A ctx = *reinterpret_cast<const A*>(this);
A embedder_data = A embedder_data =
I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset); I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment