From a335f2aeed23a3ba3f854368a164cd0c92f32e92 Mon Sep 17 00:00:00 2001 From: Clemens Hammacher Date: Mon, 27 May 2019 13:31:49 +0200 Subject: [PATCH] [cleanup] Replace simple typedefs by using This replaces all typedefs that define types and not functions by the equivalent "using" declaration. This was done mostly automatically using this command: ag -l '\btypedef\b' src test | xargs -L1 \ perl -i -p0e 's/typedef ([^*;{}]+) (\w+);/using \2 = \1;/sg' Patchset 2 then adds some manual changes for typedefs for pointer types, where the regular expression did not match. R=mstarzinger@chromium.org TBR=yangguo@chromium.org, jarin@chromium.org Bug: v8:9183 Change-Id: I6f6ee28d1793b7ac34a58f980b94babc21874b78 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1631409 Commit-Queue: Clemens Hammacher Reviewed-by: Michael Starzinger Cr-Commit-Position: refs/heads/master@{#61849} --- src/api/api-arguments.h | 8 +- src/api/api.cc | 4 +- src/arm/constants-arm.h | 6 +- src/arm/register-arm.h | 10 +- src/arm64/assembler-arm64.cc | 2 +- src/arm64/assembler-arm64.h | 2 +- src/arm64/constants-arm64.h | 2 +- src/arm64/instructions-arm64.h | 2 +- src/arm64/register-arm64.h | 6 +- src/arm64/simulator-arm64.cc | 8 +- src/arm64/simulator-arm64.h | 4 +- src/asmjs/asm-scanner.h | 2 +- src/asmjs/asm-types.h | 2 +- src/ast/ast.h | 8 +- src/ast/modules.h | 12 +-- src/ast/scopes.h | 4 +- src/ast/variables.h | 2 +- src/base/compiler-specific.h | 6 +- src/builtins/arm/builtins-arm.cc | 2 +- src/builtins/arm64/builtins-arm64.cc | 2 +- src/builtins/builtins-arguments-gen.cc | 2 +- src/builtins/builtins-arguments-gen.h | 6 +- src/builtins/builtins-array-gen.cc | 6 +- src/builtins/builtins-array-gen.h | 11 +-- src/builtins/builtins-async-generator-gen.cc | 4 +- src/builtins/builtins-async-iterator-gen.cc | 7 +- src/builtins/builtins-collections-gen.cc | 8 +- src/builtins/builtins-constructor-gen.cc | 2 +- src/builtins/builtins-date.cc | 2 +- src/builtins/builtins-descriptors.h | 8 +- src/builtins/builtins-handler-gen.cc | 16 ++-- src/builtins/builtins-iterator-gen.cc | 2 +- src/builtins/builtins-lazy-gen.h | 2 +- src/builtins/builtins-object-gen.cc | 2 +- src/builtins/builtins-promise-gen.cc | 2 +- src/builtins/builtins-promise-gen.h | 18 ++-- src/builtins/builtins-string-gen.cc | 6 +- src/builtins/builtins-string-gen.h | 9 +- src/builtins/builtins-typed-array-gen.h | 2 +- src/builtins/builtins-utils-gen.h | 2 +- src/builtins/constants-table-builder.h | 2 +- src/builtins/ia32/builtins-ia32.cc | 2 +- src/builtins/mips/builtins-mips.cc | 4 +- src/builtins/mips64/builtins-mips64.cc | 4 +- src/builtins/ppc/builtins-ppc.cc | 2 +- src/builtins/s390/builtins-s390.cc | 2 +- src/builtins/x64/builtins-x64.cc | 2 +- src/codegen/code-stub-assembler.cc | 2 +- src/codegen/code-stub-assembler.h | 35 ++++--- src/codegen/compiler.h | 4 +- src/codegen/external-reference.h | 2 - src/codegen/interface-descriptors.h | 8 +- src/codegen/optimized-compilation-info.h | 2 +- src/codegen/reglist.h | 4 +- src/codegen/signature.h | 2 +- src/codegen/source-position-table.cc | 2 +- src/codegen/source-position.h | 10 +- src/common/assert-scope.h | 96 +++++++++---------- src/common/globals.h | 12 +-- src/compiler-dispatcher/compiler-dispatcher.h | 6 +- src/d8/async-hooks-wrapper.h | 2 +- src/d8/d8.h | 2 +- src/deoptimizer/deoptimizer.h | 10 +- src/diagnostics/basic-block-profiler.cc | 2 +- src/diagnostics/basic-block-profiler.h | 2 +- src/diagnostics/compilation-statistics.cc | 8 +- src/diagnostics/compilation-statistics.h | 6 +- src/diagnostics/disasm.h | 2 +- src/diagnostics/gdb-jit.cc | 16 ++-- src/execution/isolate.h | 2 +- .../externalize-string-extension.cc | 9 +- src/handles/global-handles.cc | 2 +- src/handles/global-handles.h | 2 +- src/ia32/macro-assembler-ia32.h | 2 +- src/ia32/register-ia32.h | 6 +- src/init/bootstrapper.h | 2 +- src/inspector/v8-profiler-agent-impl.cc | 4 +- src/libplatform/tracing/perfetto-producer.h | 2 +- src/libsampler/sampler.cc | 8 +- src/libsampler/sampler.h | 4 +- src/mips/constants-mips.h | 2 +- src/mips/register-mips.h | 6 +- src/mips/simulator-mips.cc | 16 ++-- src/mips64/constants-mips64.h | 2 +- src/mips64/register-mips64.h | 6 +- src/mips64/simulator-mips64.cc | 16 ++-- src/numbers/bignum.h | 4 +- src/objects/contexts.h | 4 +- src/objects/elements.cc | 22 ++--- src/objects/feedback-vector.h | 12 +-- src/objects/objects-body-descriptors.h | 2 +- src/objects/objects.cc | 2 +- src/ppc/constants-ppc.h | 2 +- src/ppc/register-ppc.h | 4 +- src/profiler/allocation-tracker.h | 2 +- src/profiler/cpu-profiler.h | 4 +- src/profiler/heap-snapshot-generator.cc | 4 +- src/profiler/heap-snapshot-generator.h | 2 +- src/profiler/profile-generator.h | 4 +- src/profiler/sampling-heap-profiler.h | 2 +- src/roots/roots-inl.h | 4 +- src/runtime/runtime-classes.cc | 4 +- src/runtime/runtime-utils.h | 2 +- src/s390/assembler-s390.h | 2 +- src/s390/constants-s390.h | 8 +- src/s390/register-s390.h | 4 +- src/strings/string-builder-inl.h | 10 +- src/strings/string-stream.h | 2 +- src/strings/unicode.cc | 6 +- src/strings/unicode.h | 6 +- src/third_party/vtune/ittnotify_config.h | 10 +- src/torque/ast.h | 2 +- src/torque/implementation-visitor.h | 2 +- src/torque/types.h | 10 +- src/utils/address-map.h | 2 +- src/utils/identity-map.h | 2 +- src/utils/memcopy.h | 2 +- src/utils/splay-tree.h | 4 +- src/utils/utils.h | 10 +- src/wasm/wasm-objects.h | 2 +- src/x64/assembler-x64.h | 2 +- src/x64/macro-assembler-x64.h | 2 +- src/x64/register-x64.h | 6 +- src/zone/zone-allocator.h | 22 ++--- src/zone/zone-containers.h | 4 +- src/zone/zone-handle-set.h | 12 +-- src/zone/zone.h | 10 +- test/cctest/compiler/c-signature.h | 10 +- test/cctest/compiler/test-code-assembler.cc | 4 +- test/cctest/compiler/test-gap-resolver.cc | 4 +- test/cctest/compiler/test-instruction.cc | 4 +- test/cctest/compiler/test-multiple-return.cc | 2 +- test/cctest/compiler/test-node.cc | 3 +- test/cctest/compiler/test-run-native-calls.cc | 4 +- test/cctest/interpreter/test-interpreter.cc | 8 +- test/cctest/test-accessor-assembler.cc | 2 +- test/cctest/test-api.cc | 12 +-- test/cctest/test-assembler-mips.cc | 4 +- test/cctest/test-assembler-mips64.cc | 4 +- test/cctest/test-circular-queue.cc | 6 +- test/cctest/test-code-stub-assembler.cc | 2 +- test/cctest/test-cpu-profiler.cc | 2 +- test/cctest/test-global-handles.cc | 2 +- test/cctest/test-parsing.cc | 4 +- test/cctest/test-regexp.cc | 22 ++--- test/cctest/test-sampler-api.cc | 4 +- test/cctest/test-serialize.cc | 2 +- test/cctest/test-types.cc | 6 +- test/cctest/test-utils.cc | 4 +- test/cctest/torque/test-torque.cc | 4 +- test/common/types-fuzz.h | 4 +- test/unittests/api/isolate-unittest.cc | 2 +- test/unittests/api/remote-object-unittest.cc | 2 +- .../base/division-by-constant-unittest.cc | 5 +- test/unittests/base/flags-unittest.cc | 7 +- test/unittests/base/functional-unittest.cc | 19 ++-- test/unittests/base/iterator-unittest.cc | 2 +- .../optimizing-compile-dispatcher-unittest.cc | 2 +- .../arm/instruction-selector-arm-unittest.cc | 42 +++----- .../instruction-selector-arm64-unittest.cc | 85 ++++++---------- .../backend/instruction-selector-unittest.cc | 4 +- .../backend/instruction-selector-unittest.h | 4 +- .../backend/instruction-sequence-unittest.h | 10 +- .../instruction-selector-ia32-unittest.cc | 10 +- .../compiler/machine-operator-unittest.cc | 14 +-- .../instruction-selector-mips-unittest.cc | 88 ++++++----------- .../instruction-selector-mips64-unittest.cc | 75 +++++++-------- .../unittests/compiler/node-cache-unittest.cc | 2 +- test/unittests/compiler/node-unittest.cc | 3 +- .../compiler/regalloc/live-range-unittest.cc | 4 +- .../regalloc/register-allocator-unittest.cc | 2 +- test/unittests/compiler/schedule-unittest.cc | 7 +- test/unittests/compiler/typer-unittest.cc | 4 +- .../x64/instruction-selector-x64-unittest.cc | 20 ++-- test/unittests/numbers/bigint-unittest.cc | 2 +- test/unittests/objects/object-unittest.cc | 2 +- .../profiler/strings-storage-unittest.cc | 2 +- test/unittests/test-utils.h | 2 +- test/unittests/utils/locked-queue-unittest.cc | 2 +- test/unittests/utils/utils-unittest.cc | 20 ++-- 180 files changed, 622 insertions(+), 721 deletions(-) diff --git a/src/api/api-arguments.h b/src/api/api-arguments.h index bc2a674f3899..794681b71d0e 100644 --- a/src/api/api-arguments.h +++ b/src/api/api-arguments.h @@ -60,8 +60,8 @@ class CustomArguments : public CustomArgumentsBase { class PropertyCallbackArguments : public CustomArguments > { public: - typedef PropertyCallbackInfo T; - typedef CustomArguments Super; + using T = PropertyCallbackInfo; + using Super = CustomArguments; static const int kArgsLength = T::kArgsLength; static const int kThisIndex = T::kThisIndex; static const int kHolderIndex = T::kHolderIndex; @@ -150,8 +150,8 @@ class PropertyCallbackArguments class FunctionCallbackArguments : public CustomArguments > { public: - typedef FunctionCallbackInfo T; - typedef CustomArguments Super; + using T = FunctionCallbackInfo; + using Super = CustomArguments; static const int kArgsLength = T::kArgsLength; static const int kHolderIndex = T::kHolderIndex; static const int kDataIndex = T::kDataIndex; diff --git a/src/api/api.cc b/src/api/api.cc index 6f2a8cdd277a..f564adc14e30 100644 --- a/src/api/api.cc +++ b/src/api/api.cc @@ -5290,7 +5290,7 @@ void v8::String::VerifyExternalStringResourceBase( String::ExternalStringResource* String::GetExternalStringResourceSlow() const { i::DisallowHeapAllocation no_allocation; - typedef internal::Internals I; + using I = internal::Internals; i::String str = *Utils::OpenHandle(this); if (str.IsThinString()) { @@ -5307,7 +5307,7 @@ String::ExternalStringResource* String::GetExternalStringResourceSlow() const { String::ExternalStringResourceBase* String::GetExternalStringResourceBaseSlow( String::Encoding* encoding_out) const { i::DisallowHeapAllocation no_allocation; - typedef internal::Internals I; + using I = internal::Internals; ExternalStringResourceBase* resource = nullptr; i::String str = *Utils::OpenHandle(this); diff --git a/src/arm/constants-arm.h b/src/arm/constants-arm.h index 7d38bf99599b..4c7167f4302d 100644 --- a/src/arm/constants-arm.h +++ b/src/arm/constants-arm.h @@ -114,8 +114,7 @@ inline Condition NegateCondition(Condition cond) { // representing instructions from usual 32 bit values. // Instruction objects are pointers to 32bit values, and provide methods to // access the various ISA fields. -typedef int32_t Instr; - +using Instr = int32_t; // Opcodes for Data-processing instructions (instructions with a type 0 and 1) // as defined in section A3.4 @@ -263,8 +262,7 @@ enum SRegisterField { }; // Status register field mask (or'ed SRegisterField enum values). -typedef uint32_t SRegisterFieldMask; - +using SRegisterFieldMask = uint32_t; // Memory operand addressing mode. enum AddrMode { diff --git a/src/arm/register-arm.h b/src/arm/register-arm.h index 6fc54cb8dea1..c7e953726302 100644 --- a/src/arm/register-arm.h +++ b/src/arm/register-arm.h @@ -151,7 +151,7 @@ enum SwVfpRegisterCode { // This way, we make sure no registers in the list ever overlap. However, a list // may represent multiple different sets of registers, // e.g. [d0 s2 s3] <=> [s0 s1 d1]. -typedef uint64_t VfpRegList; +using VfpRegList = uint64_t; // Single word VFP register. class SwVfpRegister : public RegisterBase { @@ -179,7 +179,7 @@ ASSERT_TRIVIALLY_COPYABLE(SwVfpRegister); static_assert(sizeof(SwVfpRegister) == sizeof(int), "SwVfpRegister can efficiently be passed by value"); -typedef SwVfpRegister FloatRegister; +using FloatRegister = SwVfpRegister; enum DoubleRegisterCode { #define REGISTER_CODE(R) kDoubleCode_##R, @@ -217,7 +217,7 @@ ASSERT_TRIVIALLY_COPYABLE(DwVfpRegister); static_assert(sizeof(DwVfpRegister) == sizeof(int), "DwVfpRegister can efficiently be passed by value"); -typedef DwVfpRegister DoubleRegister; +using DoubleRegister = DwVfpRegister; // Double word VFP register d0-15. class LowDwVfpRegister @@ -272,9 +272,9 @@ class QwNeonRegister : public RegisterBase { explicit constexpr QwNeonRegister(int code) : RegisterBase(code) {} }; -typedef QwNeonRegister QuadRegister; +using QuadRegister = QwNeonRegister; -typedef QwNeonRegister Simd128Register; +using Simd128Register = QwNeonRegister; enum CRegisterCode { #define REGISTER_CODE(R) kCCode_##R, diff --git a/src/arm64/assembler-arm64.cc b/src/arm64/assembler-arm64.cc index 4408a44770bc..770dbd0827f0 100644 --- a/src/arm64/assembler-arm64.cc +++ b/src/arm64/assembler-arm64.cc @@ -860,7 +860,7 @@ void Assembler::DeleteUnresolvedBranchInfoForLabelTraverse(Label* label) { int max_reachable_pc = static_cast(InstructionOffset(link) + Instruction::ImmBranchRange(link->BranchType())); - typedef std::multimap::iterator unresolved_info_it; + using unresolved_info_it = std::multimap::iterator; std::pair range; range = unresolved_branches_.equal_range(max_reachable_pc); unresolved_info_it it; diff --git a/src/arm64/assembler-arm64.h b/src/arm64/assembler-arm64.h index f2c3e5d724b3..4791dcdbc706 100644 --- a/src/arm64/assembler-arm64.h +++ b/src/arm64/assembler-arm64.h @@ -215,7 +215,7 @@ class ConstPool { void EmitGuard(); void EmitEntries(); - typedef std::map SharedEntryMap; + using SharedEntryMap = std::map; // Adds a shared entry to entries_, using 'entry_map' to determine whether we // already track this entry. Returns true if this is the first time we add // this entry, false otherwise. diff --git a/src/arm64/constants-arm64.h b/src/arm64/constants-arm64.h index fcaf8b25a76e..bec9f4b5510e 100644 --- a/src/arm64/constants-arm64.h +++ b/src/arm64/constants-arm64.h @@ -148,7 +148,7 @@ const unsigned kFloat16ExponentBias = 15; // TODO(sigurds): Choose best value. constexpr int kRootRegisterBias = 256; -typedef uint16_t float16; +using float16 = uint16_t; #define INSTRUCTION_FIELDS_LIST(V_) \ /* Register fields */ \ diff --git a/src/arm64/instructions-arm64.h b/src/arm64/instructions-arm64.h index 8844a1bad678..b67303827c3e 100644 --- a/src/arm64/instructions-arm64.h +++ b/src/arm64/instructions-arm64.h @@ -18,7 +18,7 @@ struct AssemblerOptions; // ISA constants. -------------------------------------------------------------- -typedef uint32_t Instr; +using Instr = uint32_t; #if defined(V8_OS_WIN) extern "C" { diff --git a/src/arm64/register-arm64.h b/src/arm64/register-arm64.h index 96cd9db63d9b..160c1bd08561 100644 --- a/src/arm64/register-arm64.h +++ b/src/arm64/register-arm64.h @@ -551,9 +551,9 @@ V8_EXPORT_PRIVATE bool AreConsecutive(const VRegister& reg1, const VRegister& reg3 = NoVReg, const VRegister& reg4 = NoVReg); -typedef VRegister FloatRegister; -typedef VRegister DoubleRegister; -typedef VRegister Simd128Register; +using FloatRegister = VRegister; +using DoubleRegister = VRegister; +using Simd128Register = VRegister; // ----------------------------------------------------------------------------- // Lists of registers. diff --git a/src/arm64/simulator-arm64.cc b/src/arm64/simulator-arm64.cc index 7dacfe7d5bab..5566fd36f9de 100644 --- a/src/arm64/simulator-arm64.cc +++ b/src/arm64/simulator-arm64.cc @@ -45,7 +45,7 @@ namespace internal { #define CYAN "36" #define WHITE "37" -typedef char const * const TEXT_COLOUR; +using TEXT_COLOUR = char const* const; TEXT_COLOUR clr_normal = FLAG_log_colour ? COLOUR(NORMAL) : ""; TEXT_COLOUR clr_flag_name = FLAG_log_colour ? COLOUR_BOLD(WHITE) : ""; TEXT_COLOUR clr_flag_value = FLAG_log_colour ? COLOUR(NORMAL) : ""; @@ -874,7 +874,7 @@ void Simulator::AddSubWithCarry(Instruction* instr) { template T Simulator::ShiftOperand(T value, Shift shift_type, unsigned amount) { - typedef typename std::make_unsigned::type unsignedT; + using unsignedT = typename std::make_unsigned::type; if (amount == 0) { return value; @@ -2388,7 +2388,7 @@ void Simulator::DataProcessing2Source(Instruction* instr) { } case UDIV_w: case UDIV_x: { - typedef typename std::make_unsigned::type unsignedT; + using unsignedT = typename std::make_unsigned::type; unsignedT rn = static_cast(reg(instr->Rn())); unsignedT rm = static_cast(reg(instr->Rm())); if (rm == 0) { @@ -2493,7 +2493,7 @@ void Simulator::VisitDataProcessing3Source(Instruction* instr) { template void Simulator::BitfieldHelper(Instruction* instr) { - typedef typename std::make_unsigned::type unsignedT; + using unsignedT = typename std::make_unsigned::type; T reg_size = sizeof(T) * 8; T R = instr->ImmR(); T S = instr->ImmS(); diff --git a/src/arm64/simulator-arm64.h b/src/arm64/simulator-arm64.h index ca896404cdb6..7619533146a6 100644 --- a/src/arm64/simulator-arm64.h +++ b/src/arm64/simulator-arm64.h @@ -372,8 +372,8 @@ class SimRegisterBase { void NotifyRegisterWrite() { written_since_last_log_ = true; } }; -typedef SimRegisterBase SimRegister; // r0-r31 -typedef SimRegisterBase SimVRegister; // v0-v31 +using SimRegister = SimRegisterBase; // r0-r31 +using SimVRegister = SimRegisterBase; // v0-v31 // Representation of a vector register, with typed getters and setters for lanes // and additional information to represent lane state. diff --git a/src/asmjs/asm-scanner.h b/src/asmjs/asm-scanner.h index 4fbb7e1670e5..076a7607e386 100644 --- a/src/asmjs/asm-scanner.h +++ b/src/asmjs/asm-scanner.h @@ -29,7 +29,7 @@ class Utf16CharacterStream; // (for performance). class V8_EXPORT_PRIVATE AsmJsScanner { public: - typedef int32_t token_t; + using token_t = int32_t; explicit AsmJsScanner(Utf16CharacterStream* stream); diff --git a/src/asmjs/asm-types.h b/src/asmjs/asm-types.h index 90ddede3b122..8bb9e5d8e0b0 100644 --- a/src/asmjs/asm-types.h +++ b/src/asmjs/asm-types.h @@ -60,7 +60,7 @@ class AsmOverloadedFunctionType; class AsmValueType { public: - typedef uint32_t bitset_t; + using bitset_t = uint32_t; enum : uint32_t { #define DEFINE_TAG(CamelName, string_name, number, parent_types) \ diff --git a/src/ast/ast.h b/src/ast/ast.h index 36dc3d6e6495..8808567079ea 100644 --- a/src/ast/ast.h +++ b/src/ast/ast.h @@ -422,7 +422,7 @@ class DoExpression final : public Expression { class Declaration : public AstNode { public: - typedef base::ThreadedList List; + using List = base::ThreadedList; Variable* var() const { return var_; } void set_var(Variable* var) { var_ = var; } @@ -1300,7 +1300,7 @@ class ObjectLiteralProperty final : public LiteralProperty { // for minimizing the work when constructing it at runtime. class ObjectLiteral final : public AggregateLiteral { public: - typedef ObjectLiteralProperty Property; + using Property = ObjectLiteralProperty; Handle boilerplate_description() const { DCHECK(!boilerplate_description_.is_null()); @@ -2459,7 +2459,7 @@ class ClassLiteralProperty final : public LiteralProperty { class InitializeClassMembersStatement final : public Statement { public: - typedef ClassLiteralProperty Property; + using Property = ClassLiteralProperty; ZonePtrList* fields() const { return fields_; } @@ -2474,7 +2474,7 @@ class InitializeClassMembersStatement final : public Statement { class ClassLiteral final : public Expression { public: - typedef ClassLiteralProperty Property; + using Property = ClassLiteralProperty; ClassScope* scope() const { return scope_; } Variable* class_variable() const { return class_variable_; } diff --git a/src/ast/modules.h b/src/ast/modules.h index 2c778ff349e0..c3aa2bd0ada2 100644 --- a/src/ast/modules.h +++ b/src/ast/modules.h @@ -125,12 +125,12 @@ class ModuleDescriptor : public ZoneObject { bool operator()(const AstRawString* lhs, const AstRawString* rhs) const; }; - typedef ZoneMap - ModuleRequestMap; - typedef ZoneMultimap - RegularExportMap; - typedef ZoneMap - RegularImportMap; + using ModuleRequestMap = + ZoneMap; + using RegularExportMap = + ZoneMultimap; + using RegularImportMap = + ZoneMap; // Module requests. const ModuleRequestMap& module_requests() const { return module_requests_; } diff --git a/src/ast/scopes.h b/src/ast/scopes.h index 295d2415b179..1feaad2a9041 100644 --- a/src/ast/scopes.h +++ b/src/ast/scopes.h @@ -30,8 +30,8 @@ class Statement; class StringSet; class VariableProxy; -typedef base::ThreadedList - UnresolvedList; +using UnresolvedList = + base::ThreadedList; // A hash map to support fast variable declaration and lookup. class VariableMap : public ZoneHashMap { diff --git a/src/ast/variables.h b/src/ast/variables.h index 9b8b7ec64abf..df40fee75407 100644 --- a/src/ast/variables.h +++ b/src/ast/variables.h @@ -193,7 +193,7 @@ class Variable final : public ZoneObject { : kNeedsInitialization; } - typedef base::ThreadedList List; + using List = base::ThreadedList; private: Scope* scope_; diff --git a/src/base/compiler-specific.h b/src/base/compiler-specific.h index 46859bff85a2..5d68f7e11b01 100644 --- a/src/base/compiler-specific.h +++ b/src/base/compiler-specific.h @@ -7,9 +7,9 @@ #include "include/v8config.h" -// Annotate a typedef or function indicating it's ok if it's not used. -// Use like: -// typedef Foo Bar ALLOW_UNUSED_TYPE; +// Annotate a using ALLOW_UNUSED_TYPE = or function indicating it's ok if it's +// not used. Use like: +// using Bar = Foo; #if V8_HAS_ATTRIBUTE_UNUSED #define ALLOW_UNUSED_TYPE __attribute__((unused)) #else diff --git a/src/builtins/arm/builtins-arm.cc b/src/builtins/arm/builtins-arm.cc index c1e23127c12a..54c16932fa3a 100644 --- a/src/builtins/arm/builtins-arm.cc +++ b/src/builtins/arm/builtins-arm.cc @@ -2941,7 +2941,7 @@ void Builtins::Generate_CallApiCallback(MacroAssembler* masm) { DCHECK(!AreAliased(api_function_address, argc, call_data, holder, scratch)); - typedef FunctionCallbackArguments FCA; + using FCA = FunctionCallbackArguments; STATIC_ASSERT(FCA::kArgsLength == 6); STATIC_ASSERT(FCA::kNewTargetIndex == 5); diff --git a/src/builtins/arm64/builtins-arm64.cc b/src/builtins/arm64/builtins-arm64.cc index 2f99533154a5..f81a1955eeb4 100644 --- a/src/builtins/arm64/builtins-arm64.cc +++ b/src/builtins/arm64/builtins-arm64.cc @@ -3530,7 +3530,7 @@ void Builtins::Generate_CallApiCallback(MacroAssembler* masm) { DCHECK(!AreAliased(api_function_address, argc, call_data, holder, scratch)); - typedef FunctionCallbackArguments FCA; + using FCA = FunctionCallbackArguments; STATIC_ASSERT(FCA::kArgsLength == 6); STATIC_ASSERT(FCA::kNewTargetIndex == 5); diff --git a/src/builtins/builtins-arguments-gen.cc b/src/builtins/builtins-arguments-gen.cc index ea208847214c..8c710faa2716 100644 --- a/src/builtins/builtins-arguments-gen.cc +++ b/src/builtins/builtins-arguments-gen.cc @@ -17,7 +17,7 @@ namespace v8 { namespace internal { -typedef compiler::Node Node; +using Node = compiler::Node; std::tuple ArgumentsBuiltinsAssembler::AllocateArgumentsObject(Node* map, diff --git a/src/builtins/builtins-arguments-gen.h b/src/builtins/builtins-arguments-gen.h index 4ef4c05d2362..f59a71443f56 100644 --- a/src/builtins/builtins-arguments-gen.h +++ b/src/builtins/builtins-arguments-gen.h @@ -11,9 +11,9 @@ namespace v8 { namespace internal { -typedef compiler::Node Node; -typedef compiler::CodeAssemblerState CodeAssemblerState; -typedef compiler::CodeAssemblerLabel CodeAssemblerLabel; +using Node = compiler::Node; +using CodeAssemblerState = compiler::CodeAssemblerState; +using CodeAssemblerLabel = compiler::CodeAssemblerLabel; class ArgumentsBuiltinsAssembler : public CodeStubAssembler, diff --git a/src/builtins/builtins-array-gen.cc b/src/builtins/builtins-array-gen.cc index 1e5bc50c64ed..320527b48b06 100644 --- a/src/builtins/builtins-array-gen.cc +++ b/src/builtins/builtins-array-gen.cc @@ -2208,7 +2208,7 @@ void ArrayBuiltinsAssembler::GenerateConstructor( void ArrayBuiltinsAssembler::GenerateArrayNoArgumentConstructor( ElementsKind kind, AllocationSiteOverrideMode mode) { - typedef ArrayNoArgumentConstructorDescriptor Descriptor; + using Descriptor = ArrayNoArgumentConstructorDescriptor; Node* native_context = LoadObjectField(Parameter(Descriptor::kFunction), JSFunction::kContextOffset); bool track_allocation_site = @@ -2224,7 +2224,7 @@ void ArrayBuiltinsAssembler::GenerateArrayNoArgumentConstructor( void ArrayBuiltinsAssembler::GenerateArraySingleArgumentConstructor( ElementsKind kind, AllocationSiteOverrideMode mode) { - typedef ArraySingleArgumentConstructorDescriptor Descriptor; + using Descriptor = ArraySingleArgumentConstructorDescriptor; Node* context = Parameter(Descriptor::kContext); Node* function = Parameter(Descriptor::kFunction); Node* native_context = LoadObjectField(function, JSFunction::kContextOffset); @@ -2318,7 +2318,7 @@ GENERATE_ARRAY_CTOR(SingleArgument, HoleyDouble, HOLEY_DOUBLE_ELEMENTS, #undef GENERATE_ARRAY_CTOR TF_BUILTIN(InternalArrayNoArgumentConstructor_Packed, ArrayBuiltinsAssembler) { - typedef ArrayNoArgumentConstructorDescriptor Descriptor; + using Descriptor = ArrayNoArgumentConstructorDescriptor; TNode array_map = CAST(LoadObjectField(Parameter(Descriptor::kFunction), JSFunction::kPrototypeOrInitialMapOffset)); diff --git a/src/builtins/builtins-array-gen.h b/src/builtins/builtins-array-gen.h index c6e6ced6723a..6b8c704038fe 100644 --- a/src/builtins/builtins-array-gen.h +++ b/src/builtins/builtins-array-gen.h @@ -14,14 +14,13 @@ class ArrayBuiltinsAssembler : public CodeStubAssembler { public: explicit ArrayBuiltinsAssembler(compiler::CodeAssemblerState* state); - typedef std::function - BuiltinResultGenerator; + using BuiltinResultGenerator = + std::function; - typedef std::function - CallResultProcessor; + using CallResultProcessor = std::function; - typedef std::function PostLoopAction; + using PostLoopAction = std::function; void FindResultGenerator(); diff --git a/src/builtins/builtins-async-generator-gen.cc b/src/builtins/builtins-async-generator-gen.cc index fc5d066a474a..d14e811db8d9 100644 --- a/src/builtins/builtins-async-generator-gen.cc +++ b/src/builtins/builtins-async-generator-gen.cc @@ -389,7 +389,7 @@ TF_BUILTIN(AsyncGeneratorAwaitCaught, AsyncGeneratorBuiltinsAssembler) { } TF_BUILTIN(AsyncGeneratorResumeNext, AsyncGeneratorBuiltinsAssembler) { - typedef AsyncGeneratorResumeNextDescriptor Descriptor; + using Descriptor = AsyncGeneratorResumeNextDescriptor; Node* const generator = Parameter(Descriptor::kGenerator); Node* const context = Parameter(Descriptor::kContext); @@ -552,7 +552,7 @@ TF_BUILTIN(AsyncGeneratorResolve, AsyncGeneratorBuiltinsAssembler) { } TF_BUILTIN(AsyncGeneratorReject, AsyncGeneratorBuiltinsAssembler) { - typedef AsyncGeneratorRejectDescriptor Descriptor; + using Descriptor = AsyncGeneratorRejectDescriptor; Node* const generator = Parameter(Descriptor::kGenerator); Node* const value = Parameter(Descriptor::kValue); Node* const context = Parameter(Descriptor::kContext); diff --git a/src/builtins/builtins-async-iterator-gen.cc b/src/builtins/builtins-async-iterator-gen.cc index d841c70ad71a..215faa73b142 100644 --- a/src/builtins/builtins-async-iterator-gen.cc +++ b/src/builtins/builtins-async-iterator-gen.cc @@ -25,10 +25,9 @@ class AsyncFromSyncBuiltinsAssembler : public AsyncBuiltinsAssembler { Variable* var_exception, const char* method_name); - typedef std::function - UndefinedMethodHandler; - typedef std::function SyncIteratorNodeGenerator; + using UndefinedMethodHandler = std::function; + using SyncIteratorNodeGenerator = std::function; void Generate_AsyncFromSyncIteratorMethod( Node* const context, Node* const iterator, Node* const sent_value, const SyncIteratorNodeGenerator& get_method, diff --git a/src/builtins/builtins-collections-gen.cc b/src/builtins/builtins-collections-gen.cc index d0d8d8948bd3..fc46c8eb10ee 100644 --- a/src/builtins/builtins-collections-gen.cc +++ b/src/builtins/builtins-collections-gen.cc @@ -600,8 +600,8 @@ class CollectionsBuiltinsAssembler : public BaseCollectionsAssembler { // Transitions the iterator to the non obsolete backing store. // This is a NOP if the [table] is not obsolete. - typedef std::function - UpdateInTransition; + using UpdateInTransition = + std::function; template std::pair, TNode> Transition( TNode const table, TNode const index, @@ -2301,8 +2301,8 @@ class WeakCollectionsBuiltinsAssembler : public BaseCollectionsAssembler { // Builds code that finds the EphemeronHashTable entry for a {key} using the // comparison code generated by {key_compare}. The key index is returned if // the {key} is found. - typedef std::function entry_key, Label* if_same)> - KeyComparator; + using KeyComparator = + std::function entry_key, Label* if_same)>; TNode FindKeyIndex(TNode table, TNode key_hash, TNode entry_mask, const KeyComparator& key_compare); diff --git a/src/builtins/builtins-constructor-gen.cc b/src/builtins/builtins-constructor-gen.cc index c76adf980171..a725f3c4a1e5 100644 --- a/src/builtins/builtins-constructor-gen.cc +++ b/src/builtins/builtins-constructor-gen.cc @@ -54,7 +54,7 @@ TF_BUILTIN(ConstructWithSpread, CallOrConstructBuiltinsAssembler) { CallOrConstructWithSpread(target, new_target, spread, args_count, context); } -typedef compiler::Node Node; +using Node = compiler::Node; TF_BUILTIN(FastNewClosure, ConstructorBuiltinsAssembler) { Node* shared_function_info = Parameter(Descriptor::kSharedFunctionInfo); diff --git a/src/builtins/builtins-date.cc b/src/builtins/builtins-date.cc index 41c1fac8b8e9..d33387354283 100644 --- a/src/builtins/builtins-date.cc +++ b/src/builtins/builtins-date.cc @@ -143,7 +143,7 @@ double ParseDateTimeString(Isolate* isolate, Handle str) { enum ToDateStringMode { kDateOnly, kTimeOnly, kDateAndTime }; -typedef base::SmallVector DateBuffer; +using DateBuffer = base::SmallVector; template DateBuffer FormatDate(const char* format, Args... args) { diff --git a/src/builtins/builtins-descriptors.h b/src/builtins/builtins-descriptors.h index 7ac0f412574f..c2eb44debea3 100644 --- a/src/builtins/builtins-descriptors.h +++ b/src/builtins/builtins-descriptors.h @@ -31,17 +31,17 @@ namespace internal { // Define interface descriptors for builtins with StubCall linkage. #define DEFINE_TFC_INTERFACE_DESCRIPTOR(Name, InterfaceDescriptor) \ - typedef InterfaceDescriptor##Descriptor Builtin_##Name##_InterfaceDescriptor; + using Builtin_##Name##_InterfaceDescriptor = InterfaceDescriptor##Descriptor; #define DEFINE_TFS_INTERFACE_DESCRIPTOR(Name, ...) \ - typedef Name##Descriptor Builtin_##Name##_InterfaceDescriptor; + using Builtin_##Name##_InterfaceDescriptor = Name##Descriptor; // Define interface descriptors for IC handlers/dispatchers. #define DEFINE_TFH_INTERFACE_DESCRIPTOR(Name, InterfaceDescriptor) \ - typedef InterfaceDescriptor##Descriptor Builtin_##Name##_InterfaceDescriptor; + using Builtin_##Name##_InterfaceDescriptor = InterfaceDescriptor##Descriptor; #define DEFINE_ASM_INTERFACE_DESCRIPTOR(Name, InterfaceDescriptor) \ - typedef InterfaceDescriptor##Descriptor Builtin_##Name##_InterfaceDescriptor; + using Builtin_##Name##_InterfaceDescriptor = InterfaceDescriptor##Descriptor; BUILTIN_LIST(IGNORE_BUILTIN, DEFINE_TFJ_INTERFACE_DESCRIPTOR, DEFINE_TFC_INTERFACE_DESCRIPTOR, DEFINE_TFS_INTERFACE_DESCRIPTOR, diff --git a/src/builtins/builtins-handler-gen.cc b/src/builtins/builtins-handler-gen.cc index c9ce7152754f..775a15635c4d 100644 --- a/src/builtins/builtins-handler-gen.cc +++ b/src/builtins/builtins-handler-gen.cc @@ -26,13 +26,13 @@ class HandlerBuiltinsAssembler : public CodeStubAssembler { // compile-time types (int) by dispatching over the runtime type and // emitting a specialized copy of the given case function for each elements // kind. Use with caution. This produces a *lot* of code. - typedef std::function ElementsKindSwitchCase; + using ElementsKindSwitchCase = std::function; void DispatchByElementsKind(TNode elements_kind, const ElementsKindSwitchCase& case_function); // Dispatches over all possible combinations of {from,to} elements kinds. - typedef std::function - ElementsKindTransitionSwitchCase; + using ElementsKindTransitionSwitchCase = + std::function; void DispatchForElementsKindTransition( TNode from_kind, TNode to_kind, const ElementsKindTransitionSwitchCase& case_function); @@ -73,7 +73,7 @@ void Builtins::Generate_StoreIC_Uninitialized( // TODO(mythria): Check if we can remove feedback vector and slot parameters in // descriptor. void HandlerBuiltinsAssembler::Generate_KeyedStoreIC_Slow() { - typedef StoreWithVectorDescriptor Descriptor; + using Descriptor = StoreWithVectorDescriptor; Node* receiver = Parameter(Descriptor::kReceiver); Node* name = Parameter(Descriptor::kName); Node* value = Parameter(Descriptor::kValue); @@ -106,7 +106,7 @@ TF_BUILTIN(KeyedStoreIC_Slow_NoTransitionHandleCOW, HandlerBuiltinsAssembler) { } void HandlerBuiltinsAssembler::Generate_StoreInArrayLiteralIC_Slow() { - typedef StoreWithVectorDescriptor Descriptor; + using Descriptor = StoreWithVectorDescriptor; Node* array = Parameter(Descriptor::kReceiver); Node* index = Parameter(Descriptor::kName); Node* value = Parameter(Descriptor::kValue); @@ -204,7 +204,7 @@ void HandlerBuiltinsAssembler::DispatchForElementsKindTransition( void HandlerBuiltinsAssembler::Generate_ElementsTransitionAndStore( KeyedAccessStoreMode store_mode) { - typedef StoreTransitionDescriptor Descriptor; + using Descriptor = StoreTransitionDescriptor; Node* receiver = Parameter(Descriptor::kReceiver); Node* key = Parameter(Descriptor::kName); Node* value = Parameter(Descriptor::kValue); @@ -322,7 +322,7 @@ void HandlerBuiltinsAssembler::DispatchByElementsKind( void HandlerBuiltinsAssembler::Generate_StoreFastElementIC( KeyedAccessStoreMode store_mode) { - typedef StoreWithVectorDescriptor Descriptor; + using Descriptor = StoreWithVectorDescriptor; Node* receiver = Parameter(Descriptor::kReceiver); Node* key = Parameter(Descriptor::kName); Node* value = Parameter(Descriptor::kValue); @@ -430,7 +430,7 @@ TF_BUILTIN(KeyedLoadIC_SloppyArguments, CodeStubAssembler) { } void HandlerBuiltinsAssembler::Generate_KeyedStoreIC_SloppyArguments() { - typedef StoreWithVectorDescriptor Descriptor; + using Descriptor = StoreWithVectorDescriptor; Node* receiver = Parameter(Descriptor::kReceiver); Node* key = Parameter(Descriptor::kName); Node* value = Parameter(Descriptor::kValue); diff --git a/src/builtins/builtins-iterator-gen.cc b/src/builtins/builtins-iterator-gen.cc index 8f1031307535..aa34f473bf4b 100644 --- a/src/builtins/builtins-iterator-gen.cc +++ b/src/builtins/builtins-iterator-gen.cc @@ -16,7 +16,7 @@ namespace v8 { namespace internal { -typedef TorqueGeneratedIteratorBuiltinsAssembler::IteratorRecord IteratorRecord; +using IteratorRecord = TorqueGeneratedIteratorBuiltinsAssembler::IteratorRecord; using compiler::Node; diff --git a/src/builtins/builtins-lazy-gen.h b/src/builtins/builtins-lazy-gen.h index 2ae2ae90ab34..6036da466148 100644 --- a/src/builtins/builtins-lazy-gen.h +++ b/src/builtins/builtins-lazy-gen.h @@ -12,7 +12,7 @@ namespace internal { class LazyBuiltinsAssembler : public CodeStubAssembler { public: - typedef JSTrampolineDescriptor Descriptor; + using Descriptor = JSTrampolineDescriptor; explicit LazyBuiltinsAssembler(compiler::CodeAssemblerState* state) : CodeStubAssembler(state) {} diff --git a/src/builtins/builtins-object-gen.cc b/src/builtins/builtins-object-gen.cc index 624ed5ed41b9..314331d49854 100644 --- a/src/builtins/builtins-object-gen.cc +++ b/src/builtins/builtins-object-gen.cc @@ -21,7 +21,7 @@ namespace internal { // ----------------------------------------------------------------------------- // ES6 section 19.1 Object Objects -typedef compiler::Node Node; +using Node = compiler::Node; template using TNode = CodeStubAssembler::TNode; diff --git a/src/builtins/builtins-promise-gen.cc b/src/builtins/builtins-promise-gen.cc index 24837eb265e3..5523a4d7cf0d 100644 --- a/src/builtins/builtins-promise-gen.cc +++ b/src/builtins/builtins-promise-gen.cc @@ -18,7 +18,7 @@ namespace v8 { namespace internal { -typedef compiler::Node Node; +using Node = compiler::Node; template using TNode = CodeStubAssembler::TNode; using IteratorRecord = IteratorBuiltinsAssembler::IteratorRecord; diff --git a/src/builtins/builtins-promise-gen.h b/src/builtins/builtins-promise-gen.h index c52038bfc1e1..824fc06137f7 100644 --- a/src/builtins/builtins-promise-gen.h +++ b/src/builtins/builtins-promise-gen.h @@ -13,7 +13,7 @@ namespace v8 { namespace internal { -typedef compiler::CodeAssemblerState CodeAssemblerState; +using CodeAssemblerState = compiler::CodeAssemblerState; class V8_EXPORT_PRIVATE PromiseBuiltinsAssembler : public CodeStubAssembler { public: @@ -133,10 +133,10 @@ class V8_EXPORT_PRIVATE PromiseBuiltinsAssembler : public CodeStubAssembler { Node* CreateThrowerFunction(Node* reason, Node* native_context); - typedef std::function(TNode context, TNode index, - TNode native_context, - TNode capability)> - PromiseAllResolvingElementFunction; + using PromiseAllResolvingElementFunction = + std::function(TNode context, TNode index, + TNode native_context, + TNode capability)>; Node* PerformPromiseAll( Node* context, Node* constructor, Node* capability, @@ -172,10 +172,10 @@ class V8_EXPORT_PRIVATE PromiseBuiltinsAssembler : public CodeStubAssembler { const PromiseAllResolvingElementFunction& create_resolve_element_function, const PromiseAllResolvingElementFunction& create_reject_element_function); - typedef std::function(TNode context, - TNode native_context, - TNode value)> - CreatePromiseAllResolveElementFunctionValue; + using CreatePromiseAllResolveElementFunctionValue = + std::function(TNode context, + TNode native_context, + TNode value)>; void Generate_PromiseAllResolveElementClosure( TNode context, TNode value, TNode function, diff --git a/src/builtins/builtins-string-gen.cc b/src/builtins/builtins-string-gen.cc index c25863864e44..5689b42619a9 100644 --- a/src/builtins/builtins-string-gen.cc +++ b/src/builtins/builtins-string-gen.cc @@ -16,7 +16,7 @@ namespace v8 { namespace internal { -typedef compiler::Node Node; +using Node = compiler::Node; template using TNode = compiler::TNode; @@ -748,8 +748,8 @@ void StringBuiltinsAssembler::StringIndexOf( search_to_direct.instance_type(), &one_one, &one_two, &two_one, &two_two); - typedef const uint8_t onebyte_t; - typedef const uc16 twobyte_t; + using onebyte_t = const uint8_t; + using twobyte_t = const uc16; BIND(&one_one); { diff --git a/src/builtins/builtins-string-gen.h b/src/builtins/builtins-string-gen.h index 40517ae9582a..92ebd3803b8b 100644 --- a/src/builtins/builtins-string-gen.h +++ b/src/builtins/builtins-string-gen.h @@ -62,9 +62,8 @@ class StringBuiltinsAssembler : public CodeStubAssembler { void GenerateStringRelationalComparison(Node* context, Node* left, Node* right, Operation op); - typedef std::function( - TNode receiver, TNode length, TNode index)> - StringAtAccessor; + using StringAtAccessor = std::function( + TNode receiver, TNode length, TNode index)>; void StringIndexOf(Node* const subject_string, Node* const search_string, Node* const position, @@ -96,8 +95,8 @@ class StringBuiltinsAssembler : public CodeStubAssembler { // // Contains fast paths for Smi and RegExp objects. // Important: {regexp_call} may not contain any code that can call into JS. - typedef std::function NodeFunction0; - typedef std::function NodeFunction1; + using NodeFunction0 = std::function; + using NodeFunction1 = std::function; void MaybeCallFunctionAtSymbol(Node* const context, Node* const object, Node* const maybe_string, Handle symbol, diff --git a/src/builtins/builtins-typed-array-gen.h b/src/builtins/builtins-typed-array-gen.h index f033cc179444..7cdb4a677c0e 100644 --- a/src/builtins/builtins-typed-array-gen.h +++ b/src/builtins/builtins-typed-array-gen.h @@ -114,7 +114,7 @@ class TypedArrayBuiltinsAssembler : public CodeStubAssembler { TNode start, TNode end); - typedef std::function TypedArraySwitchCase; + using TypedArraySwitchCase = std::function; void DispatchTypedArrayByElementsKind( TNode elements_kind, const TypedArraySwitchCase& case_function); diff --git a/src/builtins/builtins-utils-gen.h b/src/builtins/builtins-utils-gen.h index a9b040b040f2..f9e2ba74faad 100644 --- a/src/builtins/builtins-utils-gen.h +++ b/src/builtins/builtins-utils-gen.h @@ -29,7 +29,7 @@ class CodeAssemblerState; #define TF_BUILTIN(Name, AssemblerBase) \ class Name##Assembler : public AssemblerBase { \ public: \ - typedef Builtin_##Name##_InterfaceDescriptor Descriptor; \ + using Descriptor = Builtin_##Name##_InterfaceDescriptor; \ \ explicit Name##Assembler(compiler::CodeAssemblerState* state) \ : AssemblerBase(state) {} \ diff --git a/src/builtins/constants-table-builder.h b/src/builtins/constants-table-builder.h index 20df6d29b73b..89c95912a1ea 100644 --- a/src/builtins/constants-table-builder.h +++ b/src/builtins/constants-table-builder.h @@ -42,7 +42,7 @@ class BuiltinsConstantsTableBuilder final { Isolate* isolate_; // Maps objects to corresponding indices within the constants list. - typedef IdentityMap ConstantsMap; + using ConstantsMap = IdentityMap; ConstantsMap map_; DISALLOW_COPY_AND_ASSIGN(BuiltinsConstantsTableBuilder); diff --git a/src/builtins/ia32/builtins-ia32.cc b/src/builtins/ia32/builtins-ia32.cc index 3bb2207c3f3b..0d80c681fbf1 100644 --- a/src/builtins/ia32/builtins-ia32.cc +++ b/src/builtins/ia32/builtins-ia32.cc @@ -3151,7 +3151,7 @@ void Builtins::Generate_CallApiCallback(MacroAssembler* masm) { DCHECK(!AreAliased(api_function_address, argc, holder)); - typedef FunctionCallbackArguments FCA; + using FCA = FunctionCallbackArguments; STATIC_ASSERT(FCA::kArgsLength == 6); STATIC_ASSERT(FCA::kNewTargetIndex == 5); diff --git a/src/builtins/mips/builtins-mips.cc b/src/builtins/mips/builtins-mips.cc index 76c9a22af473..4ba1a7e3fda9 100644 --- a/src/builtins/mips/builtins-mips.cc +++ b/src/builtins/mips/builtins-mips.cc @@ -2941,7 +2941,7 @@ void Builtins::Generate_CallApiCallback(MacroAssembler* masm) { DCHECK(!AreAliased(api_function_address, argc, call_data, holder, scratch, base)); - typedef FunctionCallbackArguments FCA; + using FCA = FunctionCallbackArguments; STATIC_ASSERT(FCA::kArgsLength == 6); STATIC_ASSERT(FCA::kNewTargetIndex == 5); @@ -3058,7 +3058,7 @@ void Builtins::Generate_CallApiGetter(MacroAssembler* masm) { Register api_function_address = a2; // Here and below +1 is for name() pushed after the args_ array. - typedef PropertyCallbackArguments PCA; + using PCA = PropertyCallbackArguments; __ Subu(sp, sp, (PCA::kArgsLength + 1) * kPointerSize); __ sw(receiver, MemOperand(sp, (PCA::kThisIndex + 1) * kPointerSize)); __ lw(scratch, FieldMemOperand(callback, AccessorInfo::kDataOffset)); diff --git a/src/builtins/mips64/builtins-mips64.cc b/src/builtins/mips64/builtins-mips64.cc index 592f473df661..d5aec728bae5 100644 --- a/src/builtins/mips64/builtins-mips64.cc +++ b/src/builtins/mips64/builtins-mips64.cc @@ -2977,7 +2977,7 @@ void Builtins::Generate_CallApiCallback(MacroAssembler* masm) { DCHECK(!AreAliased(api_function_address, argc, call_data, holder, scratch, base)); - typedef FunctionCallbackArguments FCA; + using FCA = FunctionCallbackArguments; STATIC_ASSERT(FCA::kArgsLength == 6); STATIC_ASSERT(FCA::kNewTargetIndex == 5); @@ -3098,7 +3098,7 @@ void Builtins::Generate_CallApiGetter(MacroAssembler* masm) { Register api_function_address = a2; // Here and below +1 is for name() pushed after the args_ array. - typedef PropertyCallbackArguments PCA; + using PCA = PropertyCallbackArguments; __ Dsubu(sp, sp, (PCA::kArgsLength + 1) * kPointerSize); __ Sd(receiver, MemOperand(sp, (PCA::kThisIndex + 1) * kPointerSize)); __ Ld(scratch, FieldMemOperand(callback, AccessorInfo::kDataOffset)); diff --git a/src/builtins/ppc/builtins-ppc.cc b/src/builtins/ppc/builtins-ppc.cc index 836900b9cff0..e3c6ce6407f2 100644 --- a/src/builtins/ppc/builtins-ppc.cc +++ b/src/builtins/ppc/builtins-ppc.cc @@ -3063,7 +3063,7 @@ void Builtins::Generate_CallApiCallback(MacroAssembler* masm) { Register scratch = r7; DCHECK(!AreAliased(api_function_address, argc, call_data, holder, scratch)); - typedef FunctionCallbackArguments FCA; + using FCA = FunctionCallbackArguments; STATIC_ASSERT(FCA::kArgsLength == 6); STATIC_ASSERT(FCA::kNewTargetIndex == 5); diff --git a/src/builtins/s390/builtins-s390.cc b/src/builtins/s390/builtins-s390.cc index 418b83a26b35..bf8c0cb68a8b 100644 --- a/src/builtins/s390/builtins-s390.cc +++ b/src/builtins/s390/builtins-s390.cc @@ -3101,7 +3101,7 @@ void Builtins::Generate_CallApiCallback(MacroAssembler* masm) { Register scratch = r6; DCHECK(!AreAliased(api_function_address, argc, call_data, holder, scratch)); - typedef FunctionCallbackArguments FCA; + using FCA = FunctionCallbackArguments; STATIC_ASSERT(FCA::kArgsLength == 6); STATIC_ASSERT(FCA::kNewTargetIndex == 5); diff --git a/src/builtins/x64/builtins-x64.cc b/src/builtins/x64/builtins-x64.cc index 0ea2c69853b0..5c09b3a8dede 100644 --- a/src/builtins/x64/builtins-x64.cc +++ b/src/builtins/x64/builtins-x64.cc @@ -3138,7 +3138,7 @@ void Builtins::Generate_CallApiCallback(MacroAssembler* masm) { DCHECK(!AreAliased(api_function_address, argc, holder, call_data, kScratchRegister)); - typedef FunctionCallbackArguments FCA; + using FCA = FunctionCallbackArguments; STATIC_ASSERT(FCA::kArgsLength == 6); STATIC_ASSERT(FCA::kNewTargetIndex == 5); diff --git a/src/codegen/code-stub-assembler.cc b/src/codegen/code-stub-assembler.cc index cc3c1a0564b2..7c7a4b75f8d5 100644 --- a/src/codegen/code-stub-assembler.cc +++ b/src/codegen/code-stub-assembler.cc @@ -13254,7 +13254,7 @@ void CodeStubArguments::SetReceiver(TNode object) const { TNode CodeStubArguments::AtIndexPtr( Node* index, CodeStubAssembler::ParameterMode mode) const { - typedef compiler::Node Node; + using Node = compiler::Node; Node* negated_index = assembler_->IntPtrOrSmiSub( assembler_->IntPtrOrSmiConstant(0, mode), index, mode); Node* offset = assembler_->ElementOffsetFromIndex( diff --git a/src/codegen/code-stub-assembler.h b/src/codegen/code-stub-assembler.h index 5f6c55fc5da2..ff5ce648fd26 100644 --- a/src/codegen/code-stub-assembler.h +++ b/src/codegen/code-stub-assembler.h @@ -227,7 +227,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler enum SlackTrackingMode { kWithSlackTracking, kNoSlackTracking }; - typedef base::Flags AllocationFlags; + using AllocationFlags = base::Flags; enum ParameterMode { SMI_PARAMETERS, INTPTR_PARAMETERS }; @@ -624,8 +624,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler TNode IsRegularHeapObjectSize(TNode size); - typedef std::function BranchGenerator; - typedef std::function NodeGenerator; + using BranchGenerator = std::function; + using NodeGenerator = std::function; void Assert(const BranchGenerator& branch, const char* message = nullptr, const char* file = nullptr, int line = 0, @@ -1883,7 +1883,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler kAllFixedArraysDontCopyCOW = kAllFixedArrays | kDontCopyCOW }; - typedef base::Flags ExtractFixedArrayFlags; + using ExtractFixedArrayFlags = base::Flags; // Copy a portion of an existing FixedArray or FixedDoubleArray into a new // array, including special appropriate handling for empty arrays and COW @@ -2925,10 +2925,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler // This is a type of a lookup in holder generator function. In case of a // property lookup the {key} is guaranteed to be an unique name and in case of // element lookup the key is an Int32 index. - typedef std::function - LookupInHolder; + using LookupInHolder = std::function; // For integer indexed exotic cases, check if the given string cannot be a // special index. If we are not sure that the given string is not a special @@ -3093,7 +3092,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler enum class IndexAdvanceMode { kPre, kPost }; - typedef std::function FastLoopBody; + using FastLoopBody = std::function; Node* BuildFastLoop(const VariableList& var_list, Node* start_index, Node* end_index, const FastLoopBody& body, int increment, @@ -3110,8 +3109,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler enum class ForEachDirection { kForward, kReverse }; - typedef std::function - FastFixedArrayForEachBody; + using FastFixedArrayForEachBody = + std::function; void BuildFastFixedArrayForEach( const CodeStubAssembler::VariableList& vars, Node* fixed_array, @@ -3444,8 +3443,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler TNode DescriptorArrayGetDetails(TNode descriptors, TNode descriptor_number); - typedef std::function descriptor_key_index)> - ForEachDescriptorBodyFunction; + using ForEachDescriptorBodyFunction = + std::function descriptor_key_index)>; // Descriptor array accessors based on key_index, which is equal to // DescriptorArray::ToKeyIndex(descriptor). @@ -3474,8 +3473,8 @@ class V8_EXPORT_PRIVATE CodeStubAssembler TNode LoadFieldTypeByDescriptorEntry( TNode descriptors, TNode descriptor); - typedef std::function key, TNode value)> - ForEachKeyValueFunction; + using ForEachKeyValueFunction = + std::function key, TNode value)>; enum ForEachEnumerationMode { // String and then Symbol properties according to the spec @@ -3600,7 +3599,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler class V8_EXPORT_PRIVATE CodeStubArguments { public: - typedef compiler::Node Node; + using Node = compiler::Node; template using TNode = compiler::TNode; template @@ -3680,7 +3679,7 @@ class V8_EXPORT_PRIVATE CodeStubArguments { return assembler_->UncheckedCast(argc_); } - typedef std::function ForEachBodyFunction; + using ForEachBodyFunction = std::function; // Iteration doesn't include the receiver. |first| and |last| are zero-based. void ForEach(const ForEachBodyFunction& body, Node* first = nullptr, @@ -3719,7 +3718,7 @@ class ToDirectStringAssembler : public CodeStubAssembler { enum Flag { kDontUnpackSlicedStrings = 1 << 0, }; - typedef base::Flags Flags; + using Flags = base::Flags; ToDirectStringAssembler(compiler::CodeAssemblerState* state, Node* string, Flags flags = Flags()); diff --git a/src/codegen/compiler.h b/src/codegen/compiler.h index 890160f1e6af..a5987063737c 100644 --- a/src/codegen/compiler.h +++ b/src/codegen/compiler.h @@ -35,8 +35,8 @@ class UnoptimizedCompilationInfo; class UnoptimizedCompilationJob; class WorkerThreadRuntimeCallStats; -typedef std::forward_list> - UnoptimizedCompilationJobList; +using UnoptimizedCompilationJobList = + std::forward_list>; // The V8 compiler API. // diff --git a/src/codegen/external-reference.h b/src/codegen/external-reference.h index cf48e40bf1a7..4c83a9b33af3 100644 --- a/src/codegen/external-reference.h +++ b/src/codegen/external-reference.h @@ -270,8 +270,6 @@ class ExternalReference { EXTERNAL_REFERENCE_LIST_WITH_ISOLATE(COUNT_EXTERNAL_REFERENCE); #undef COUNT_EXTERNAL_REFERENCE - typedef Address ExternalReferenceRedirector(Address original, Type type); - ExternalReference() : address_(kNullAddress) {} static ExternalReference Create(const SCTableReference& table_ref); static ExternalReference Create(StatsCounter* counter); diff --git a/src/codegen/interface-descriptors.h b/src/codegen/interface-descriptors.h index 801a098c0614..d166b477d808 100644 --- a/src/codegen/interface-descriptors.h +++ b/src/codegen/interface-descriptors.h @@ -99,7 +99,7 @@ class V8_EXPORT_PRIVATE CallInterfaceDescriptorData { // untagged stack arguments. kNoStackScan = 1u << 1, }; - typedef base::Flags Flags; + using Flags = base::Flags; CallInterfaceDescriptorData() = default; @@ -225,7 +225,7 @@ class V8_EXPORT_PRIVATE CallDescriptors : public AllStatic { class V8_EXPORT_PRIVATE CallInterfaceDescriptor { public: - typedef CallInterfaceDescriptorData::Flags Flags; + using Flags = CallInterfaceDescriptorData::Flags; CallInterfaceDescriptor() : data_(nullptr) {} virtual ~CallInterfaceDescriptor() = default; @@ -485,10 +485,10 @@ class V8_EXPORT_PRIVATE VoidDescriptor : public CallInterfaceDescriptor { // Dummy descriptor used to mark builtins that don't yet have their proper // descriptor associated. -typedef VoidDescriptor DummyDescriptor; +using DummyDescriptor = VoidDescriptor; // Dummy descriptor that marks builtins with C calling convention. -typedef VoidDescriptor CCallDescriptor; +using CCallDescriptor = VoidDescriptor; class AllocateDescriptor : public CallInterfaceDescriptor { public: diff --git a/src/codegen/optimized-compilation-info.h b/src/codegen/optimized-compilation-info.h index 34f2bde62a95..eca3a8fa3236 100644 --- a/src/codegen/optimized-compilation-info.h +++ b/src/codegen/optimized-compilation-info.h @@ -259,7 +259,7 @@ class V8_EXPORT_PRIVATE OptimizedCompilationInfo final { } }; - typedef std::vector InlinedFunctionList; + using InlinedFunctionList = std::vector; InlinedFunctionList& inlined_functions() { return inlined_functions_; } // Returns the inlining id for source position tracking. diff --git a/src/codegen/reglist.h b/src/codegen/reglist.h index b491ee88f9ac..609e6b88458e 100644 --- a/src/codegen/reglist.h +++ b/src/codegen/reglist.h @@ -15,9 +15,9 @@ namespace internal { // Register configurations. #if V8_TARGET_ARCH_ARM64 -typedef uint64_t RegList; +using RegList = uint64_t; #else -typedef uint32_t RegList; +using RegList = uint32_t; #endif // Get the number of registers in a given register list. diff --git a/src/codegen/signature.h b/src/codegen/signature.h index 636059329111..c05c44053079 100644 --- a/src/codegen/signature.h +++ b/src/codegen/signature.h @@ -105,7 +105,7 @@ class Signature : public ZoneObject { const T* reps_; }; -typedef Signature MachineSignature; +using MachineSignature = Signature; template size_t hash_value(const Signature& sig) { diff --git a/src/codegen/source-position-table.cc b/src/codegen/source-position-table.cc index 8d0c82744a83..6c0aa36b2767 100644 --- a/src/codegen/source-position-table.cc +++ b/src/codegen/source-position-table.cc @@ -48,7 +48,7 @@ void SubtractFromEntry(PositionTableEntry& value, // Helper: Encode an integer. template void EncodeInt(std::vector& bytes, T value) { - typedef typename std::make_unsigned::type unsigned_type; + using unsigned_type = typename std::make_unsigned::type; // Zig-zag encoding. static const int kShift = sizeof(T) * kBitsPerByte - 1; value = ((static_cast(value) << 1) ^ (value >> kShift)); diff --git a/src/codegen/source-position.h b/src/codegen/source-position.h index 072eb920713a..ad0132b827e8 100644 --- a/src/codegen/source-position.h +++ b/src/codegen/source-position.h @@ -142,18 +142,18 @@ class SourcePosition final { void Print(std::ostream& out, SharedFunctionInfo function) const; - typedef BitField64 IsExternalField; + using IsExternalField = BitField64; // The two below are only used if IsExternal() is true. - typedef BitField64 ExternalLineField; - typedef BitField64 ExternalFileIdField; + using ExternalLineField = BitField64; + using ExternalFileIdField = BitField64; // ScriptOffsetField is only used if IsExternal() is false. - typedef BitField64 ScriptOffsetField; + using ScriptOffsetField = BitField64; // InliningId is in the high bits for better compression in // SourcePositionTable. - typedef BitField64 InliningIdField; + using InliningIdField = BitField64; // Leaving the highest bit untouched to allow for signed conversion. uint64_t value_; diff --git a/src/common/assert-scope.h b/src/common/assert-scope.h index ac2f2c857330..606439d42bcf 100644 --- a/src/common/assert-scope.h +++ b/src/common/assert-scope.h @@ -119,16 +119,16 @@ class PerIsolateAssertScopeDebugOnly { // Per-thread assert scopes. // Scope to document where we do not expect handles to be created. -typedef PerThreadAssertScopeDebugOnly - DisallowHandleAllocation; +using DisallowHandleAllocation = + PerThreadAssertScopeDebugOnly; // Scope to introduce an exception to DisallowHandleAllocation. -typedef PerThreadAssertScopeDebugOnly - AllowHandleAllocation; +using AllowHandleAllocation = + PerThreadAssertScopeDebugOnly; // Scope to document where we do not expect any allocation and GC. -typedef PerThreadAssertScopeDebugOnly - DisallowHeapAllocation; +using DisallowHeapAllocation = + PerThreadAssertScopeDebugOnly; #ifdef DEBUG #define DISALLOW_HEAP_ALLOCATION(name) DisallowHeapAllocation name; #else @@ -136,32 +136,32 @@ typedef PerThreadAssertScopeDebugOnly #endif // Scope to introduce an exception to DisallowHeapAllocation. -typedef PerThreadAssertScopeDebugOnly - AllowHeapAllocation; +using AllowHeapAllocation = + PerThreadAssertScopeDebugOnly; // Scope to document where we do not expect any handle dereferences. -typedef PerThreadAssertScopeDebugOnly - DisallowHandleDereference; +using DisallowHandleDereference = + PerThreadAssertScopeDebugOnly; // Scope to introduce an exception to DisallowHandleDereference. -typedef PerThreadAssertScopeDebugOnly - AllowHandleDereference; +using AllowHandleDereference = + PerThreadAssertScopeDebugOnly; // Scope to document where we do not expect deferred handles to be dereferenced. -typedef PerThreadAssertScopeDebugOnly - DisallowDeferredHandleDereference; +using DisallowDeferredHandleDereference = + PerThreadAssertScopeDebugOnly; // Scope to introduce an exception to DisallowDeferredHandleDereference. -typedef PerThreadAssertScopeDebugOnly - AllowDeferredHandleDereference; +using AllowDeferredHandleDereference = + PerThreadAssertScopeDebugOnly; // Scope to document where we do not expect deferred handles to be dereferenced. -typedef PerThreadAssertScopeDebugOnly - DisallowCodeDependencyChange; +using DisallowCodeDependencyChange = + PerThreadAssertScopeDebugOnly; // Scope to introduce an exception to DisallowDeferredHandleDereference. -typedef PerThreadAssertScopeDebugOnly - AllowCodeDependencyChange; +using AllowCodeDependencyChange = + PerThreadAssertScopeDebugOnly; class DisallowHeapAccess { DisallowCodeDependencyChange no_dependency_change_; @@ -183,60 +183,60 @@ class DisallowHeapAccessIf { // Per-isolate assert scopes. // Scope to document where we do not expect javascript execution. -typedef PerIsolateAssertScope - DisallowJavascriptExecution; +using DisallowJavascriptExecution = + PerIsolateAssertScope; // Scope to introduce an exception to DisallowJavascriptExecution. -typedef PerIsolateAssertScope - AllowJavascriptExecution; +using AllowJavascriptExecution = + PerIsolateAssertScope; // Scope to document where we do not expect javascript execution (debug only) -typedef PerIsolateAssertScopeDebugOnly - DisallowJavascriptExecutionDebugOnly; +using DisallowJavascriptExecutionDebugOnly = + PerIsolateAssertScopeDebugOnly; // Scope to introduce an exception to DisallowJavascriptExecutionDebugOnly. -typedef PerIsolateAssertScopeDebugOnly - AllowJavascriptExecutionDebugOnly; +using AllowJavascriptExecutionDebugOnly = + PerIsolateAssertScopeDebugOnly; // Scope in which javascript execution leads to exception being thrown. -typedef PerIsolateAssertScope - ThrowOnJavascriptExecution; +using ThrowOnJavascriptExecution = + PerIsolateAssertScope; // Scope to introduce an exception to ThrowOnJavascriptExecution. -typedef PerIsolateAssertScope - NoThrowOnJavascriptExecution; +using NoThrowOnJavascriptExecution = + PerIsolateAssertScope; // Scope in which javascript execution causes dumps. -typedef PerIsolateAssertScope - DumpOnJavascriptExecution; +using DumpOnJavascriptExecution = + PerIsolateAssertScope; // Scope in which javascript execution causes dumps. -typedef PerIsolateAssertScope - NoDumpOnJavascriptExecution; +using NoDumpOnJavascriptExecution = + PerIsolateAssertScope; // Scope to document where we do not expect deoptimization. -typedef PerIsolateAssertScopeDebugOnly - DisallowDeoptimization; +using DisallowDeoptimization = + PerIsolateAssertScopeDebugOnly; // Scope to introduce an exception to DisallowDeoptimization. -typedef PerIsolateAssertScopeDebugOnly - AllowDeoptimization; +using AllowDeoptimization = + PerIsolateAssertScopeDebugOnly; // Scope to document where we do not expect deoptimization. -typedef PerIsolateAssertScopeDebugOnly - DisallowCompilation; +using DisallowCompilation = + PerIsolateAssertScopeDebugOnly; // Scope to introduce an exception to DisallowDeoptimization. -typedef PerIsolateAssertScopeDebugOnly - AllowCompilation; +using AllowCompilation = + PerIsolateAssertScopeDebugOnly; // Scope to document where we do not expect exceptions. -typedef PerIsolateAssertScopeDebugOnly - DisallowExceptions; +using DisallowExceptions = + PerIsolateAssertScopeDebugOnly; // Scope to introduce an exception to DisallowExceptions. -typedef PerIsolateAssertScopeDebugOnly - AllowExceptions; +using AllowExceptions = + PerIsolateAssertScopeDebugOnly; // Explicit instantiation declarations. extern template class PerThreadAssertScope; diff --git a/src/common/globals.h b/src/common/globals.h index eef0ff18d0a3..bad50bf06c67 100644 --- a/src/common/globals.h +++ b/src/common/globals.h @@ -110,7 +110,7 @@ class AllStatic { #endif }; -typedef uint8_t byte; +using byte = uint8_t; // ----------------------------------------------------------------------------- // Constants @@ -316,8 +316,8 @@ constexpr uint64_t kQuietNaNMask = static_cast(0xfff) << 51; // Latin1/UTF-16 constants // Code-point values in Unicode 4.0 are 21 bits wide. // Code units in UTF-16 are 16 bits wide. -typedef uint16_t uc16; -typedef int32_t uc32; +using uc16 = uint16_t; +using uc32 = int32_t; constexpr int kOneByteSize = kCharSize; constexpr int kUC16Size = sizeof(uc16); // NOLINT @@ -892,11 +892,11 @@ union IeeeDoubleBigEndianArchType { }; #if V8_TARGET_LITTLE_ENDIAN -typedef IeeeDoubleLittleEndianArchType IeeeDoubleArchType; +using IeeeDoubleArchType = IeeeDoubleLittleEndianArchType; constexpr int kIeeeDoubleMantissaWordOffset = 0; constexpr int kIeeeDoubleExponentWordOffset = 4; #else -typedef IeeeDoubleBigEndianArchType IeeeDoubleArchType; +using IeeeDoubleArchType = IeeeDoubleBigEndianArchType; constexpr int kIeeeDoubleMantissaWordOffset = 4; constexpr int kIeeeDoubleExponentWordOffset = 0; #endif @@ -1384,7 +1384,7 @@ enum class DataPropertyInLiteralFlag { kDontEnum = 1 << 0, kSetFunctionName = 1 << 1 }; -typedef base::Flags DataPropertyInLiteralFlags; +using DataPropertyInLiteralFlags = base::Flags; DEFINE_OPERATORS_FOR_FLAGS(DataPropertyInLiteralFlags) enum ExternalArrayType { diff --git a/src/compiler-dispatcher/compiler-dispatcher.h b/src/compiler-dispatcher/compiler-dispatcher.h index 472b0b93bedd..544e9c8ba7b6 100644 --- a/src/compiler-dispatcher/compiler-dispatcher.h +++ b/src/compiler-dispatcher/compiler-dispatcher.h @@ -75,7 +75,7 @@ class Handle; // thread. class V8_EXPORT_PRIVATE CompilerDispatcher { public: - typedef uintptr_t JobId; + using JobId = uintptr_t; CompilerDispatcher(Isolate* isolate, Platform* platform, size_t max_stack_size); @@ -136,8 +136,8 @@ class V8_EXPORT_PRIVATE CompilerDispatcher { bool aborted; }; - typedef std::map> JobMap; - typedef IdentityMap SharedToJobIdMap; + using JobMap = std::map>; + using SharedToJobIdMap = IdentityMap; void WaitForJobIfRunningOnBackground(Job* job); JobMap::const_iterator GetJobFor(Handle shared) const; diff --git a/src/d8/async-hooks-wrapper.h b/src/d8/async-hooks-wrapper.h index 29e9be17a43d..f339b6e31632 100644 --- a/src/d8/async-hooks-wrapper.h +++ b/src/d8/async-hooks-wrapper.h @@ -12,7 +12,7 @@ namespace v8 { -typedef double async_id_t; +using async_id_t = double; struct AsyncContext { async_id_t execution_async_id; diff --git a/src/d8/d8.h b/src/d8/d8.h index eb4777e3f8ab..fb64b0369fac 100644 --- a/src/d8/d8.h +++ b/src/d8/d8.h @@ -57,7 +57,7 @@ class CounterCollection { Counter counters_[kMaxCounters]; }; -typedef std::unordered_map CounterMap; +using CounterMap = std::unordered_map; class SourceGroup { public: diff --git a/src/deoptimizer/deoptimizer.h b/src/deoptimizer/deoptimizer.h index 1f026c4a0f3d..67e3e544054a 100644 --- a/src/deoptimizer/deoptimizer.h +++ b/src/deoptimizer/deoptimizer.h @@ -219,8 +219,8 @@ class TranslatedFrame { int input_index_; }; - typedef TranslatedValue& reference; - typedef TranslatedValue const& const_reference; + using reference = TranslatedValue&; + using const_reference = TranslatedValue const&; iterator begin() { return iterator(values_.begin()); } iterator end() { return iterator(values_.end()); } @@ -278,7 +278,7 @@ class TranslatedFrame { int return_value_offset_; int return_value_count_; - typedef std::deque ValuesContainer; + using ValuesContainer = std::deque; ValuesContainer values_; }; @@ -308,11 +308,11 @@ class TranslatedState { // Store newly materialized values into the isolate. void StoreMaterializedValuesAndDeopt(JavaScriptFrame* frame); - typedef std::vector::iterator iterator; + using iterator = std::vector::iterator; iterator begin() { return frames_.begin(); } iterator end() { return frames_.end(); } - typedef std::vector::const_iterator const_iterator; + using const_iterator = std::vector::const_iterator; const_iterator begin() const { return frames_.begin(); } const_iterator end() const { return frames_.end(); } diff --git a/src/diagnostics/basic-block-profiler.cc b/src/diagnostics/basic-block-profiler.cc index 820f24b2d3f0..262a5364b5eb 100644 --- a/src/diagnostics/basic-block-profiler.cc +++ b/src/diagnostics/basic-block-profiler.cc @@ -78,7 +78,7 @@ void BasicBlockProfiler::ResetCounts() { std::ostream& operator<<(std::ostream& os, const BasicBlockProfiler& p) { os << "---- Start Profiling Data ----" << std::endl; - typedef BasicBlockProfiler::DataList::const_iterator iterator; + using iterator = BasicBlockProfiler::DataList::const_iterator; for (iterator i = p.data_list_.begin(); i != p.data_list_.end(); ++i) { os << **i; } diff --git a/src/diagnostics/basic-block-profiler.h b/src/diagnostics/basic-block-profiler.h index 07a1f780b1c9..960b4b43e116 100644 --- a/src/diagnostics/basic-block-profiler.h +++ b/src/diagnostics/basic-block-profiler.h @@ -49,7 +49,7 @@ class BasicBlockProfiler { DISALLOW_COPY_AND_ASSIGN(Data); }; - typedef std::list DataList; + using DataList = std::list; BasicBlockProfiler() = default; ~BasicBlockProfiler(); diff --git a/src/diagnostics/compilation-statistics.cc b/src/diagnostics/compilation-statistics.cc index 0590a2be9822..adedc3e283c6 100644 --- a/src/diagnostics/compilation-statistics.cc +++ b/src/diagnostics/compilation-statistics.cc @@ -113,16 +113,16 @@ std::ostream& operator<<(std::ostream& os, const AsPrintableStatistics& ps) { // pointers into them. const CompilationStatistics& s = ps.s; - typedef std::vector - SortedPhaseKinds; + using SortedPhaseKinds = + std::vector; SortedPhaseKinds sorted_phase_kinds(s.phase_kind_map_.size()); for (auto it = s.phase_kind_map_.begin(); it != s.phase_kind_map_.end(); ++it) { sorted_phase_kinds[it->second.insert_order_] = it; } - typedef std::vector - SortedPhases; + using SortedPhases = + std::vector; SortedPhases sorted_phases(s.phase_map_.size()); for (auto it = s.phase_map_.begin(); it != s.phase_map_.end(); ++it) { sorted_phases[it->second.insert_order_] = it; diff --git a/src/diagnostics/compilation-statistics.h b/src/diagnostics/compilation-statistics.h index 7022e242ed43..50bc88af9234 100644 --- a/src/diagnostics/compilation-statistics.h +++ b/src/diagnostics/compilation-statistics.h @@ -73,9 +73,9 @@ class CompilationStatistics final : public Malloced { friend std::ostream& operator<<(std::ostream& os, const AsPrintableStatistics& s); - typedef OrderedStats PhaseKindStats; - typedef std::map PhaseKindMap; - typedef std::map PhaseMap; + using PhaseKindStats = OrderedStats; + using PhaseKindMap = std::map; + using PhaseMap = std::map; TotalStats total_stats_; PhaseKindMap phase_kind_map_; diff --git a/src/diagnostics/disasm.h b/src/diagnostics/disasm.h index 9cc380ad2369..036691877c54 100644 --- a/src/diagnostics/disasm.h +++ b/src/diagnostics/disasm.h @@ -9,7 +9,7 @@ namespace disasm { -typedef unsigned char byte; +using byte = unsigned char; // Interface and default implementation for converting addresses and // register-numbers to text. The default implementation is machine diff --git a/src/diagnostics/gdb-jit.cc b/src/diagnostics/gdb-jit.cc index d7c9a74ca6aa..015e771660ab 100644 --- a/src/diagnostics/gdb-jit.cc +++ b/src/diagnostics/gdb-jit.cc @@ -31,14 +31,14 @@ namespace GDBJITInterface { #define __MACH_O class MachO; class MachOSection; -typedef MachO DebugObject; -typedef MachOSection DebugSection; +using DebugObject = MachO; +using DebugSection = MachOSection; #else #define __ELF class ELF; class ELFSection; -typedef ELF DebugObject; -typedef ELFSection DebugSection; +using DebugObject = ELF; +using DebugSection = ELFSection; #endif class Writer { @@ -183,7 +183,7 @@ class DebugSectionBase : public ZoneObject { virtual bool WriteBodyInternal(Writer* writer) { return false; } - typedef THeader Header; + using Header = THeader; }; struct MachOSectionHeader { @@ -1823,8 +1823,8 @@ struct AddressRange { }; struct SplayTreeConfig { - typedef AddressRange Key; - typedef JITCodeEntry* Value; + using Key = AddressRange; + using Value = JITCodeEntry*; static const AddressRange kNoKey; static Value NoValue() { return nullptr; } static int Compare(const AddressRange& a, const AddressRange& b) { @@ -1836,7 +1836,7 @@ struct SplayTreeConfig { }; const AddressRange SplayTreeConfig::kNoKey = {0, 0}; -typedef SplayTree CodeMap; +using CodeMap = SplayTree; static CodeMap* GetCodeMap() { static CodeMap* code_map = nullptr; diff --git a/src/execution/isolate.h b/src/execution/isolate.h index d34a5914fac7..1dc254d59553 100644 --- a/src/execution/isolate.h +++ b/src/execution/isolate.h @@ -1755,7 +1755,7 @@ class Isolate final : private HiddenFactory { CompilerDispatcher* compiler_dispatcher_ = nullptr; - typedef std::pair InterruptEntry; + using InterruptEntry = std::pair; std::queue api_interrupts_queue_; #define GLOBAL_BACKING_STORE(type, name, initialvalue) type name##_; diff --git a/src/extensions/externalize-string-extension.cc b/src/extensions/externalize-string-extension.cc index 74670dae3a93..00a946b6ff91 100644 --- a/src/extensions/externalize-string-extension.cc +++ b/src/extensions/externalize-string-extension.cc @@ -31,11 +31,10 @@ class SimpleStringResource : public Base { const size_t length_; }; - -typedef SimpleStringResource - SimpleOneByteStringResource; -typedef SimpleStringResource - SimpleTwoByteStringResource; +using SimpleOneByteStringResource = + SimpleStringResource; +using SimpleTwoByteStringResource = + SimpleStringResource; const char* const ExternalizeStringExtension::kSource = "native function externalizeString();" diff --git a/src/handles/global-handles.cc b/src/handles/global-handles.cc index f8dc7e7c0948..db4f806e5815 100644 --- a/src/handles/global-handles.cc +++ b/src/handles/global-handles.cc @@ -763,7 +763,7 @@ void GlobalHandles::SetFinalizationCallbackForTraced( callback); } -typedef v8::WeakCallbackInfo::Callback GenericCallback; +using GenericCallback = v8::WeakCallbackInfo::Callback; void GlobalHandles::MakeWeak(Address* location, void* parameter, GenericCallback phantom_callback, diff --git a/src/handles/global-handles.h b/src/handles/global-handles.h index 245e9e78e137..a08bc1fd13c7 100644 --- a/src/handles/global-handles.h +++ b/src/handles/global-handles.h @@ -241,7 +241,7 @@ class V8_EXPORT_PRIVATE GlobalHandles final { class GlobalHandles::PendingPhantomCallback final { public: - typedef v8::WeakCallbackInfo Data; + using Data = v8::WeakCallbackInfo; enum InvocationType { kFirstPass, kSecondPass }; diff --git a/src/ia32/macro-assembler-ia32.h b/src/ia32/macro-assembler-ia32.h index 6b881f029e11..77d8637d94ec 100644 --- a/src/ia32/macro-assembler-ia32.h +++ b/src/ia32/macro-assembler-ia32.h @@ -19,7 +19,7 @@ namespace internal { // Convenience for platform-independent signatures. We do not normally // distinguish memory operands from other operands on ia32. -typedef Operand MemOperand; +using MemOperand = Operand; enum RememberedSetAction { EMIT_REMEMBERED_SET, OMIT_REMEMBERED_SET }; enum SmiCheck { INLINE_SMI_CHECK, OMIT_SMI_CHECK }; diff --git a/src/ia32/register-ia32.h b/src/ia32/register-ia32.h index a17acc447649..7e04c798178d 100644 --- a/src/ia32/register-ia32.h +++ b/src/ia32/register-ia32.h @@ -92,11 +92,11 @@ class XMMRegister : public RegisterBase { explicit constexpr XMMRegister(int code) : RegisterBase(code) {} }; -typedef XMMRegister FloatRegister; +using FloatRegister = XMMRegister; -typedef XMMRegister DoubleRegister; +using DoubleRegister = XMMRegister; -typedef XMMRegister Simd128Register; +using Simd128Register = XMMRegister; #define DEFINE_REGISTER(R) \ constexpr DoubleRegister R = DoubleRegister::from_code(); diff --git a/src/init/bootstrapper.h b/src/init/bootstrapper.h index 43dcd6ae8774..35295c3e88bb 100644 --- a/src/init/bootstrapper.h +++ b/src/init/bootstrapper.h @@ -97,7 +97,7 @@ class Bootstrapper final { void LogAllMaps(); Isolate* isolate_; - typedef int NestingCounterType; + using NestingCounterType = int; NestingCounterType nesting_; SourceCodeCache extensions_cache_; diff --git a/src/inspector/v8-profiler-agent-impl.cc b/src/inspector/v8-profiler-agent-impl.cc index b825397b4dee..15f93e39d72f 100644 --- a/src/inspector/v8-profiler-agent-impl.cc +++ b/src/inspector/v8-profiler-agent-impl.cc @@ -303,8 +303,8 @@ Response V8ProfilerAgentImpl::startPreciseCoverage(Maybe callCount, // coverage data if it exists (at the time of writing, that's the case for // each function recompiled after the BlockCount mode has been set); and // function-granularity coverage data otherwise. - typedef v8::debug::Coverage C; - typedef v8::debug::CoverageMode Mode; + using C = v8::debug::Coverage; + using Mode = v8::debug::CoverageMode; Mode mode = callCountValue ? (detailedValue ? Mode::kBlockCount : Mode::kPreciseCount) : (detailedValue ? Mode::kBlockBinary : Mode::kPreciseBinary); diff --git a/src/libplatform/tracing/perfetto-producer.h b/src/libplatform/tracing/perfetto-producer.h index 151f6b512560..2a363e8bf892 100644 --- a/src/libplatform/tracing/perfetto-producer.h +++ b/src/libplatform/tracing/perfetto-producer.h @@ -20,7 +20,7 @@ class PerfettoTracingController; class PerfettoProducer final : public ::perfetto::Producer { public: - typedef ::perfetto::TracingService::ProducerEndpoint ServiceEndpoint; + using ServiceEndpoint = ::perfetto::TracingService::ProducerEndpoint; explicit PerfettoProducer(PerfettoTracingController* tracing_controller); diff --git a/src/libsampler/sampler.cc b/src/libsampler/sampler.cc index 715593dcdfeb..cdd7ce158c4f 100644 --- a/src/libsampler/sampler.cc +++ b/src/libsampler/sampler.cc @@ -46,9 +46,9 @@ zx_status_t zx_thread_read_state(zx_handle_t h, uint32_t k, void* b, size_t l) { &dummy_out_len); } #if defined(__x86_64__) -typedef zx_x86_64_general_regs_t zx_thread_state_general_regs_t; +using zx_thread_state_general_regs_t = zx_x86_64_general_regs_t; #else -typedef zx_arm64_general_regs_t zx_thread_state_general_regs_t; +using zx_thread_state_general_regs_t = zx_arm64_general_regs_t; #endif #endif // !defined(ZX_THREAD_STATE_GENERAL_REGS) @@ -71,7 +71,7 @@ typedef zx_arm64_general_regs_t zx_thread_state_general_regs_t; #if defined(__arm__) -typedef struct sigcontext mcontext_t; +using mcontext_t = struct sigcontext; typedef struct ucontext { uint32_t uc_flags; @@ -83,7 +83,7 @@ typedef struct ucontext { #elif defined(__aarch64__) -typedef struct sigcontext mcontext_t; +using mcontext_t = struct sigcontext; typedef struct ucontext { uint64_t uc_flags; diff --git a/src/libsampler/sampler.h b/src/libsampler/sampler.h index 2b4f6e888340..997b12768609 100644 --- a/src/libsampler/sampler.h +++ b/src/libsampler/sampler.h @@ -92,7 +92,7 @@ class V8_EXPORT_PRIVATE Sampler { #ifdef USE_SIGNALS -typedef std::atomic_bool AtomicMutex; +using AtomicMutex = std::atomic_bool; // A helper that uses an std::atomic_bool to create a lock that is obtained on // construction and released on destruction. @@ -120,7 +120,7 @@ class V8_EXPORT_PRIVATE AtomicGuard { // take a sample for every Sampler on the current thread. class V8_EXPORT_PRIVATE SamplerManager { public: - typedef std::vector SamplerList; + using SamplerList = std::vector; // Add |sampler| to the map if it is not already present. void AddSampler(Sampler* sampler); diff --git a/src/mips/constants-mips.h b/src/mips/constants-mips.h index fa77bf61abae..5909144f0587 100644 --- a/src/mips/constants-mips.h +++ b/src/mips/constants-mips.h @@ -290,7 +290,7 @@ class MSARegisters { // Instructions encoding constants. // On MIPS all instructions are 32 bits. -typedef int32_t Instr; +using Instr = int32_t; // Special Software Interrupt codes when used in the presence of the MIPS // simulator. diff --git a/src/mips/register-mips.h b/src/mips/register-mips.h index 982ad0ff0a66..f8f175b83a47 100644 --- a/src/mips/register-mips.h +++ b/src/mips/register-mips.h @@ -260,9 +260,9 @@ class MSARegister : public RegisterBase { // but it is not in common use. Someday we will want to support this in v8.) // For O32 ABI, Floats and Doubles refer to same set of 32 32-bit registers. -typedef FPURegister FloatRegister; +using FloatRegister = FPURegister; -typedef FPURegister DoubleRegister; +using DoubleRegister = FPURegister; #define DECLARE_DOUBLE_REGISTER(R) \ constexpr DoubleRegister R = DoubleRegister::from_code(); @@ -272,7 +272,7 @@ DOUBLE_REGISTERS(DECLARE_DOUBLE_REGISTER) constexpr DoubleRegister no_dreg = DoubleRegister::no_reg(); // SIMD registers. -typedef MSARegister Simd128Register; +using Simd128Register = MSARegister; #define DECLARE_SIMD128_REGISTER(R) \ constexpr Simd128Register R = Simd128Register::from_code(); diff --git a/src/mips/simulator-mips.cc b/src/mips/simulator-mips.cc index d3fda52d31db..1b8f715a1c0a 100644 --- a/src/mips/simulator-mips.cc +++ b/src/mips/simulator-mips.cc @@ -4754,7 +4754,7 @@ void Simulator::DecodeTypeMsaELM() { template T Simulator::MsaBitInstrHelper(uint32_t opcode, T wd, T ws, int32_t m) { - typedef typename std::make_unsigned::type uT; + using uT = typename std::make_unsigned::type; T res; switch (opcode) { case SLLI: @@ -4947,7 +4947,7 @@ void Simulator::DecodeTypeMsaMI10() { template T Simulator::Msa3RInstrHelper(uint32_t opcode, T wd, T ws, T wt) { - typedef typename std::make_unsigned::type uT; + using uT = typename std::make_unsigned::type; T res; T wt_modulo = wt % (sizeof(T) * 8); switch (opcode) { @@ -5228,8 +5228,8 @@ template void Msa3RInstrHelper_horizontal(const uint32_t opcode, T_reg ws, T_reg wt, T_reg wd, const int i, const int num_of_lanes) { - typedef typename std::make_unsigned::type T_uint; - typedef typename std::make_unsigned::type T_smaller_uint; + using T_uint = typename std::make_unsigned::type; + using T_smaller_uint = typename std::make_unsigned::type; T_int* wd_p; T_smaller_int *ws_p, *wt_p; ws_p = reinterpret_cast(ws); @@ -5522,8 +5522,8 @@ void Msa3RFInstrHelper(uint32_t opcode, T_reg ws, T_reg wt, T_reg& wd) { template void Msa3RFInstrHelper2(uint32_t opcode, T_reg ws, T_reg wt, T_reg& wd) { - // typedef typename std::make_unsigned::type T_uint; - typedef typename std::make_unsigned::type T_uint_dbl; + // using T_uint = typename std::make_unsigned::type; + using T_uint_dbl = typename std::make_unsigned::type; const T_int max_int = std::numeric_limits::max(); const T_int min_int = std::numeric_limits::min(); const int shift = kBitsPerByte * sizeof(T_int) - 1; @@ -5968,7 +5968,7 @@ static inline bool isSnan(double fp) { return !QUIET_BIT_D(fp); } template T_int Msa2RFInstrHelper(uint32_t opcode, T_src src, T_dst& dst, Simulator* sim) { - typedef typename std::make_unsigned::type T_uint; + using T_uint = typename std::make_unsigned::type; switch (opcode) { case FCLASS: { #define SNAN_BIT BIT(0) @@ -6153,7 +6153,7 @@ T_int Msa2RFInstrHelper(uint32_t opcode, T_src src, T_dst& dst, dst = bit_cast(static_cast(src)); break; case FFINT_U: - typedef typename std::make_unsigned::type uT_src; + using uT_src = typename std::make_unsigned::type; dst = bit_cast(static_cast(bit_cast(src))); break; default: diff --git a/src/mips64/constants-mips64.h b/src/mips64/constants-mips64.h index 3254dde57d6f..6512af9732ce 100644 --- a/src/mips64/constants-mips64.h +++ b/src/mips64/constants-mips64.h @@ -253,7 +253,7 @@ class MSARegisters { // Instructions encoding constants. // On MIPS all instructions are 32 bits. -typedef int32_t Instr; +using Instr = int32_t; // Special Software Interrupt codes when used in the presence of the MIPS // simulator. diff --git a/src/mips64/register-mips64.h b/src/mips64/register-mips64.h index a5ef748a7267..885a3dc76752 100644 --- a/src/mips64/register-mips64.h +++ b/src/mips64/register-mips64.h @@ -266,9 +266,9 @@ class MSARegister : public RegisterBase { // but it is not in common use. Someday we will want to support this in v8.) // For O32 ABI, Floats and Doubles refer to same set of 32 32-bit registers. -typedef FPURegister FloatRegister; +using FloatRegister = FPURegister; -typedef FPURegister DoubleRegister; +using DoubleRegister = FPURegister; #define DECLARE_DOUBLE_REGISTER(R) \ constexpr DoubleRegister R = DoubleRegister::from_code(); @@ -278,7 +278,7 @@ DOUBLE_REGISTERS(DECLARE_DOUBLE_REGISTER) constexpr DoubleRegister no_dreg = DoubleRegister::no_reg(); // SIMD registers. -typedef MSARegister Simd128Register; +using Simd128Register = MSARegister; #define DECLARE_SIMD128_REGISTER(R) \ constexpr Simd128Register R = Simd128Register::from_code(); diff --git a/src/mips64/simulator-mips64.cc b/src/mips64/simulator-mips64.cc index 76adcb402dfc..2890db55fdf6 100644 --- a/src/mips64/simulator-mips64.cc +++ b/src/mips64/simulator-mips64.cc @@ -5009,7 +5009,7 @@ void Simulator::DecodeTypeMsaELM() { template T Simulator::MsaBitInstrHelper(uint32_t opcode, T wd, T ws, int32_t m) { - typedef typename std::make_unsigned::type uT; + using uT = typename std::make_unsigned::type; T res; switch (opcode) { case SLLI: @@ -5202,7 +5202,7 @@ void Simulator::DecodeTypeMsaMI10() { template T Simulator::Msa3RInstrHelper(uint32_t opcode, T wd, T ws, T wt) { - typedef typename std::make_unsigned::type uT; + using uT = typename std::make_unsigned::type; T res; int wt_modulo = wt % (sizeof(T) * 8); switch (opcode) { @@ -5482,8 +5482,8 @@ template void Msa3RInstrHelper_horizontal(const uint32_t opcode, T_reg ws, T_reg wt, T_reg wd, const int i, const int num_of_lanes) { - typedef typename std::make_unsigned::type T_uint; - typedef typename std::make_unsigned::type T_smaller_uint; + using T_uint = typename std::make_unsigned::type; + using T_smaller_uint = typename std::make_unsigned::type; T_int* wd_p; T_smaller_int *ws_p, *wt_p; ws_p = reinterpret_cast(ws); @@ -5776,8 +5776,8 @@ void Msa3RFInstrHelper(uint32_t opcode, T_reg ws, T_reg wt, T_reg& wd) { template void Msa3RFInstrHelper2(uint32_t opcode, T_reg ws, T_reg wt, T_reg& wd) { - // typedef typename std::make_unsigned::type T_uint; - typedef typename std::make_unsigned::type T_uint_dbl; + // using T_uint = typename std::make_unsigned::type; + using T_uint_dbl = typename std::make_unsigned::type; const T_int max_int = std::numeric_limits::max(); const T_int min_int = std::numeric_limits::min(); const int shift = kBitsPerByte * sizeof(T_int) - 1; @@ -6229,7 +6229,7 @@ static inline bool isSnan(double fp) { return !QUIET_BIT_D(fp); } template T_int Msa2RFInstrHelper(uint32_t opcode, T_src src, T_dst& dst, Simulator* sim) { - typedef typename std::make_unsigned::type T_uint; + using T_uint = typename std::make_unsigned::type; switch (opcode) { case FCLASS: { #define SNAN_BIT BIT(0) @@ -6414,7 +6414,7 @@ T_int Msa2RFInstrHelper(uint32_t opcode, T_src src, T_dst& dst, dst = bit_cast(static_cast(src)); break; case FFINT_U: - typedef typename std::make_unsigned::type uT_src; + using uT_src = typename std::make_unsigned::type; dst = bit_cast(static_cast(bit_cast(src))); break; default: diff --git a/src/numbers/bignum.h b/src/numbers/bignum.h index 09f6297847ee..fdcd176c4ef7 100644 --- a/src/numbers/bignum.h +++ b/src/numbers/bignum.h @@ -73,8 +73,8 @@ class V8_EXPORT_PRIVATE Bignum { } private: - typedef uint32_t Chunk; - typedef uint64_t DoubleChunk; + using Chunk = uint32_t; + using DoubleChunk = uint64_t; static const int kChunkSize = sizeof(Chunk) * 8; static const int kDoubleChunkSize = sizeof(DoubleChunk) * 8; diff --git a/src/objects/contexts.h b/src/objects/contexts.h index cef4da51b823..d83e35155085 100644 --- a/src/objects/contexts.h +++ b/src/objects/contexts.h @@ -656,7 +656,7 @@ class Context : public HeapObject { DECL_PRINTER(Context) DECL_VERIFIER(Context) - typedef FlexibleBodyDescriptor BodyDescriptor; + using BodyDescriptor = FlexibleBodyDescriptor; private: #ifdef DEBUG @@ -710,7 +710,7 @@ class NativeContext : public Context { OBJECT_CONSTRUCTORS(NativeContext, Context); }; -typedef Context::Field ContextField; +using ContextField = Context::Field; } // namespace internal } // namespace v8 diff --git a/src/objects/elements.cc b/src/objects/elements.cc index f2a599800542..204dbcaddfdb 100644 --- a/src/objects/elements.cc +++ b/src/objects/elements.cc @@ -116,7 +116,7 @@ enum Where { AT_START, AT_END }; template class ElementsKindTraits { public: - typedef FixedArrayBase BackingStore; + using BackingStore = FixedArrayBase; }; #define ELEMENTS_TRAITS(Class, KindParam, Store) \ @@ -124,7 +124,7 @@ class ElementsKindTraits { class ElementsKindTraits { \ public: /* NOLINT */ \ static constexpr ElementsKind Kind = KindParam; \ - typedef Store BackingStore; \ + using BackingStore = Store; \ }; \ constexpr ElementsKind ElementsKindTraits::Kind; ELEMENTS_LIST(ELEMENTS_TRAITS) @@ -570,8 +570,8 @@ class ElementsAccessorBase : public InternalElementsAccessor { public: ElementsAccessorBase() = default; - typedef ElementsTraitsParam ElementsTraits; - typedef typename ElementsTraitsParam::BackingStore BackingStore; + using ElementsTraits = ElementsTraitsParam; + using BackingStore = typename ElementsTraitsParam::BackingStore; static ElementsKind kind() { return ElementsTraits::Kind; } @@ -1888,7 +1888,7 @@ class DictionaryElementsAccessor template class FastElementsAccessor : public ElementsAccessorBase { public: - typedef typename KindTraits::BackingStore BackingStore; + using BackingStore = typename KindTraits::BackingStore; static Handle NormalizeImpl(Handle object, Handle store) { @@ -2605,7 +2605,7 @@ template class FastSealedObjectElementsAccessor : public FastSmiOrObjectElementsAccessor { public: - typedef typename KindTraits::BackingStore BackingStore; + using BackingStore = typename KindTraits::BackingStore; static Handle RemoveElement(Handle receiver, Where remove_position) { @@ -2699,7 +2699,7 @@ template class FastFrozenObjectElementsAccessor : public FastSmiOrObjectElementsAccessor { public: - typedef typename KindTraits::BackingStore BackingStore; + using BackingStore = typename KindTraits::BackingStore; static inline void SetImpl(Handle holder, uint32_t entry, Object value) { @@ -2910,8 +2910,8 @@ class TypedElementsAccessor : public ElementsAccessorBase, ElementsKindTraits> { public: - typedef typename ElementsKindTraits::BackingStore BackingStore; - typedef TypedElementsAccessor AccessorClass; + using BackingStore = typename ElementsKindTraits::BackingStore; + using AccessorClass = TypedElementsAccessor; static inline void SetImpl(Handle holder, uint32_t entry, Object value) { @@ -3587,8 +3587,8 @@ class TypedElementsAccessor }; #define FIXED_ELEMENTS_ACCESSOR(Type, type, TYPE, ctype) \ - typedef TypedElementsAccessor \ - Fixed##Type##ElementsAccessor; + using Fixed##Type##ElementsAccessor = \ + TypedElementsAccessor; TYPED_ARRAYS(FIXED_ELEMENTS_ACCESSOR) #undef FIXED_ELEMENTS_ACCESSOR diff --git a/src/objects/feedback-vector.h b/src/objects/feedback-vector.h index 088bd85aa4b4..89e0b9e6aaee 100644 --- a/src/objects/feedback-vector.h +++ b/src/objects/feedback-vector.h @@ -141,7 +141,7 @@ inline LanguageMode GetLanguageModeFromSlotKind(FeedbackSlotKind kind) { V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, FeedbackSlotKind kind); -typedef std::vector MaybeObjectHandles; +using MaybeObjectHandles = std::vector; class FeedbackMetadata; @@ -552,9 +552,9 @@ class FeedbackMetadata : public HeapObject { void SetKind(FeedbackSlot slot, FeedbackSlotKind kind); - typedef BitSetComputer - VectorICComputer; + using VectorICComputer = + BitSetComputer; OBJECT_CONSTRUCTORS(FeedbackMetadata, HeapObject); }; @@ -697,8 +697,8 @@ class V8_EXPORT_PRIVATE FeedbackNexus final { // count (taken from the type feedback vector). float ComputeCallFrequency(); - typedef BitField SpeculationModeField; - typedef BitField CallCountField; + using SpeculationModeField = BitField; + using CallCountField = BitField; // For InstanceOf ICs. MaybeHandle GetConstructorFeedback() const; diff --git a/src/objects/objects-body-descriptors.h b/src/objects/objects-body-descriptors.h index e880c44b8fca..728708f436d2 100644 --- a/src/objects/objects-body-descriptors.h +++ b/src/objects/objects-body-descriptors.h @@ -123,7 +123,7 @@ class FlexibleBodyDescriptor final : public BodyDescriptorBase { static inline int SizeOf(Map map, HeapObject object); }; -typedef FlexibleBodyDescriptor StructBodyDescriptor; +using StructBodyDescriptor = FlexibleBodyDescriptor; template class FlexibleWeakBodyDescriptor final : public BodyDescriptorBase { diff --git a/src/objects/objects.cc b/src/objects/objects.cc index 2a9078db2394..f2aa5fca5fab 100644 --- a/src/objects/objects.cc +++ b/src/objects/objects.cc @@ -2847,7 +2847,7 @@ static int AppendUniqueCallbacks(Isolate* isolate, } struct FixedArrayAppender { - typedef FixedArray Array; + using Array = FixedArray; static bool Contains(Handle key, Handle entry, int valid_descriptors, Handle array) { for (int i = 0; i < valid_descriptors; i++) { diff --git a/src/ppc/constants-ppc.h b/src/ppc/constants-ppc.h index ffa7e12bad6d..dc1b70d5c091 100644 --- a/src/ppc/constants-ppc.h +++ b/src/ppc/constants-ppc.h @@ -128,7 +128,7 @@ inline Condition NegateCondition(Condition cond) { // representing instructions from usual 32 bit values. // Instruction objects are pointers to 32bit values, and provide methods to // access the various ISA fields. -typedef uint32_t Instr; +using Instr = uint32_t; #define PPC_XX3_OPCODE_LIST(V) \ /* VSX Scalar Add Double-Precision */ \ diff --git a/src/ppc/register-ppc.h b/src/ppc/register-ppc.h index e1a8eb09c0ac..4f2e3a74922f 100644 --- a/src/ppc/register-ppc.h +++ b/src/ppc/register-ppc.h @@ -249,10 +249,10 @@ ASSERT_TRIVIALLY_COPYABLE(DoubleRegister); static_assert(sizeof(DoubleRegister) == sizeof(int), "DoubleRegister can efficiently be passed by value"); -typedef DoubleRegister FloatRegister; +using FloatRegister = DoubleRegister; // TODO(ppc) Define SIMD registers. -typedef DoubleRegister Simd128Register; +using Simd128Register = DoubleRegister; #define DEFINE_REGISTER(R) \ constexpr DoubleRegister R = DoubleRegister::from_code(); diff --git a/src/profiler/allocation-tracker.h b/src/profiler/allocation-tracker.h index 4163e919a2a3..e67994ca19ef 100644 --- a/src/profiler/allocation-tracker.h +++ b/src/profiler/allocation-tracker.h @@ -87,7 +87,7 @@ class V8_EXPORT_PRIVATE AddressToTraceMap { unsigned trace_node_id; }; // [start, end) -> trace - typedef std::map RangeMap; + using RangeMap = std::map; void RemoveRange(Address start, Address end); diff --git a/src/profiler/cpu-profiler.h b/src/profiler/cpu-profiler.h index 25d67eb7e692..96d53356e67c 100644 --- a/src/profiler/cpu-profiler.h +++ b/src/profiler/cpu-profiler.h @@ -253,8 +253,8 @@ class V8_EXPORT_PRIVATE CpuProfiler { static void CollectSample(Isolate* isolate); - typedef v8::CpuProfilingMode ProfilingMode; - typedef v8::CpuProfilingNamingMode NamingMode; + using ProfilingMode = v8::CpuProfilingMode; + using NamingMode = v8::CpuProfilingNamingMode; base::TimeDelta sampling_interval() const { return base_sampling_interval_; } void set_sampling_interval(base::TimeDelta value); diff --git a/src/profiler/heap-snapshot-generator.cc b/src/profiler/heap-snapshot-generator.cc index 5f01abd6ecd9..bc171360b53e 100644 --- a/src/profiler/heap-snapshot-generator.cc +++ b/src/profiler/heap-snapshot-generator.cc @@ -2204,11 +2204,11 @@ namespace { template struct ToUnsigned; template<> struct ToUnsigned<4> { - typedef uint32_t Type; + using Type = uint32_t; }; template<> struct ToUnsigned<8> { - typedef uint64_t Type; + using Type = uint64_t; }; } // namespace diff --git a/src/profiler/heap-snapshot-generator.h b/src/profiler/heap-snapshot-generator.h index a1ec001fec73..756500151f00 100644 --- a/src/profiler/heap-snapshot-generator.h +++ b/src/profiler/heap-snapshot-generator.h @@ -294,7 +294,7 @@ class HeapObjectsMap { // A typedef for referencing anything that can be snapshotted living // in any kind of heap memory. -typedef void* HeapThing; +using HeapThing = void*; // An interface that creates HeapEntries by HeapThings. class HeapEntriesAllocator { diff --git a/src/profiler/profile-generator.h b/src/profiler/profile-generator.h index 8388ce162b67..b0543c9d7944 100644 --- a/src/profiler/profile-generator.h +++ b/src/profiler/profile-generator.h @@ -234,7 +234,7 @@ struct CodeEntryAndLineNumber { int line_number; }; -typedef std::vector ProfileStackTrace; +using ProfileStackTrace = std::vector; class ProfileTree; @@ -311,7 +311,7 @@ class V8_EXPORT_PRIVATE ProfileTree { explicit ProfileTree(Isolate* isolate); ~ProfileTree(); - typedef v8::CpuProfilingMode ProfilingMode; + using ProfilingMode = v8::CpuProfilingMode; ProfileNode* AddPathFromEnd( const std::vector& path, diff --git a/src/profiler/sampling-heap-profiler.h b/src/profiler/sampling-heap-profiler.h index 8a583d4f1036..71ccf4caa8f5 100644 --- a/src/profiler/sampling-heap-profiler.h +++ b/src/profiler/sampling-heap-profiler.h @@ -49,7 +49,7 @@ class SamplingHeapProfiler { public: class AllocationNode { public: - typedef uint64_t FunctionId; + using FunctionId = uint64_t; AllocationNode(AllocationNode* parent, const char* name, int script_id, int start_position, uint32_t id) : parent_(parent), diff --git a/src/roots/roots-inl.h b/src/roots/roots-inl.h index 0e59365373f8..c78fbe30f900 100644 --- a/src/roots/roots-inl.h +++ b/src/roots/roots-inl.h @@ -27,12 +27,12 @@ namespace v8 { namespace internal { V8_INLINE constexpr bool operator<(RootIndex lhs, RootIndex rhs) { - typedef typename std::underlying_type::type type; + using type = typename std::underlying_type::type; return static_cast(lhs) < static_cast(rhs); } V8_INLINE RootIndex operator++(RootIndex& index) { - typedef typename std::underlying_type::type type; + using type = typename std::underlying_type::type; index = static_cast(static_cast(index) + 1); return index; } diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc index 8e6787ecea31..0c170477955e 100644 --- a/src/runtime/runtime-classes.cc +++ b/src/runtime/runtime-classes.cc @@ -400,8 +400,8 @@ bool AddDescriptorsByTemplate( Handle elements_dictionary = ShallowCopyDictionaryTemplate(isolate, elements_dictionary_template); - typedef ClassBoilerplate::ValueKind ValueKind; - typedef ClassBoilerplate::ComputedEntryFlags ComputedEntryFlags; + using ValueKind = ClassBoilerplate::ValueKind; + using ComputedEntryFlags = ClassBoilerplate::ComputedEntryFlags; // Merge computed properties with properties and elements dictionary // templates. diff --git a/src/runtime/runtime-utils.h b/src/runtime/runtime-utils.h index 47e78031278e..2d6fbc585ffe 100644 --- a/src/runtime/runtime-utils.h +++ b/src/runtime/runtime-utils.h @@ -121,7 +121,7 @@ static inline ObjectPair MakePair(Object x, Object y) { return result; } #else -typedef uint64_t ObjectPair; +using ObjectPair = uint64_t; static inline ObjectPair MakePair(Object x, Object y) { #if defined(V8_TARGET_LITTLE_ENDIAN) return x.ptr() | (static_cast(y.ptr()) << 32); diff --git a/src/s390/assembler-s390.h b/src/s390/assembler-s390.h index 1b571c2373ca..8cfb30326a3a 100644 --- a/src/s390/assembler-s390.h +++ b/src/s390/assembler-s390.h @@ -160,7 +160,7 @@ class V8_EXPORT_PRIVATE Operand { friend class MacroAssembler; }; -typedef int32_t Disp; +using Disp = int32_t; // Class MemOperand represents a memory operand in load and store instructions // On S390, we have various flavours of memory operands: diff --git a/src/s390/constants-s390.h b/src/s390/constants-s390.h index fddd1251cb15..3e329229081c 100644 --- a/src/s390/constants-s390.h +++ b/src/s390/constants-s390.h @@ -147,10 +147,10 @@ inline Condition NegateCondition(Condition cond) { // representing instructions from usual 32 bit values. // Instruction objects are pointers to 32bit values, and provide methods to // access the various ISA fields. -typedef int32_t Instr; -typedef uint16_t TwoByteInstr; -typedef uint32_t FourByteInstr; -typedef uint64_t SixByteInstr; +using Instr = int32_t; +using TwoByteInstr = uint16_t; +using FourByteInstr = uint32_t; +using SixByteInstr = uint64_t; #define S390_RSY_A_OPCODE_LIST(V) \ V(lmg, LMG, 0xEB04) /* type = RSY_A LOAD MULTIPLE (64) */ \ diff --git a/src/s390/register-s390.h b/src/s390/register-s390.h index dba642db3059..a87d2230146b 100644 --- a/src/s390/register-s390.h +++ b/src/s390/register-s390.h @@ -210,10 +210,10 @@ ASSERT_TRIVIALLY_COPYABLE(DoubleRegister); static_assert(sizeof(DoubleRegister) == sizeof(int), "DoubleRegister can efficiently be passed by value"); -typedef DoubleRegister FloatRegister; +using FloatRegister = DoubleRegister; // TODO(john.yan) Define SIMD registers. -typedef DoubleRegister Simd128Register; +using Simd128Register = DoubleRegister; #define DEFINE_REGISTER(R) \ constexpr DoubleRegister R = DoubleRegister::from_code(); diff --git a/src/strings/string-builder-inl.h b/src/strings/string-builder-inl.h index aa442b184641..88d69b37b51b 100644 --- a/src/strings/string-builder-inl.h +++ b/src/strings/string-builder-inl.h @@ -20,11 +20,11 @@ namespace internal { const int kStringBuilderConcatHelperLengthBits = 11; const int kStringBuilderConcatHelperPositionBits = 19; -typedef BitField - StringBuilderSubstringLength; -typedef BitField - StringBuilderSubstringPosition; +using StringBuilderSubstringLength = + BitField; +using StringBuilderSubstringPosition = + BitField; template void StringBuilderConcatHelper(String special, sinkchar* sink, diff --git a/src/strings/string-stream.h b/src/strings/string-stream.h index d2bd2cfb3e76..d7b616c6ff76 100644 --- a/src/strings/string-stream.h +++ b/src/strings/string-stream.h @@ -58,7 +58,7 @@ class FixedStringAllocator final : public StringAllocator { template class SmallStringOptimizedAllocator final : public StringAllocator { public: - typedef base::SmallVector SmallVector; + using SmallVector = base::SmallVector; explicit SmallStringOptimizedAllocator(SmallVector* vector) V8_NOEXCEPT : vector_(vector) {} diff --git a/src/strings/unicode.cc b/src/strings/unicode.cc index 0c895aa8d011..21faccd0b424 100644 --- a/src/strings/unicode.cc +++ b/src/strings/unicode.cc @@ -27,9 +27,9 @@ static const uchar kSentinel = static_cast(-1); * Implementations of functions for working with Unicode. */ -typedef signed short int16_t; // NOLINT -typedef unsigned short uint16_t; // NOLINT -typedef int int32_t; // NOLINT +using int16_t = signed short; // NOLINT +using uint16_t = unsigned short; // NOLINT +using int32_t = int; // NOLINT #ifndef V8_INTL_SUPPORT // All access to the character table should go through this function. diff --git a/src/strings/unicode.h b/src/strings/unicode.h index d3d4bb692a70..bd94300e349c 100644 --- a/src/strings/unicode.h +++ b/src/strings/unicode.h @@ -16,8 +16,8 @@ namespace unibrow { -typedef unsigned int uchar; -typedef unsigned char byte; +using uchar = unsigned int; +using byte = unsigned char; /** * The max length of the result of converting the case of a single @@ -179,7 +179,7 @@ class V8_EXPORT_PRIVATE Utf8 { static const unsigned kMax16BitCodeUnitSize = 3; static inline uchar ValueOf(const byte* str, size_t length, size_t* cursor); - typedef uint32_t Utf8IncrementalBuffer; + using Utf8IncrementalBuffer = uint32_t; static inline uchar ValueOfIncremental(const byte** cursor, State* state, Utf8IncrementalBuffer* buffer); static uchar ValueOfIncrementalFinish(State* state); diff --git a/src/third_party/vtune/ittnotify_config.h b/src/third_party/vtune/ittnotify_config.h index 412e344628e2..9095107cb3dc 100644 --- a/src/third_party/vtune/ittnotify_config.h +++ b/src/third_party/vtune/ittnotify_config.h @@ -210,9 +210,9 @@ /* OS communication functions */ #if ITT_PLATFORM==ITT_PLATFORM_WIN #include -typedef HMODULE lib_t; -typedef DWORD TIDT; -typedef CRITICAL_SECTION mutex_t; +using lib_t = HMODULE; +using TIDT = DWORD; +using mutex_t = CRITICAL_SECTION; #define MUTEX_INITIALIZER { 0 } #define strong_alias(name, aliasname) /* empty for Windows */ #else /* ITT_PLATFORM==ITT_PLATFORM_WIN */ @@ -225,8 +225,8 @@ typedef CRITICAL_SECTION mutex_t; #endif /* _GNU_SOURCE */ #include typedef void* lib_t; -typedef pthread_t TIDT; -typedef pthread_mutex_t mutex_t; +using TIDT = pthread_t; +using mutex_t = pthread_mutex_t; #define MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER #define _strong_alias(name, aliasname) extern __typeof (name) aliasname __attribute__ ((alias (#name))); #define strong_alias(name, aliasname) _strong_alias(name, aliasname) diff --git a/src/torque/ast.h b/src/torque/ast.h index 1801846a6530..f26e9b2326e9 100644 --- a/src/torque/ast.h +++ b/src/torque/ast.h @@ -739,7 +739,7 @@ struct LabelAndTypes { std::vector types; }; -typedef std::vector LabelAndTypesVector; +using LabelAndTypesVector = std::vector; struct CallableNodeSignature { ParameterList parameters; diff --git a/src/torque/implementation-visitor.h b/src/torque/implementation-visitor.h index 2d0fec78d061..f2981e520c09 100644 --- a/src/torque/implementation-visitor.h +++ b/src/torque/implementation-visitor.h @@ -529,7 +529,7 @@ class ImplementationVisitor { void GenerateBranch(const VisitResult& condition, Block* true_block, Block* false_block); - typedef std::function VisitResultGenerator; + using VisitResultGenerator = std::function; void GenerateExpressionBranch(VisitResultGenerator, Block* true_block, Block* false_block); void GenerateExpressionBranch(Expression* expression, Block* true_block, diff --git a/src/torque/types.h b/src/torque/types.h index 01e2f9d664a1..0d79c1f40547 100644 --- a/src/torque/types.h +++ b/src/torque/types.h @@ -606,7 +606,7 @@ class VisitResult { base::Optional stack_range_; }; -typedef std::map NameValueMap; +using NameValueMap = std::map; VisitResult ProjectStructField(VisitResult structure, const std::string& fieldname); @@ -627,21 +627,21 @@ class VisitResultVector : public std::vector { std::ostream& operator<<(std::ostream& os, const TypeVector& types); -typedef std::vector NameAndTypeVector; +using NameAndTypeVector = std::vector; struct LabelDefinition { std::string name; NameAndTypeVector parameters; }; -typedef std::vector LabelDefinitionVector; +using LabelDefinitionVector = std::vector; struct LabelDeclaration { Identifier* name; TypeVector types; }; -typedef std::vector LabelDeclarationVector; +using LabelDeclarationVector = std::vector; struct ParameterTypes { TypeVector types; @@ -652,7 +652,7 @@ std::ostream& operator<<(std::ostream& os, const ParameterTypes& parameters); enum class ParameterMode { kProcessImplicit, kIgnoreImplicit }; -typedef std::vector NameVector; +using NameVector = std::vector; struct Signature { Signature(NameVector n, base::Optional arguments_variable, diff --git a/src/utils/address-map.h b/src/utils/address-map.h index 56e1f874fd68..d4de76ca8c89 100644 --- a/src/utils/address-map.h +++ b/src/utils/address-map.h @@ -20,7 +20,7 @@ class PointerToIndexHashMap base::KeyEqualityMatcher, base::DefaultAllocationPolicy> { public: - typedef base::TemplateHashMapEntry Entry; + using Entry = base::TemplateHashMapEntry; inline void Set(Type value, uint32_t index) { uintptr_t key = Key(value); diff --git a/src/utils/identity-map.h b/src/utils/identity-map.h index 6185849ff9a0..b0dcb1c99170 100644 --- a/src/utils/identity-map.h +++ b/src/utils/identity-map.h @@ -29,7 +29,7 @@ class V8_EXPORT_PRIVATE IdentityMapBase { // within the {keys_} array in order to simulate a moving GC. friend class IdentityMapTester; - typedef void** RawEntry; + using RawEntry = void**; explicit IdentityMapBase(Heap* heap) : heap_(heap), diff --git a/src/utils/memcopy.h b/src/utils/memcopy.h index 0d3072e5bd01..cbf7ec49ecdf 100644 --- a/src/utils/memcopy.h +++ b/src/utils/memcopy.h @@ -15,7 +15,7 @@ namespace v8 { namespace internal { -typedef uintptr_t Address; +using Address = uintptr_t; // ---------------------------------------------------------------------------- // Generated memcpy/memmove for ia32, arm, and mips. diff --git a/src/utils/splay-tree.h b/src/utils/splay-tree.h index 691584815106..47633f39dbfa 100644 --- a/src/utils/splay-tree.h +++ b/src/utils/splay-tree.h @@ -29,8 +29,8 @@ namespace internal { template class SplayTree { public: - typedef typename Config::Key Key; - typedef typename Config::Value Value; + using Key = typename Config::Key; + using Value = typename Config::Value; class Locator; diff --git a/src/utils/utils.h b/src/utils/utils.h index 17b4050d4c94..17e07d3042bc 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -60,7 +60,7 @@ inline constexpr bool IsInRange(T value, U lower_limit, U higher_limit) { DCHECK(lower_limit <= higher_limit); #endif STATIC_ASSERT(sizeof(U) <= sizeof(T)); - typedef typename std::make_unsigned::type unsigned_T; + using unsigned_T = typename std::make_unsigned::type; // Use static_cast to support enum classes. return static_cast(static_cast(value) - static_cast(lower_limit)) <= @@ -219,7 +219,7 @@ typename std::make_unsigned::type Abs(T a) { // This is a branch-free implementation of the absolute value function and is // described in Warren's "Hacker's Delight", chapter 2. It avoids undefined // behavior with the arithmetic negation operation on signed values as well. - typedef typename std::make_unsigned::type unsignedT; + using unsignedT = typename std::make_unsigned::type; unsignedT x = static_cast(a); unsignedT y = static_cast(a >> (sizeof(T) * 8 - 1)); return (x ^ y) - y; @@ -381,10 +381,10 @@ using BitField64 = BitField; }; #define DEFINE_BIT_FIELD_TYPE(Name, Type, Size, RangesName) \ - typedef BitField Name; + using Name = BitField; #define DEFINE_BIT_FIELD_64_TYPE(Name, Type, Size, RangesName) \ - typedef BitField64 Name; + using Name = BitField64; #define DEFINE_BIT_FIELDS(LIST_MACRO) \ DEFINE_BIT_RANGES(LIST_MACRO) \ @@ -399,7 +399,7 @@ using BitField64 = BitField; // a variable number of items in an array. // // To encode boolean data in a smi array you would use: -// typedef BitSetComputer BoolComputer; +// using BoolComputer = BitSetComputer; // template class BitSetComputer { diff --git a/src/wasm/wasm-objects.h b/src/wasm/wasm-objects.h index 000d324b32c2..1e6ced0b7681 100644 --- a/src/wasm/wasm-objects.h +++ b/src/wasm/wasm-objects.h @@ -720,7 +720,7 @@ class WasmCapiFunctionData : public Struct { TORQUE_GENERATED_WASM_CAPI_FUNCTION_DATA_FIELDS) STATIC_ASSERT(kStartOfStrongFieldsOffset == kWrapperCodeOffset); - typedef FlexibleBodyDescriptor BodyDescriptor; + using BodyDescriptor = FlexibleBodyDescriptor; OBJECT_CONSTRUCTORS(WasmCapiFunctionData, Struct); }; diff --git a/src/x64/assembler-x64.h b/src/x64/assembler-x64.h index 58ebf37e70e1..bd004e820f05 100644 --- a/src/x64/assembler-x64.h +++ b/src/x64/assembler-x64.h @@ -292,7 +292,7 @@ class ConstPool { Assembler* assm_; // Values, pc offsets of entries. - typedef std::multimap EntryMap; + using EntryMap = std::multimap; EntryMap entries_; // Number of bytes taken up by the displacement of rip-relative addressing. diff --git a/src/x64/macro-assembler-x64.h b/src/x64/macro-assembler-x64.h index 96e37faa2e24..9382035efad2 100644 --- a/src/x64/macro-assembler-x64.h +++ b/src/x64/macro-assembler-x64.h @@ -19,7 +19,7 @@ namespace v8 { namespace internal { // Convenience for platform-independent signatures. -typedef Operand MemOperand; +using MemOperand = Operand; class StringConstantBase; diff --git a/src/x64/register-x64.h b/src/x64/register-x64.h index 0f20edcb180b..a870c2023bf7 100644 --- a/src/x64/register-x64.h +++ b/src/x64/register-x64.h @@ -169,11 +169,11 @@ ASSERT_TRIVIALLY_COPYABLE(XMMRegister); static_assert(sizeof(XMMRegister) == sizeof(int), "XMMRegister can efficiently be passed by value"); -typedef XMMRegister FloatRegister; +using FloatRegister = XMMRegister; -typedef XMMRegister DoubleRegister; +using DoubleRegister = XMMRegister; -typedef XMMRegister Simd128Register; +using Simd128Register = XMMRegister; #define DECLARE_REGISTER(R) \ constexpr DoubleRegister R = DoubleRegister::from_code(); diff --git a/src/zone/zone-allocator.h b/src/zone/zone-allocator.h index 56d8ea09ef56..fe62d4bb4c6e 100644 --- a/src/zone/zone-allocator.h +++ b/src/zone/zone-allocator.h @@ -14,16 +14,16 @@ namespace internal { template class ZoneAllocator { public: - typedef T* pointer; - typedef const T* const_pointer; - typedef T& reference; - typedef const T& const_reference; - typedef T value_type; - typedef size_t size_type; - typedef ptrdiff_t difference_type; + using pointer = T*; + using const_pointer = const T*; + using reference = T&; + using const_reference = const T&; + using value_type = T; + using size_type = size_t; + using difference_type = ptrdiff_t; template struct rebind { - typedef ZoneAllocator other; + using other = ZoneAllocator; }; #ifdef V8_CC_MSVC @@ -81,7 +81,7 @@ class RecyclingZoneAllocator : public ZoneAllocator { public: template struct rebind { - typedef RecyclingZoneAllocator other; + using other = RecyclingZoneAllocator; }; #ifdef V8_CC_MSVC @@ -137,8 +137,8 @@ class RecyclingZoneAllocator : public ZoneAllocator { FreeBlock* free_list_; }; -typedef ZoneAllocator ZoneBoolAllocator; -typedef ZoneAllocator ZoneIntAllocator; +using ZoneBoolAllocator = ZoneAllocator; +using ZoneIntAllocator = ZoneAllocator; } // namespace internal } // namespace v8 diff --git a/src/zone/zone-containers.h b/src/zone/zone-containers.h index 86c4bd070245..2aa2f122a937 100644 --- a/src/zone/zone-containers.h +++ b/src/zone/zone-containers.h @@ -195,8 +195,8 @@ class ZoneMultimap }; // Typedefs to shorten commonly used vectors. -typedef ZoneVector BoolVector; -typedef ZoneVector IntVector; +using BoolVector = ZoneVector; +using IntVector = ZoneVector; } // namespace internal } // namespace v8 diff --git a/src/zone/zone-handle-set.h b/src/zone/zone-handle-set.h index 459db500b41a..96752dce35a9 100644 --- a/src/zone/zone-handle-set.h +++ b/src/zone/zone-handle-set.h @@ -157,7 +157,7 @@ class ZoneHandleSet final { inline const_iterator end() const; private: - typedef ZoneVector List; + using List = ZoneVector; List const* list() const { DCHECK_EQ(kListTag, data_ & kTagMask); @@ -193,11 +193,11 @@ std::ostream& operator<<(std::ostream& os, ZoneHandleSet set) { template class ZoneHandleSet::const_iterator { public: - typedef std::forward_iterator_tag iterator_category; - typedef std::ptrdiff_t difference_type; - typedef Handle value_type; - typedef value_type reference; - typedef value_type* pointer; + using iterator_category = std::forward_iterator_tag; + using difference_type = std::ptrdiff_t; + using value_type = Handle; + using reference = value_type; + using pointer = value_type*; const_iterator(const const_iterator& other) : set_(other.set_), current_(other.current_) {} diff --git a/src/zone/zone.h b/src/zone/zone.h index 30af54d4b480..b113f4958548 100644 --- a/src/zone/zone.h +++ b/src/zone/zone.h @@ -216,7 +216,7 @@ class ZoneList final { inline T& last() const { return at(length_ - 1); } inline T& first() const { return at(0); } - typedef T* iterator; + using iterator = T*; inline iterator begin() const { return &data_[0]; } inline iterator end() const { return &data_[length_]; } @@ -388,7 +388,7 @@ class ScopedPtrList final { end_ += list.length(); } - typedef T** iterator; + using iterator = T**; inline iterator begin() const { return reinterpret_cast(buffer_.data() + start_); } @@ -402,10 +402,10 @@ class ScopedPtrList final { size_t end_; }; -typedef base::PointerTemplateHashMapImpl ZoneHashMap; +using ZoneHashMap = base::PointerTemplateHashMapImpl; -typedef base::CustomMatcherTemplateHashMapImpl - CustomMatcherZoneHashMap; +using CustomMatcherZoneHashMap = + base::CustomMatcherTemplateHashMapImpl; } // namespace internal } // namespace v8 diff --git a/test/cctest/compiler/c-signature.h b/test/cctest/compiler/c-signature.h index 9bf1f97ce4b6..375723c90406 100644 --- a/test/cctest/compiler/c-signature.h +++ b/test/cctest/compiler/c-signature.h @@ -110,11 +110,11 @@ class CSignatureOf : public CSignature { MachineType storage_[kReturnCount + kParamCount]; }; -typedef CSignatureOf CSignature_i_ii; -typedef CSignatureOf CSignature_u_uu; -typedef CSignatureOf CSignature_f_ff; -typedef CSignatureOf CSignature_d_dd; -typedef CSignatureOf CSignature_o_oo; +using CSignature_i_ii = CSignatureOf; +using CSignature_u_uu = CSignatureOf; +using CSignature_f_ff = CSignatureOf; +using CSignature_d_dd = CSignatureOf; +using CSignature_o_oo = CSignatureOf; } // namespace compiler } // namespace internal diff --git a/test/cctest/compiler/test-code-assembler.cc b/test/cctest/compiler/test-code-assembler.cc index f2f9332ba0bb..4dc4ac03e18f 100644 --- a/test/cctest/compiler/test-code-assembler.cc +++ b/test/cctest/compiler/test-code-assembler.cc @@ -18,8 +18,8 @@ namespace compiler { namespace { -typedef CodeAssemblerLabel Label; -typedef CodeAssemblerVariable Variable; +using Label = CodeAssemblerLabel; +using Variable = CodeAssemblerVariable; Node* SmiTag(CodeAssembler& m, Node* value) { int32_t constant_value; diff --git a/test/cctest/compiler/test-gap-resolver.cc b/test/cctest/compiler/test-gap-resolver.cc index 85dd3892879c..ca26e0b49f6b 100644 --- a/test/cctest/compiler/test-gap-resolver.cc +++ b/test/cctest/compiler/test-gap-resolver.cc @@ -110,8 +110,8 @@ class InterpreterState { }; // Internally, the state is a normalized permutation of Value pairs. - typedef Key Value; - typedef std::map OperandMap; + using Value = Key; + using OperandMap = std::map; Value read(const InstructionOperand& op) const { OperandMap::const_iterator it = values_.find(KeyFor(op)); diff --git a/test/cctest/compiler/test-instruction.cc b/test/cctest/compiler/test-instruction.cc index fd41d9caafbc..6d4a8eda1dfa 100644 --- a/test/cctest/compiler/test-instruction.cc +++ b/test/cctest/compiler/test-instruction.cc @@ -19,8 +19,8 @@ namespace v8 { namespace internal { namespace compiler { -typedef v8::internal::compiler::Instruction TestInstr; -typedef v8::internal::compiler::InstructionSequence TestInstrSeq; +using TestInstr = v8::internal::compiler::Instruction; +using TestInstrSeq = v8::internal::compiler::InstructionSequence; // A testing helper for the register code abstraction. class InstructionTester : public HandleAndZoneScope { diff --git a/test/cctest/compiler/test-multiple-return.cc b/test/cctest/compiler/test-multiple-return.cc index dcf523f390d4..4a81ec2691b8 100644 --- a/test/cctest/compiler/test-multiple-return.cc +++ b/test/cctest/compiler/test-multiple-return.cc @@ -151,7 +151,7 @@ void TestReturnMultipleValues(MachineType type) { // m.Parameter(0) is the WasmContext. Node* p0 = m.Parameter(1); Node* p1 = m.Parameter(2); - typedef Node* Node_ptr; + using Node_ptr = Node*; std::unique_ptr returns(new Node_ptr[count]); for (int i = 0; i < count; ++i) { if (i % 3 == 0) returns[i] = Add(m, type, p0, p1); diff --git a/test/cctest/compiler/test-node.cc b/test/cctest/compiler/test-node.cc index a8927de33c6f..d48d4c86e3c9 100644 --- a/test/cctest/compiler/test-node.cc +++ b/test/cctest/compiler/test-node.cc @@ -36,8 +36,7 @@ static Operator dummy_operator3(IrOpcode::kParameter, Operator::kNoWrite, namespace { -typedef std::multiset> NodeMSet; - +using NodeMSet = std::multiset>; void CheckUseChain(Node* node, Node** uses, int use_count) { // Check ownership. diff --git a/test/cctest/compiler/test-run-native-calls.cc b/test/cctest/compiler/test-run-native-calls.cc index 9f052a3ee246..2432ec3afea6 100644 --- a/test/cctest/compiler/test-run-native-calls.cc +++ b/test/cctest/compiler/test-run-native-calls.cc @@ -24,8 +24,8 @@ namespace compiler { namespace test_run_native_calls { namespace { -typedef float float32; -typedef double float64; +using float32 = float; +using float64 = double; // Picks a representative pair of integers from the given range. // If there are less than {max_pairs} possible pairs, do them all, otherwise try diff --git a/test/cctest/interpreter/test-interpreter.cc b/test/cctest/interpreter/test-interpreter.cc index 5faeee596047..9b907588efaf 100644 --- a/test/cctest/interpreter/test-interpreter.cc +++ b/test/cctest/interpreter/test-interpreter.cc @@ -609,7 +609,7 @@ TEST(InterpreterParameter8) { Handle bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); - typedef Handle H; + using H = Handle; auto callable = tester.GetCallable(); Handle arg1 = Handle(Smi::FromInt(1), handles.main_isolate()); @@ -919,7 +919,7 @@ TEST(InterpreterUnaryOpFeedback) { Handle bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); - typedef Handle H; + using H = Handle; auto callable = tester.GetCallable(); Handle return_val = @@ -979,7 +979,7 @@ TEST(InterpreterBitwiseTypeFeedback) { Handle bytecode_array = builder.ToBytecodeArray(isolate); InterpreterTester tester(isolate, bytecode_array, metadata); - typedef Handle H; + using H = Handle; auto callable = tester.GetCallable(); Handle arg1 = Handle(Smi::FromInt(2), isolate); @@ -2165,7 +2165,7 @@ TEST(InterpreterStrictNotEqual) { } TEST(InterpreterCompareTypeOf) { - typedef TestTypeOfFlags::LiteralFlag LiteralFlag; + using LiteralFlag = TestTypeOfFlags::LiteralFlag; HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); diff --git a/test/cctest/test-accessor-assembler.cc b/test/cctest/test-accessor-assembler.cc index d82be0a3fc5d..20a2bc2d8099 100644 --- a/test/cctest/test-accessor-assembler.cc +++ b/test/cctest/test-accessor-assembler.cc @@ -118,7 +118,7 @@ Handle CreateCodeOfKind(Code::Kind kind) { } // namespace TEST(TryProbeStubCache) { - typedef CodeStubAssembler::Label Label; + using Label = CodeStubAssembler::Label; Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 3; CodeAssemblerTester data(isolate, kNumParams); diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index c4a779607d02..3c4c5000b14c 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -4608,7 +4608,7 @@ Local NewObjectForIntKey( template class PhantomStdMapTraits : public v8::StdMapTraits { public: - typedef typename v8::GlobalValueMap> MapType; + using MapType = typename v8::GlobalValueMap>; static const v8::PersistentContainerCallbackType kCallbackType = v8::kWeakWithInternalFields; struct WeakCallbackDataType { @@ -4719,8 +4719,8 @@ TEST(GlobalValueMap) { TestGlobalValueMap>(); // Custom traits with weak callbacks: - typedef v8::GlobalValueMap> WeakMap; + using WeakMap = + v8::GlobalValueMap>; TestGlobalValueMap(); } @@ -8289,7 +8289,7 @@ THREADED_TEST(GCFromWeakCallbacks) { Context::Scope context_scope(context); static const int kNumberOfGCTypes = 2; - typedef v8::WeakCallbackInfo::Callback Callback; + using Callback = v8::WeakCallbackInfo::Callback; Callback gc_forcing_callback[kNumberOfGCTypes] = {&ForceScavenge1, &ForceMarkSweep1}; @@ -13683,8 +13683,8 @@ TEST(CopyablePersistent) { i::GlobalHandles* globals = reinterpret_cast(isolate)->global_handles(); size_t initial_handles = globals->handles_count(); - typedef v8::Persistent > - CopyableObject; + using CopyableObject = + v8::Persistent>; { CopyableObject handle1; { diff --git a/test/cctest/test-assembler-mips.cc b/test/cctest/test-assembler-mips.cc index 935cfcf881ec..a6bbfefe7744 100644 --- a/test/cctest/test-assembler-mips.cc +++ b/test/cctest/test-assembler-mips.cc @@ -9052,7 +9052,7 @@ TEST(MSA_3R_instructions) { } #define SUBSUS_U_DF(T, lanes, mask) \ - typedef typename std::make_unsigned::type uT; \ + using uT = typename std::make_unsigned::type; \ int size_in_bits = kMSARegSize / lanes; \ for (int i = 0; i < 2; i++) { \ uint64_t res = 0; \ @@ -9081,7 +9081,7 @@ TEST(MSA_3R_instructions) { } #define SUBSUU_S_DF(T, lanes, mask) \ - typedef typename std::make_unsigned::type uT; \ + using uT = typename std::make_unsigned::type; \ int size_in_bits = kMSARegSize / lanes; \ for (int i = 0; i < 2; i++) { \ uint64_t res = 0; \ diff --git a/test/cctest/test-assembler-mips64.cc b/test/cctest/test-assembler-mips64.cc index 750f2a27059f..94ba67f79c51 100644 --- a/test/cctest/test-assembler-mips64.cc +++ b/test/cctest/test-assembler-mips64.cc @@ -9955,7 +9955,7 @@ TEST(MSA_3R_instructions) { } #define SUBSUS_U_DF(T, lanes, mask) \ - typedef typename std::make_unsigned::type uT; \ + using uT = typename std::make_unsigned::type; \ int size_in_bits = kMSARegSize / lanes; \ for (int i = 0; i < 2; i++) { \ uint64_t res = 0; \ @@ -9984,7 +9984,7 @@ TEST(MSA_3R_instructions) { } #define SUBSUU_S_DF(T, lanes, mask) \ - typedef typename std::make_unsigned::type uT; \ + using uT = typename std::make_unsigned::type; \ int size_in_bits = kMSARegSize / lanes; \ for (int i = 0; i < 2; i++) { \ uint64_t res = 0; \ diff --git a/test/cctest/test-circular-queue.cc b/test/cctest/test-circular-queue.cc index ac6710fb37d4..7b0475ff8003 100644 --- a/test/cctest/test-circular-queue.cc +++ b/test/cctest/test-circular-queue.cc @@ -36,7 +36,7 @@ using i::SamplingCircularQueue; TEST(SamplingCircularQueue) { - typedef v8::base::AtomicWord Record; + using Record = v8::base::AtomicWord; const int kMaxRecordsInQueue = 4; SamplingCircularQueue scq; @@ -100,8 +100,8 @@ TEST(SamplingCircularQueue) { namespace { -typedef v8::base::AtomicWord Record; -typedef SamplingCircularQueue TestSampleQueue; +using Record = v8::base::AtomicWord; +using TestSampleQueue = SamplingCircularQueue; class ProducerThread: public v8::base::Thread { public: diff --git a/test/cctest/test-code-stub-assembler.cc b/test/cctest/test-code-stub-assembler.cc index f5746f62d4da..fceba5208ae8 100644 --- a/test/cctest/test-code-stub-assembler.cc +++ b/test/cctest/test-code-stub-assembler.cc @@ -257,7 +257,7 @@ TEST(IsValidPositiveSmi) { IsValidPositiveSmiCase(isolate, 0x40000000U); IsValidPositiveSmiCase(isolate, 0xBFFFFFFFU); - typedef std::numeric_limits int32_limits; + using int32_limits = std::numeric_limits; IsValidPositiveSmiCase(isolate, int32_limits::max()); IsValidPositiveSmiCase(isolate, int32_limits::min()); #if V8_TARGET_ARCH_64_BIT diff --git a/test/cctest/test-cpu-profiler.cc b/test/cctest/test-cpu-profiler.cc index d35a84634574..e978aff2ba50 100644 --- a/test/cctest/test-cpu-profiler.cc +++ b/test/cctest/test-cpu-profiler.cc @@ -434,7 +434,7 @@ class ProfilerHelper { profiler_->Dispose(); } - typedef v8::CpuProfilingMode ProfilingMode; + using ProfilingMode = v8::CpuProfilingMode; v8::CpuProfile* Run( v8::Local function, v8::Local argv[], int argc, diff --git a/test/cctest/test-global-handles.cc b/test/cctest/test-global-handles.cc index 71acaf907cf9..d59cf3a37cc3 100644 --- a/test/cctest/test-global-handles.cc +++ b/test/cctest/test-global-handles.cc @@ -589,7 +589,7 @@ TEST(GCFromWeakCallbacks) { v8::Context::Scope context_scope(context); static const int kNumberOfGCTypes = 2; - typedef v8::WeakCallbackInfo::Callback Callback; + using Callback = v8::WeakCallbackInfo::Callback; Callback gc_forcing_callback[kNumberOfGCTypes] = {&ForceScavenge1, &ForceMarkSweep1}; diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc index 49333cac925d..aaef09b91e0a 100644 --- a/test/cctest/test-parsing.cc +++ b/test/cctest/test-parsing.cc @@ -11052,8 +11052,8 @@ TEST(LexicalLoopVariable) { i::Isolate* isolate = CcTest::i_isolate(); i::HandleScope scope(isolate); LocalContext env; - typedef std::function - TestCB; + using TestCB = + std::function; auto TestProgram = [isolate](const char* program, TestCB test) { i::Factory* const factory = isolate->factory(); i::Handle source = diff --git a/test/cctest/test-regexp.cc b/test/cctest/test-regexp.cc index 0efaafeeaba8..d71223e73d1e 100644 --- a/test/cctest/test-regexp.cc +++ b/test/cctest/test-regexp.cc @@ -588,8 +588,8 @@ static void Execute(const char* input, bool multiline, bool unicode, class TestConfig { public: - typedef int Key; - typedef int Value; + using Key = int; + using Value = int; static const int kNoKey; static int NoValue() { return 0; } static inline int Compare(int a, int b) { @@ -733,23 +733,23 @@ TEST(ParsePossessiveRepetition) { // Tests of interpreter. #if V8_TARGET_ARCH_IA32 -typedef RegExpMacroAssemblerIA32 ArchRegExpMacroAssembler; +using ArchRegExpMacroAssembler = RegExpMacroAssemblerIA32; #elif V8_TARGET_ARCH_X64 -typedef RegExpMacroAssemblerX64 ArchRegExpMacroAssembler; +using ArchRegExpMacroAssembler = RegExpMacroAssemblerX64; #elif V8_TARGET_ARCH_ARM -typedef RegExpMacroAssemblerARM ArchRegExpMacroAssembler; +using ArchRegExpMacroAssembler = RegExpMacroAssemblerARM; #elif V8_TARGET_ARCH_ARM64 -typedef RegExpMacroAssemblerARM64 ArchRegExpMacroAssembler; +using ArchRegExpMacroAssembler = RegExpMacroAssemblerARM64; #elif V8_TARGET_ARCH_S390 -typedef RegExpMacroAssemblerS390 ArchRegExpMacroAssembler; +using ArchRegExpMacroAssembler = RegExpMacroAssemblerS390; #elif V8_TARGET_ARCH_PPC -typedef RegExpMacroAssemblerPPC ArchRegExpMacroAssembler; +using ArchRegExpMacroAssembler = RegExpMacroAssemblerPPC; #elif V8_TARGET_ARCH_MIPS -typedef RegExpMacroAssemblerMIPS ArchRegExpMacroAssembler; +using ArchRegExpMacroAssembler = RegExpMacroAssemblerMIPS; #elif V8_TARGET_ARCH_MIPS64 -typedef RegExpMacroAssemblerMIPS ArchRegExpMacroAssembler; +using ArchRegExpMacroAssembler = RegExpMacroAssemblerMIPS; #elif V8_TARGET_ARCH_X87 -typedef RegExpMacroAssemblerX87 ArchRegExpMacroAssembler; +using ArchRegExpMacroAssembler = RegExpMacroAssemblerX87; #endif class ContextInitializer { diff --git a/test/cctest/test-sampler-api.cc b/test/cctest/test-sampler-api.cc index 0f7e0b075e80..3c8f35255139 100644 --- a/test/cctest/test-sampler-api.cc +++ b/test/cctest/test-sampler-api.cc @@ -19,7 +19,7 @@ class Sample { Sample() = default; - typedef const void* const* const_iterator; + using const_iterator = const void* const*; const_iterator begin() const { return data_.begin(); } const_iterator end() const { return &data_[data_.length()]; } @@ -100,7 +100,7 @@ class SamplingTestHelper { const void* code_start; size_t code_len; }; - typedef std::map CodeEntries; + using CodeEntries = std::map; explicit SamplingTestHelper(const std::string& test_function) : sample_is_taken_(false), isolate_(CcTest::isolate()) { diff --git a/test/cctest/test-serialize.cc b/test/cctest/test-serialize.cc index e842538e2bfb..a080db9d22d5 100644 --- a/test/cctest/test-serialize.cc +++ b/test/cctest/test-serialize.cc @@ -924,7 +924,7 @@ void DeserializeInternalFields(v8::Local holder, int index, deserialized_data.push_back(embedder_field); } -typedef std::vector> Int32Expectations; +using Int32Expectations = std::vector>; void TestInt32Expectations(const Int32Expectations& expectations) { for (const auto& e : expectations) { diff --git a/test/cctest/test-types.cc b/test/cctest/test-types.cc index 444b612a553d..fc213b5bf95d 100644 --- a/test/cctest/test-types.cc +++ b/test/cctest/test-types.cc @@ -25,11 +25,11 @@ static bool IsInteger(double x) { return nearbyint(x) == x && !i::IsMinusZero(x); // Allows for infinities. } -typedef uint32_t bitset; +using bitset = uint32_t; struct Tests { - typedef Types::TypeVector::iterator TypeIterator; - typedef Types::ValueVector::iterator ValueIterator; + using TypeIterator = Types::TypeVector::iterator; + using ValueIterator = Types::ValueVector::iterator; Isolate* isolate; HandleScope scope; diff --git a/test/cctest/test-utils.cc b/test/cctest/test-utils.cc index 30e4d36a14af..628ed1ba4f29 100644 --- a/test/cctest/test-utils.cc +++ b/test/cctest/test-utils.cc @@ -79,7 +79,7 @@ TEST(Utils1) { TEST(BitSetComputer) { - typedef BitSetComputer BoolComputer; + using BoolComputer = BitSetComputer; CHECK_EQ(0, BoolComputer::word_count(0)); CHECK_EQ(1, BoolComputer::word_count(8)); CHECK_EQ(2, BoolComputer::word_count(50)); @@ -97,7 +97,7 @@ TEST(BitSetComputer) { // Lets store 2 bits per item with 3000 items and verify the values are // correct. - typedef BitSetComputer TwoBits; + using TwoBits = BitSetComputer; const int words = 750; CHECK_EQ(words, TwoBits::word_count(3000)); const int offset = 10; diff --git a/test/cctest/torque/test-torque.cc b/test/cctest/torque/test-torque.cc index 049788227e33..2032011474b7 100644 --- a/test/cctest/torque/test-torque.cc +++ b/test/cctest/torque/test-torque.cc @@ -27,8 +27,8 @@ namespace compiler { namespace { -typedef CodeAssemblerLabel Label; -typedef CodeAssemblerVariable Variable; +using Label = CodeAssemblerLabel; +using Variable = CodeAssemblerVariable; class TestTorqueAssembler : public CodeStubAssembler, public TorqueGeneratedTestBuiltinsAssembler { diff --git a/test/common/types-fuzz.h b/test/common/types-fuzz.h index 42a5461d2c8e..06ab9067d8e5 100644 --- a/test/common/types-fuzz.h +++ b/test/common/types-fuzz.h @@ -135,8 +135,8 @@ class Types { Type Integer; - typedef std::vector TypeVector; - typedef std::vector > ValueVector; + using TypeVector = std::vector; + using ValueVector = std::vector >; TypeVector types; ValueVector values; diff --git a/test/unittests/api/isolate-unittest.cc b/test/unittests/api/isolate-unittest.cc index bdede4cbe346..8d1a5dd84f8b 100644 --- a/test/unittests/api/isolate-unittest.cc +++ b/test/unittests/api/isolate-unittest.cc @@ -17,7 +17,7 @@ namespace v8 { -typedef TestWithIsolate IsolateTest; +using IsolateTest = TestWithIsolate; namespace { diff --git a/test/unittests/api/remote-object-unittest.cc b/test/unittests/api/remote-object-unittest.cc index d5e2ce42089d..39434a8f9a69 100644 --- a/test/unittests/api/remote-object-unittest.cc +++ b/test/unittests/api/remote-object-unittest.cc @@ -13,7 +13,7 @@ namespace v8 { namespace remote_object_unittest { -typedef TestWithIsolate RemoteObjectTest; +using RemoteObjectTest = TestWithIsolate; namespace { diff --git a/test/unittests/base/division-by-constant-unittest.cc b/test/unittests/base/division-by-constant-unittest.cc index 58816db79e87..19a084c5de52 100644 --- a/test/unittests/base/division-by-constant-unittest.cc +++ b/test/unittests/base/division-by-constant-unittest.cc @@ -25,9 +25,8 @@ std::ostream& operator<<(std::ostream& os, // Some abbreviations... -typedef MagicNumbersForDivision M32; -typedef MagicNumbersForDivision M64; - +using M32 = MagicNumbersForDivision; +using M64 = MagicNumbersForDivision; static M32 s32(int32_t d) { return SignedDivisionByConstant(static_cast(d)); diff --git a/test/unittests/base/flags-unittest.cc b/test/unittests/base/flags-unittest.cc index 6f19399dc21b..826234e2d6dd 100644 --- a/test/unittests/base/flags-unittest.cc +++ b/test/unittests/base/flags-unittest.cc @@ -17,8 +17,7 @@ enum Flag1 { kFlag1Second = 1u << 2, kFlag1All = kFlag1None | kFlag1First | kFlag1Second }; -typedef Flags Flags1; - +using Flags1 = Flags; DEFINE_OPERATORS_FOR_FLAGS(Flags1) @@ -61,7 +60,7 @@ enum Option { kOption2 = 2, kAllOptions = kNoOptions | kOption1 | kOption2 }; -typedef Flags