diff --git a/.clang-tidy b/.clang-tidy index 3d22b49c741..fb769d9bf96 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -9,6 +9,7 @@ modernize-redundant-void-arg, modernize-replace-random-shuffle, modernize-shrink-to-fit, + modernize-type-traits, # modernize-use-auto, modernize-use-constraints, modernize-use-bool-literals, diff --git a/src/api/api.cc b/src/api/api.cc index f84d50e2982..cd4f985d3c0 100644 --- a/src/api/api.cc +++ b/src/api/api.cc @@ -793,7 +793,7 @@ constexpr InstanceTypeChecker::TaggedAddressRange kStringMapRange = V(StringMapLowerBound, kStringMapRange.first) \ V(StringMapUpperBound, kStringMapRange.second) -static_assert(std::is_same::value); +static_assert(std::is_same_v); // Ensure they have the correct value. #define CHECK_STATIC_ROOT(name, value) \ static_assert(Internals::StaticReadOnlyRoot::k##name == value); @@ -12312,7 +12312,7 @@ bool ValidatePropertyCallbackInfo(const PropertyCallbackInfo& info) { CHECK(i::IsSmi(key) || i::IsName(key)); CHECK(info.Data()->IsValue()); USE(info.ShouldThrowOnError()); - if (!std::is_same::value) { + if (!std::is_same_v) { CHECK(info.GetReturnValue().Get()->IsValue()); } return true; diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc index 622dc98c245..4c83190958a 100644 --- a/src/ast/scopes.cc +++ b/src/ast/scopes.cc @@ -2804,7 +2804,7 @@ void DeclarationScope::AllocateScopeInfos(ParseInfo* info, auto it = scope_infos_to_reuse.find(id); if (it != scope_infos_to_reuse.end()) { if (V8_LIKELY(*it->second == scope_info)) break; - if constexpr (std::is_same::value) { + if constexpr (std::is_same_v) { isolate->PushStackTraceAndDie( reinterpret_cast(it->second->ptr()), reinterpret_cast(scope_info->ptr())); diff --git a/src/builtins/builtins-call-gen.cc b/src/builtins/builtins-call-gen.cc index 7afda69a206..7508e57a8c6 100644 --- a/src/builtins/builtins-call-gen.cc +++ b/src/builtins/builtins-call-gen.cc @@ -480,9 +480,9 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructWithSpread( template void CallOrConstructBuiltinsAssembler::CallReceiver( Builtin id, std::optional> receiver) { - static_assert(std::is_same::value, - "Incompatible Descriptor"); + static_assert( + std::is_same_v, + "Incompatible Descriptor"); auto bitfield = UncheckedParameter(Descriptor::kBitField); TNode argc = Signed(DecodeWord32< diff --git a/src/builtins/builtins-regexp-gen.cc b/src/builtins/builtins-regexp-gen.cc index ed4a092c0b2..fc87ad6b348 100644 --- a/src/builtins/builtins-regexp-gen.cc +++ b/src/builtins/builtins-regexp-gen.cc @@ -129,9 +129,8 @@ TNode RegExpBuiltinsAssembler::AllocateRegExpResult( Label finish_initialization(this); GotoIfNot(has_indices, &finish_initialization, GotoHint::kLabel); { - static_assert( - std::is_base_of::value, - "JSRegExpResultWithIndices is a subclass of JSRegExpResult"); + static_assert(std::is_base_of_v, + "JSRegExpResultWithIndices is a subclass of JSRegExpResult"); StoreObjectFieldNoWriteBarrier( result, JSRegExpResultWithIndices::kIndicesOffset, undefined_value); Goto(&finish_initialization); @@ -1056,9 +1055,8 @@ void RegExpBuiltinsAssembler::BranchIfRegExpResult(const TNode context, &maybe_result_with_indices, BranchHint::kTrue); BIND(&maybe_result_with_indices); { - static_assert( - std::is_base_of::value, - "JSRegExpResultWithIndices is a subclass of JSRegExpResult"); + static_assert(std::is_base_of_v, + "JSRegExpResultWithIndices is a subclass of JSRegExpResult"); const TNode initial_regexp_result_with_indices_map = LoadContextElement(native_context, Context::REGEXP_RESULT_WITH_INDICES_MAP_INDEX); diff --git a/src/builtins/builtins-typed-array-gen.cc b/src/builtins/builtins-typed-array-gen.cc index 8102b2eea48..a16fdd7bbe2 100644 --- a/src/builtins/builtins-typed-array-gen.cc +++ b/src/builtins/builtins-typed-array-gen.cc @@ -523,11 +523,11 @@ void TypedArrayBuiltinsAssembler::StoreJSTypedArrayElementFromPreparedValue( TNode context, TNode typed_array, TNode index, TNode prepared_value, ElementsKind elements_kind, Label* if_detached_or_out_of_bounds) { - static_assert(std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value, + static_assert(std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v, "Only Word32T, Float16T, Float32T, Float64T or BigInt values " "are allowed"); // ToNumber/ToBigInt (or other functions called by the upper level) may diff --git a/src/codegen/code-stub-assembler.cc b/src/codegen/code-stub-assembler.cc index 6c9e3110020..2ec4b14cf77 100644 --- a/src/codegen/code-stub-assembler.cc +++ b/src/codegen/code-stub-assembler.cc @@ -2764,10 +2764,9 @@ TNode CodeStubAssembler::LoadArrayElement(TNode array, int additional_offset) { // TODO(v8:9708): Do we want to keep both IntPtrT and UintPtrT variants? static_assert( - std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value, + std::is_same_v || std::is_same_v || + std::is_same_v || + std::is_same_v, "Only Smi, UintPtrT, IntPtrT or TaggedIndex indices are allowed"); CSA_DCHECK(this, IntPtrGreaterThanOrEqual(ParameterToIntPtr(index_node), IntPtrConstant(0))); @@ -2802,10 +2801,9 @@ TNode CodeStubAssembler::LoadFixedArrayElement( CheckBounds check_bounds) { // TODO(v8:9708): Do we want to keep both IntPtrT and UintPtrT variants? static_assert( - std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value, + std::is_same_v || std::is_same_v || + std::is_same_v || + std::is_same_v, "Only Smi, UintPtrT, IntPtrT or TaggedIndex indexes are allowed"); CSA_DCHECK(this, IsFixedArraySubclass(object)); CSA_DCHECK(this, IsNotWeakFixedArraySubclass(object)); @@ -3825,9 +3823,9 @@ void CodeStubAssembler::StoreFixedArrayOrPropertyArrayElement( TNode> object, TNode index_node, TNode value, WriteBarrierMode barrier_mode, int additional_offset) { // TODO(v8:9708): Do we want to keep both IntPtrT and UintPtrT variants? - static_assert(std::is_same::value || - std::is_same::value || - std::is_same::value, + static_assert(std::is_same_v || + std::is_same_v || + std::is_same_v, "Only Smi, UintPtrT or IntPtrT index is allowed"); DCHECK(barrier_mode == SKIP_WRITE_BARRIER || barrier_mode == UNSAFE_SKIP_WRITE_BARRIER || @@ -3897,9 +3895,9 @@ void CodeStubAssembler::StoreFixedDoubleArrayElement( TNode object, TNode index, TNode value, CheckBounds check_bounds) { // TODO(v8:9708): Do we want to keep both IntPtrT and UintPtrT variants? - static_assert(std::is_same::value || - std::is_same::value || - std::is_same::value, + static_assert(std::is_same_v || + std::is_same_v || + std::is_same_v, "Only Smi, UintPtrT or IntPtrT index is allowed"); if (NeedsBoundsCheck(check_bounds)) { FixedArrayBoundsCheck(object, index, 0); @@ -5141,9 +5139,8 @@ template TNode CodeStubAssembler::AllocateFixedArray( ElementsKind kind, TNode capacity, AllocationFlags flags, std::optional> fixed_array_map) { - static_assert( - std::is_same::value || std::is_same::value, - "Only Smi or IntPtrT capacity is allowed"); + static_assert(std::is_same_v || std::is_same_v, + "Only Smi or IntPtrT capacity is allowed"); Comment("AllocateFixedArray"); CSA_DCHECK(this, IntPtrOrSmiGreaterThan(capacity, IntPtrOrSmiConstant(0))); @@ -5210,9 +5207,8 @@ TNode CodeStubAssembler::ExtractToFixedArray( AllocationFlags allocation_flags, ExtractFixedArrayFlags extract_flags, HoleConversionMode convert_holes, TVariable* var_holes_converted, std::optional> source_elements_kind) { - static_assert( - std::is_same::value || std::is_same::value, - "Only Smi or IntPtrT first, count, and capacity are allowed"); + static_assert(std::is_same_v || std::is_same_v, + "Only Smi or IntPtrT first, count, and capacity are allowed"); DCHECK(extract_flags & ExtractFixedArrayFlag::kFixedArrays); CSA_DCHECK(this, @@ -5309,9 +5305,8 @@ TNode CodeStubAssembler::ExtractFixedDoubleArrayFillingHoles( TNode capacity, TNode fixed_array_map, TVariable* var_holes_converted, AllocationFlags allocation_flags, ExtractFixedArrayFlags extract_flags) { - static_assert( - std::is_same::value || std::is_same::value, - "Only Smi or IntPtrT first, count, and capacity are allowed"); + static_assert(std::is_same_v || std::is_same_v, + "Only Smi or IntPtrT first, count, and capacity are allowed"); DCHECK_NE(var_holes_converted, nullptr); CSA_DCHECK(this, IsFixedDoubleArrayMap(fixed_array_map)); @@ -5397,9 +5392,8 @@ TNode CodeStubAssembler::ExtractFixedArray( std::optional> count, std::optional> capacity, ExtractFixedArrayFlags extract_flags, TVariable* var_holes_converted, std::optional> source_elements_kind) { - static_assert( - std::is_same::value || std::is_same::value, - "Only Smi or IntPtrT first, count, and capacity are allowed"); + static_assert(std::is_same_v || std::is_same_v, + "Only Smi or IntPtrT first, count, and capacity are allowed"); DCHECK(extract_flags & ExtractFixedArrayFlag::kFixedArrays || extract_flags & ExtractFixedArrayFlag::kFixedDoubleArrays); // If we want to replace holes, ExtractFixedArrayFlag::kDontCopyCOW should @@ -5545,9 +5539,8 @@ void CodeStubAssembler::FillFixedArrayWithValue(ElementsKind kind, TNode from_index, TNode to_index, RootIndex value_root_index) { - static_assert( - std::is_same::value || std::is_same::value, - "Only Smi or IntPtrT from and to are allowed"); + static_assert(std::is_same_v || std::is_same_v, + "Only Smi or IntPtrT from and to are allowed"); CSA_SLOW_DCHECK(this, IsFixedArrayWithKind(array, kind)); DCHECK(value_root_index == RootIndex::kTheHoleValue || value_root_index == RootIndex::kUndefinedValue); @@ -5895,9 +5888,8 @@ void CodeStubAssembler::CopyFixedArrayElements( CSA_SLOW_DCHECK(this, IsFixedArrayWithKindOrEmpty(to_array, to_kind)); static_assert(OFFSET_OF_DATA_START(FixedArray) == OFFSET_OF_DATA_START(FixedDoubleArray)); - static_assert( - std::is_same::value || std::is_same::value, - "Only Smi or IntPtrT indices are allowed"); + static_assert(std::is_same_v || std::is_same_v, + "Only Smi or IntPtrT indices are allowed"); const int first_element_offset = OFFSET_OF_DATA_START(FixedArray) - kHeapObjectTag; @@ -6179,9 +6171,8 @@ TNode CodeStubAssembler::LoadElementAndPrepareForStore( template TNode CodeStubAssembler::CalculateNewElementsCapacity( TNode old_capacity) { - static_assert( - std::is_same::value || std::is_same::value, - "Only Smi or IntPtrT old_capacity is allowed"); + static_assert(std::is_same_v || std::is_same_v, + "Only Smi or IntPtrT old_capacity is allowed"); Comment("TryGrowElementsCapacity"); TNode half_old_capacity = WordOrSmiShr(old_capacity, 1); TNode new_capacity = IntPtrOrSmiAdd(half_old_capacity, old_capacity); @@ -6210,9 +6201,8 @@ template TNode CodeStubAssembler::TryGrowElementsCapacity( TNode object, TNode elements, ElementsKind kind, TNode key, TNode capacity, Label* bailout) { - static_assert( - std::is_same::value || std::is_same::value, - "Only Smi or IntPtrT key and capacity nodes are allowed"); + static_assert(std::is_same_v || std::is_same_v, + "Only Smi or IntPtrT key and capacity nodes are allowed"); Comment("TryGrowElementsCapacity"); CSA_SLOW_DCHECK(this, IsFixedArrayWithKindOrEmpty(elements, kind)); @@ -6234,9 +6224,8 @@ TNode CodeStubAssembler::GrowElementsCapacity( TNode object, TNode elements, ElementsKind from_kind, ElementsKind to_kind, TNode capacity, TNode new_capacity, Label* bailout) { - static_assert( - std::is_same::value || std::is_same::value, - "Only Smi or IntPtrT capacities are allowed"); + static_assert(std::is_same_v || std::is_same_v, + "Only Smi or IntPtrT capacities are allowed"); Comment("[ GrowElementsCapacity"); CSA_SLOW_DCHECK(this, IsFixedArrayWithKindOrEmpty(elements, from_kind)); @@ -8417,9 +8406,8 @@ TNode CodeStubAssembler::LoadMemoryChunkFlags( template TNode CodeStubAssembler::FixedArraySizeDoesntFitInNewSpace( TNode element_count, int base_size) { - static_assert( - std::is_same::value || std::is_same::value, - "Only Smi or IntPtrT element_count is allowed"); + static_assert(std::is_same_v || std::is_same_v, + "Only Smi or IntPtrT element_count is allowed"); int max_newspace_elements = (kMaxRegularHeapObjectSize - base_size) / kTaggedSize; return IntPtrOrSmiGreaterThan( @@ -9901,7 +9889,7 @@ TNode CodeStubAssembler::LoadFieldTypeByDescriptorEntry( template TNode CodeStubAssembler::LoadValueByKeyIndex( TNode container, TNode key_index) { - static_assert(!std::is_same::value, + static_assert(!std::is_same_v, "Use the non-templatized version for DescriptorArray"); const int kKeyToValueOffset = (ContainerType::kEntryValueIndex - ContainerType::kEntryKeyIndex) * @@ -9921,7 +9909,7 @@ V8_EXPORT_PRIVATE TNode CodeStubAssembler::LoadValueByKeyIndex( template TNode CodeStubAssembler::LoadDetailsByKeyIndex( TNode container, TNode key_index) { - static_assert(!std::is_same::value, + static_assert(!std::is_same_v, "Use the non-templatized version for DescriptorArray"); const int kKeyToDetailsOffset = (ContainerType::kEntryDetailsIndex - ContainerType::kEntryKeyIndex) * @@ -10102,9 +10090,9 @@ template void CodeStubAssembler::NameDictionaryLookup( TNode dictionary, TNode unique_name, Label* if_found, TVariable* var_name_index, Label* if_not_found, LookupMode mode) { - static_assert(std::is_same::value || - std::is_same::value || - std::is_same::value, + static_assert(std::is_same_v || + std::is_same_v || + std::is_same_v, "Unexpected NameDictionary"); DCHECK_IMPLIES(var_name_index != nullptr, MachineType::PointerRepresentation() == var_name_index->rep()); @@ -10196,11 +10184,11 @@ void CodeStubAssembler::NameDictionaryLookupWithForwardIndex( TVariable* var_name_index, Label* if_not_found, LookupMode mode) { using ER = ExternalReference; // To avoid super long lines below. ER func_ref; - if constexpr (std::is_same::value) { + if constexpr (std::is_same_v) { func_ref = mode == kFindInsertionIndex ? ER::name_dictionary_find_insertion_entry_forwarded_string() : ER::name_dictionary_lookup_forwarded_string(); - } else if constexpr (std::is_same::value) { + } else if constexpr (std::is_same_v) { func_ref = mode == kFindInsertionIndex ? ER::global_dictionary_find_insertion_entry_forwarded_string() @@ -10571,9 +10559,9 @@ void CodeStubAssembler::LookupLinear(TNode unique_name, Label* if_found, TVariable* var_name_index, Label* if_not_found) { - static_assert(std::is_base_of::value || - std::is_base_of::value || - std::is_base_of::value, + static_assert(std::is_base_of_v || + std::is_base_of_v || + std::is_base_of_v, "T must be a descendant of FixedArray or a WeakFixedArray"); Comment("LookupLinear"); CSA_DCHECK(this, IsUniqueName(unique_name)); @@ -10662,8 +10650,8 @@ TNode CodeStubAssembler::GetSortedKeyIndex( template TNode CodeStubAssembler::GetKey(TNode array, TNode entry_index) { - static_assert(std::is_base_of::value || - std::is_base_of::value, + static_assert(std::is_base_of_v || + std::is_base_of_v, "T must be a descendant of DescriptorArray or TransitionArray"); const int key_offset = Array::ToKeyIndex(0) * kTaggedSize; TNode element = @@ -12315,17 +12303,16 @@ template TNode CodeStubAssembler::ElementOffsetFromIndex( TNode index_node, ElementsKind kind, int base_size) { // TODO(v8:9708): Remove IntPtrT variant in favor of UintPtrT. - static_assert(std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value, - "Only Smi, UintPtrT or IntPtrT index nodes are allowed"); + static_assert( + std::is_same_v || std::is_same_v || + std::is_same_v || std::is_same_v, + "Only Smi, UintPtrT or IntPtrT index nodes are allowed"); int element_size_shift = ElementsKindToShiftSize(kind); int element_size = 1 << element_size_shift; intptr_t index = 0; TNode intptr_index_node; bool constant_index = false; - if (std::is_same::value) { + if (std::is_same_v) { TNode smi_index_node = ReinterpretCast(index_node); int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize; element_size_shift -= kSmiShiftBits; @@ -12339,7 +12326,7 @@ TNode CodeStubAssembler::ElementOffsetFromIndex( } } intptr_index_node = BitcastTaggedToWordForTagAndSmiBits(smi_index_node); - } else if (std::is_same::value) { + } else if (std::is_same_v) { TNode tagged_index_node = ReinterpretCast(index_node); element_size_shift -= kSmiTagSize; @@ -12699,9 +12686,9 @@ void CodeStubAssembler::StoreElementTypedArrayBigInt(TNode elements, ElementsKind kind, TNode index, TNode value) { - static_assert(std::is_same::value || - std::is_same::value, - "Only UintPtrT or IntPtrT indices is allowed"); + static_assert( + std::is_same_v || std::is_same_v, + "Only UintPtrT or IntPtrT indices is allowed"); DCHECK(kind == BIGINT64_ELEMENTS || kind == BIGUINT64_ELEMENTS); TNode offset = ElementOffsetFromIndex(index, kind, 0); TVARIABLE(UintPtrT, var_low); @@ -12750,9 +12737,9 @@ void CodeStubAssembler::StoreElementTypedArrayWord32(TNode elements, ElementsKind kind, TNode index, TNode value) { - static_assert(std::is_same::value || - std::is_same::value, - "Only UintPtrT or IntPtrT indices is allowed"); + static_assert( + std::is_same_v || std::is_same_v, + "Only UintPtrT or IntPtrT indices is allowed"); DCHECK(IsTypedArrayElementsKind(kind)); if (kind == UINT8_CLAMPED_ELEMENTS) { CSA_DCHECK(this, Word32Equal(value, Word32And(Int32Constant(0xFF), value))); @@ -12785,20 +12772,19 @@ void CodeStubAssembler::StoreElementTypedArray(TNode elements, TNode index, TNode value) { // TODO(v8:9708): Do we want to keep both IntPtrT and UintPtrT variants? - static_assert(std::is_same::value || - std::is_same::value || - std::is_same::value, + static_assert(std::is_same_v || + std::is_same_v || + std::is_same_v, "Only Smi, UintPtrT or IntPtrT indices is allowed"); - static_assert(std::is_same::value || - std::is_same::value, - "Only RawPtrT or FixedArrayBase elements are allowed"); - static_assert(std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value, - "Only Int32T, Float32T, Float64T or object value " - "types are allowed"); + static_assert( + std::is_same_v || std::is_same_v, + "Only RawPtrT or FixedArrayBase elements are allowed"); + static_assert( + std::is_same_v || + std::is_same_v || std::is_same_v || + std::is_same_v || std::is_same_v, + "Only Int32T, Float32T, Float64T or object value " + "types are allowed"); DCHECK(IsTypedArrayElementsKind(kind)); TNode offset = ElementOffsetFromIndex(index, kind, 0); // TODO(cbruni): Add OOB check once typed. @@ -12810,9 +12796,8 @@ template void CodeStubAssembler::StoreElement(TNode elements, ElementsKind kind, TNode index, TNode value) { - static_assert( - std::is_same::value || std::is_same::value, - "Only Smi or IntPtrT indices are allowed"); + static_assert(std::is_same_v || std::is_same_v, + "Only Smi or IntPtrT indices are allowed"); DCHECK(!IsDoubleElementsKind(kind)); if (IsTypedArrayElementsKind(kind)) { StoreElementTypedArray(elements, kind, index, value); @@ -12828,9 +12813,8 @@ template void CodeStubAssembler::StoreElement(TNode elements, ElementsKind kind, TNode index, TNode value) { - static_assert( - std::is_same::value || std::is_same::value, - "Only Smi or IntPtrT indices are allowed"); + static_assert(std::is_same_v || std::is_same_v, + "Only Smi or IntPtrT indices are allowed"); DCHECK(IsDoubleElementsKind(kind)); StoreFixedDoubleArrayElement(CAST(elements), index, value); } @@ -12838,17 +12822,15 @@ void CodeStubAssembler::StoreElement(TNode elements, template void CodeStubAssembler::StoreElement(TNode elements, ElementsKind kind, TNode index, TNode value) { - static_assert(std::is_same::value || - std::is_same::value || - std::is_same::value, + static_assert(std::is_same_v || + std::is_same_v || + std::is_same_v, "Only Smi, IntPtrT or UintPtrT indices are allowed"); static_assert( - std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value, + std::is_same_v || + std::is_same_v || std::is_same_v || + std::is_same_v || + std::is_same_v || std::is_same_v, "Only Int32T, Word32T, Float32T, Float64T or BigInt value types " "are allowed"); @@ -13819,7 +13801,7 @@ void CodeStubAssembler::BuildFastLoop( // Update the index comparisons below in case we'd ever want to use Smi // indexes. static_assert( - !std::is_same::value, + !std::is_same_v, "Smi indices are currently not supported because it's not clear whether " "the use case allows unsigned comparisons or not"); var_index = start_index; diff --git a/src/codegen/external-reference.cc b/src/codegen/external-reference.cc index 140d44ed047..dc5b2e00466 100644 --- a/src/codegen/external-reference.cc +++ b/src/codegen/external-reference.cc @@ -406,7 +406,7 @@ namespace { // allow void. template constexpr bool AllScalar() { - return std::is_scalar::value || std::is_void::value; + return std::is_scalar_v || std::is_void_v; } template diff --git a/src/codegen/source-position-table.cc b/src/codegen/source-position-table.cc index 355fba9ac7f..42accbc12b8 100644 --- a/src/codegen/source-position-table.cc +++ b/src/codegen/source-position-table.cc @@ -55,7 +55,7 @@ void SubtractFromEntry(PositionTableEntry* value, // Helper: Encode an integer. template void EncodeInt(ZoneVector* bytes, T value) { - using unsigned_type = typename std::make_unsigned::type; + using unsigned_type = std::make_unsigned_t; // Zig-zag encoding. static constexpr int kShift = sizeof(T) * kBitsPerByte - 1; value = ((static_cast(value) << 1) ^ (value >> kShift)); @@ -94,8 +94,7 @@ T DecodeInt(base::Vector bytes, int* index) { bool more; do { current = bytes[(*index)++]; - decoded |= static_cast::type>( - ValueBits::decode(current)) + decoded |= static_cast>(ValueBits::decode(current)) << shift; more = MoreBit::decode(current); shift += ValueBits::kSize; diff --git a/src/codegen/x64/macro-assembler-x64.cc b/src/codegen/x64/macro-assembler-x64.cc index 0b81edd9a68..047fdcca667 100644 --- a/src/codegen/x64/macro-assembler-x64.cc +++ b/src/codegen/x64/macro-assembler-x64.cc @@ -189,7 +189,7 @@ Operand MacroAssembler::RootAsOperand(RootIndex index) { void MacroAssembler::LoadTaggedRoot(Register destination, RootIndex index) { static_assert(!CanBeImmediate(RootIndex::kUndefinedValue) || - std::is_same::value); + std::is_same_v); if (CanBeImmediate(index)) { mov_tagged(destination, Immediate(static_cast(ReadOnlyRootPtr(index)))); diff --git a/src/compiler/backend/instruction-selector.cc b/src/compiler/backend/instruction-selector.cc index f8a766b628c..6e5c2dd598e 100644 --- a/src/compiler/backend/instruction-selector.cc +++ b/src/compiler/backend/instruction-selector.cc @@ -3135,7 +3135,7 @@ void InstructionSelectorT::VisitComment(node_t node) { ->Get(node) .template Cast(); using ptrsize_int_t = - std::conditional::type; + std::conditional_t; InstructionOperand operand = sequence()->AddImmediate( Constant{reinterpret_cast(comment.message)}); Emit(kArchComment, 0, nullptr, 1, &operand); diff --git a/src/compiler/code-assembler.cc b/src/compiler/code-assembler.cc index c7729f744e6..98d98966a4e 100644 --- a/src/compiler/code-assembler.cc +++ b/src/compiler/code-assembler.cc @@ -39,13 +39,13 @@ constexpr MachineType MachineTypeOf::value; namespace compiler { -static_assert(std::is_convertible, TNode>::value, +static_assert(std::is_convertible_v, TNode>, "test subtyping"); static_assert( - std::is_convertible, TNode>>::value, + std::is_convertible_v, TNode>>, "test subtyping"); static_assert( - !std::is_convertible>, TNode>::value, + !std::is_convertible_v>, TNode>, "test subtyping"); CodeAssemblerState::CodeAssemblerState( diff --git a/src/compiler/machine-operator-reducer.cc b/src/compiler/machine-operator-reducer.cc index 205888cacc1..2da3715a58f 100644 --- a/src/compiler/machine-operator-reducer.cc +++ b/src/compiler/machine-operator-reducer.cc @@ -1625,7 +1625,7 @@ namespace { // overflow". template bool CanRevertLeftShiftWithRightShift(T value, T shift) { - using unsigned_T = typename std::make_unsigned::type; + using unsigned_T = std::make_unsigned_t; if (shift < 0 || shift >= std::numeric_limits::digits + 1) { // This shift would be UB in C++ return false; diff --git a/src/d8/d8.cc b/src/d8/d8.cc index ef81fbe0b80..895b890ce40 100644 --- a/src/d8/d8.cc +++ b/src/d8/d8.cc @@ -679,7 +679,7 @@ MaybeLocal Shell::CompileString(Isolate* isolate, Local context, v8::ScriptCompiler::StreamedSource::TWO_BYTE); std::unique_ptr streaming_task( v8::ScriptCompiler::StartStreaming(isolate, &streamed_source, - std::is_same::value + std::is_same_v ? v8::ScriptType::kModule : v8::ScriptType::kClassic)); StreamerThread::StartThreadForTaskAndJoin(streaming_task.get()); diff --git a/src/diagnostics/objects-printer.cc b/src/diagnostics/objects-printer.cc index 01392299f56..7059f77bbdf 100644 --- a/src/diagnostics/objects-printer.cc +++ b/src/diagnostics/objects-printer.cc @@ -513,7 +513,7 @@ double GetScalarElement(Tagged array, int index) { template void DoPrintElements(std::ostream& os, Tagged object, int length) { - const bool print_the_hole = std::is_same::value; + const bool print_the_hole = std::is_same_v; Tagged array = Cast(object); if (length == 0) return; int previous_index = 0; diff --git a/src/execution/arm/simulator-arm.cc b/src/execution/arm/simulator-arm.cc index 63ba10013f2..f59aac4b99a 100644 --- a/src/execution/arm/simulator-arm.cc +++ b/src/execution/arm/simulator-arm.cc @@ -4151,7 +4151,7 @@ template void ShiftRight(Simulator* simulator, int Vd, int Vm, int shift, bool is_unsigned) { if (is_unsigned) { - using unsigned_T = typename std::make_unsigned::type; + using unsigned_T = std::make_unsigned_t; LogicalShiftRight(simulator, Vd, Vm, shift); } else { ArithmeticShiftRight(simulator, Vd, Vm, shift); @@ -4220,7 +4220,7 @@ void ShiftByRegister(Simulator* simulator, int Vd, int Vm, int Vn) { if (shift_value >= size) { src[i] = 0; } else { - using unsignedT = typename std::make_unsigned::type; + using unsignedT = std::make_unsigned_t; src[i] = static_cast(src[i]) << shift_value; } } else { diff --git a/src/execution/arm64/simulator-arm64.cc b/src/execution/arm64/simulator-arm64.cc index 2391c3468aa..4efae03c32c 100644 --- a/src/execution/arm64/simulator-arm64.cc +++ b/src/execution/arm64/simulator-arm64.cc @@ -1095,7 +1095,7 @@ int Simulator::CodeFromName(const char* name) { template T Simulator::AddWithCarry(bool set_flags, T left, T right, int carry_in) { // Use unsigned types to avoid implementation-defined overflow behaviour. - static_assert(std::is_unsigned::value, "operands must be unsigned"); + static_assert(std::is_unsigned_v, "operands must be unsigned"); static_assert((sizeof(T) == kWRegSize) || (sizeof(T) == kXRegSize), "Only W- or X-sized operands are tested"); @@ -1126,7 +1126,7 @@ T Simulator::AddWithCarry(bool set_flags, T left, T right, int carry_in) { template void Simulator::AddSubWithCarry(Instruction* instr) { // Use unsigned types to avoid implementation-defined overflow behaviour. - static_assert(std::is_unsigned::value, "operands must be unsigned"); + static_assert(std::is_unsigned_v, "operands must be unsigned"); T op2 = reg(instr->Rm()); T new_val; @@ -1169,7 +1169,7 @@ sim_uint128_t Simulator::Eor128(sim_uint128_t x, sim_uint128_t y) const { template T Simulator::ShiftOperand(T value, Shift shift_type, unsigned amount) { - using unsignedT = typename std::make_unsigned::type; + using unsignedT = std::make_unsigned_t; if (amount == 0) { return value; @@ -1200,7 +1200,7 @@ T Simulator::ExtendValue(T value, Extend extend_type, unsigned left_shift) { const unsigned kSignExtendBShift = (sizeof(T) - 1) * 8; const unsigned kSignExtendHShift = (sizeof(T) - 2) * 8; const unsigned kSignExtendWShift = (sizeof(T) - 4) * 8; - using unsignedT = typename std::make_unsigned::type; + using unsignedT = std::make_unsigned_t; switch (extend_type) { case UXTB: @@ -1871,7 +1871,7 @@ void Simulator::VisitCompareBranch(Instruction* instr) { template void Simulator::AddSubHelper(Instruction* instr, T op2) { // Use unsigned types to avoid implementation-defined overflow behaviour. - static_assert(std::is_unsigned::value, "operands must be unsigned"); + static_assert(std::is_unsigned_v, "operands must be unsigned"); bool set_flags = instr->FlagsUpdate(); T new_val = 0; @@ -2017,7 +2017,7 @@ void Simulator::VisitConditionalCompareImmediate(Instruction* instr) { template void Simulator::ConditionalCompareHelper(Instruction* instr, T op2) { // Use unsigned types to avoid implementation-defined overflow behaviour. - static_assert(std::is_unsigned::value, "operands must be unsigned"); + static_assert(std::is_unsigned_v, "operands must be unsigned"); T op1 = reg(instr->Rn()); @@ -3071,7 +3071,7 @@ void Simulator::DataProcessing2Source(Instruction* instr) { } case UDIV_w: case UDIV_x: { - using unsignedT = typename std::make_unsigned::type; + using unsignedT = std::make_unsigned_t; unsignedT rn = static_cast(reg(instr->Rn())); unsignedT rm = static_cast(reg(instr->Rm())); if (rm == 0) { @@ -3179,7 +3179,7 @@ void Simulator::VisitDataProcessing3Source(Instruction* instr) { template void Simulator::BitfieldHelper(Instruction* instr) { - using unsignedT = typename std::make_unsigned::type; + using unsignedT = std::make_unsigned_t; T reg_size = sizeof(T) * 8; T R = instr->ImmR(); T S = instr->ImmS(); diff --git a/src/execution/arm64/simulator-logic-arm64.cc b/src/execution/arm64/simulator-logic-arm64.cc index e1e88aec04f..6a58cce4f80 100644 --- a/src/execution/arm64/simulator-logic-arm64.cc +++ b/src/execution/arm64/simulator-logic-arm64.cc @@ -4032,7 +4032,7 @@ inline uint64_t Bits(uint64_t val, int start_bit, int end_bit) { template T Simulator::FPRecipSqrtEstimate(T op) { - static_assert(std::is_same::value || std::is_same::value, + static_assert(std::is_same_v || std::is_same_v, "T must be a float or double"); if (std::isnan(op)) { @@ -4119,7 +4119,7 @@ LogicVRegister Simulator::frsqrte(VectorFormat vform, LogicVRegister dst, template T Simulator::FPRecipEstimate(T op, FPRounding rounding) { - static_assert(std::is_same::value || std::is_same::value, + static_assert(std::is_same_v || std::is_same_v, "T must be a float or double"); uint32_t sign; diff --git a/src/heap/cppgc/caged-heap-local-data.cc b/src/heap/cppgc/caged-heap-local-data.cc index 398dfe2af87..35ac1a6bda0 100644 --- a/src/heap/cppgc/caged-heap-local-data.cc +++ b/src/heap/cppgc/caged-heap-local-data.cc @@ -16,7 +16,7 @@ namespace internal { #if defined(CPPGC_YOUNG_GENERATION) static_assert( - std::is_trivially_default_constructible::value, + std::is_trivially_default_constructible_v, "To support lazy committing, AgeTable must be trivially constructible"); void AgeTable::SetAgeForRange(uintptr_t offset_begin, uintptr_t offset_end, diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc index f37518331a5..777b1b432f9 100644 --- a/src/heap/mark-compact.cc +++ b/src/heap/mark-compact.cc @@ -4208,16 +4208,16 @@ template static inline void UpdateSlot(PtrComprCageBase cage_base, TSlot slot, Tagged heap_obj) { static_assert( - std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same::value || - std::is_same>::value || - std::is_same>::value, + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v || + std::is_same_v> || + std::is_same_v>, "Only [Full|OffHeap]ObjectSlot, [Full]MaybeObjectSlot, " "InstructionStreamSlot, Protected[Pointer|MaybeObject]Slot, " "or WriteProtectedSlot are expected here"); @@ -5216,8 +5216,8 @@ class RememberedSetUpdatingItem : public UpdatingItem { inline void CheckAndUpdateOldToNewSlot(TSlot slot, const PtrComprCageBase cage_base) { static_assert( - std::is_same::value || - std::is_same::value, + std::is_same_v || + std::is_same_v, "Only FullMaybeObjectSlot and MaybeObjectSlot are expected here"); Tagged heap_object; if (!(*slot).GetHeapObject(&heap_object)) return; diff --git a/src/heap/scavenger.cc b/src/heap/scavenger.cc index b5d4c564ae2..b3b94f27165 100644 --- a/src/heap/scavenger.cc +++ b/src/heap/scavenger.cc @@ -156,8 +156,8 @@ class IterateAndScavengePromotedObjectsVisitor final V8_INLINE void HandleSlot(Tagged host, THeapObjectSlot slot, Tagged target) { static_assert( - std::is_same::value || - std::is_same::value, + std::is_same_v || + std::is_same_v, "Only FullHeapObjectSlot and HeapObjectSlot are expected here"); scavenger_->SynchronizePageAccess(target); diff --git a/src/ic/ic.cc b/src/ic/ic.cc index 9022736de53..9e28010195e 100644 --- a/src/ic/ic.cc +++ b/src/ic/ic.cc @@ -1173,7 +1173,7 @@ bool AllowedHandlerChange(KeyedAccessLoadMode old_mode, KeyedAccessLoadMode new_mode) { // Only allow transitions to allow OOB or allow converting a hole to // undefined. - using T = std::underlying_type::type; + using T = std::underlying_type_t; return ((static_cast(old_mode) ^ static_cast(GeneralizeKeyedAccessLoadMode(old_mode, new_mode))) & 0b11) != 0; diff --git a/src/json/json-stringifier.cc b/src/json/json-stringifier.cc index 781a1993c1a..e04b7c90b1a 100644 --- a/src/json/json-stringifier.cc +++ b/src/json/json-stringifier.cc @@ -1121,8 +1121,8 @@ template JsonStringifier::Result JsonStringifier::SerializeFixedArrayWithInterruptCheck( DirectHandle array, uint32_t length, uint32_t* slow_path_index) { static_assert(IsSmiElementsKind(kind) || IsDoubleElementsKind(kind)); - using ArrayT = typename std::conditional::type; + using ArrayT = std::conditional_t; StackLimitCheck interrupt_check(isolate_); constexpr uint32_t kInterruptLength = 4000; @@ -2343,8 +2343,8 @@ FastJsonStringifierResult FastJsonStringifier::SerializeFixedArrayWithInterruptCheck( Tagged array, uint32_t length, uint32_t start_index, uint32_t* bailout_idx) { - using ArrayT = typename std::conditional::type; + using ArrayT = std::conditional_t; StackLimitCheck interrupt_check(isolate_); uint32_t limit = std::min(length, kArrayInterruptLength); @@ -2385,8 +2385,8 @@ template template FastJsonStringifierResult FastJsonStringifier::SerializeFixedArray( Tagged array, uint32_t limit, uint32_t start_index) { - using ArrayT = typename std::conditional::type; + using ArrayT = std::conditional_t; for (uint32_t i = start_index; i < limit; i++) { FastJsonStringifierResult result = SerializeFixedArrayElement( diff --git a/src/maglev/maglev-code-generator.cc b/src/maglev/maglev-code-generator.cc index 908581376a0..23ebc430c87 100644 --- a/src/maglev/maglev-code-generator.cc +++ b/src/maglev/maglev-code-generator.cc @@ -807,7 +807,7 @@ class MaglevCodeGeneratingNodeProcessor { PatchJumps(node); // Emit Phi moves before visiting the control node. - if (std::is_base_of::value) { + if (std::is_base_of_v) { EmitBlockEndGapMoves(node->template Cast(), state); } @@ -850,7 +850,7 @@ class MaglevCodeGeneratingNodeProcessor { masm()->set_allow_deferred_call(false); #endif - if (std::is_base_of::value) { + if (std::is_base_of_v) { ValueNode* value_node = node->template Cast(); if (value_node->has_valid_live_range() && value_node->is_spilled()) { compiler::AllocatedOperand source = diff --git a/src/maglev/maglev-interpreter-frame-state.cc b/src/maglev/maglev-interpreter-frame-state.cc index 32900e4bda0..b7ffe3017f0 100644 --- a/src/maglev/maglev-interpreter-frame-state.cc +++ b/src/maglev/maglev-interpreter-frame-state.cc @@ -222,7 +222,7 @@ bool AspectIncludes(const As& as, const Bs& bs, const CompareFunction& Compare, typename As::const_iterator a = as.begin(); typename Bs::const_iterator b = bs.begin(); while (a != as.end()) { - if constexpr (!std::is_same::value) { + if constexpr (!std::is_same_v) { if (IsEmpty(a->second)) { ++a; continue; diff --git a/src/objects/bigint.cc b/src/objects/bigint.cc index e73bb509e67..cb7e1cdb406 100644 --- a/src/objects/bigint.cc +++ b/src/objects/bigint.cc @@ -132,7 +132,7 @@ V8_OBJECT class MutableBigInt : public FreshlyAllocatedBigInt { static bool IsMutableBigInt(Tagged o) { return IsBigInt(o); } - static_assert(std::is_same::value, + static_assert(std::is_same_v, "We must be able to call BigInt library functions"); NEVER_READ_ONLY_SPACE diff --git a/src/objects/elements.cc b/src/objects/elements.cc index 4a609c42561..bb4f40f0340 100644 --- a/src/objects/elements.cc +++ b/src/objects/elements.cc @@ -3738,7 +3738,7 @@ class TypedElementsAccessor double search_value = Object::NumberValue(*value); if (!std::isfinite(search_value)) { if (!IsFloat16TypedArrayElementsKind(Kind) && - std::is_integral::value) { + std::is_integral_v) { // Integral types cannot represent +Inf or NaN. return Just(-1); } else if (std::isnan(search_value)) { diff --git a/src/objects/literal-objects.cc b/src/objects/literal-objects.cc index 5ecec0473cf..b29eb241b54 100644 --- a/src/objects/literal-objects.cc +++ b/src/objects/literal-objects.cc @@ -170,8 +170,8 @@ void DictionaryUpdateMaxNumberKey(HandleType dictionary, requires( std::is_convertible_v, DirectHandle>) { - static_assert((std::is_same::value || - std::is_same::value)); + static_assert((std::is_same_v || + std::is_same_v)); // No-op for (ordered) name dictionaries. } @@ -204,10 +204,10 @@ void AddToDictionaryTemplate(IsolateT* isolate, Handle dictionary, InternalIndex entry = dictionary->FindEntry(isolate, key); const bool is_elements_dictionary = - std::is_same::value; + std::is_same_v; static_assert(is_elements_dictionary != - (std::is_same::value || - std::is_same::value)); + (std::is_same_v || + std::is_same_v)); if (entry.is_not_found()) { // Entry not found, add new one. diff --git a/src/objects/objects.cc b/src/objects/objects.cc index fd0e1f02bd9..ae8be32bd59 100644 --- a/src/objects/objects.cc +++ b/src/objects/objects.cc @@ -5890,7 +5890,7 @@ DirectHandle BaseNameDictionary::IterationIndices( // The global dictionary doesn't track its deletion count, so we may iterate // fewer entries than the count of elements claimed by the dictionary. - if (std::is_same::value) { + if (std::is_same_v) { DCHECK_LE(array_size, dictionary->NumberOfElements()); } else { DCHECK_EQ(array_size, dictionary->NumberOfElements()); diff --git a/src/objects/simd.cc b/src/objects/simd.cc index d6e9ecf8f0d..0d3e561d5b0 100644 --- a/src/objects/simd.cc +++ b/src/objects/simd.cc @@ -173,11 +173,11 @@ template inline uintptr_t fast_search_noavx(T* array, uintptr_t array_len, uintptr_t index, T search_element) { static constexpr bool is_uint32 = - sizeof(T) == sizeof(uint32_t) && std::is_integral::value; + sizeof(T) == sizeof(uint32_t) && std::is_integral_v; static constexpr bool is_uint64 = - sizeof(T) == sizeof(uint64_t) && std::is_integral::value; + sizeof(T) == sizeof(uint64_t) && std::is_integral_v; static constexpr bool is_double = - sizeof(T) == sizeof(double) && std::is_floating_point::value; + sizeof(T) == sizeof(double) && std::is_floating_point_v; static_assert(is_uint32 || is_uint64 || is_double); @@ -275,11 +275,11 @@ TARGET_AVX2 inline uintptr_t fast_search_avx(T* array, uintptr_t array_len, uintptr_t index, T search_element) { static constexpr bool is_uint32 = - sizeof(T) == sizeof(uint32_t) && std::is_integral::value; + sizeof(T) == sizeof(uint32_t) && std::is_integral_v; static constexpr bool is_uint64 = - sizeof(T) == sizeof(uint64_t) && std::is_integral::value; + sizeof(T) == sizeof(uint64_t) && std::is_integral_v; static constexpr bool is_double = - sizeof(T) == sizeof(double) && std::is_floating_point::value; + sizeof(T) == sizeof(double) && std::is_floating_point_v; static_assert(is_uint32 || is_uint64 || is_double); diff --git a/src/objects/value-serializer.cc b/src/objects/value-serializer.cc index b199698f1a0..49c5daa25e7 100644 --- a/src/objects/value-serializer.cc +++ b/src/objects/value-serializer.cc @@ -104,7 +104,7 @@ using JSArrayBufferViewIsBackedByRab = template static size_t BytesNeededForVarint(T value) { - static_assert(std::is_integral::value && std::is_unsigned::value, + static_assert(std::is_integral_v && std::is_unsigned_v, "Only unsigned integer types can be written as varints."); size_t result = 0; do { @@ -330,7 +330,7 @@ void ValueSerializer::WriteVarint(T value) { // The number is written, 7 bits at a time, from the least significant to the // most significant 7 bits. Each byte, except the last, has the MSB set. // See also https://developers.google.com/protocol-buffers/docs/encoding - static_assert(std::is_integral::value && std::is_unsigned::value, + static_assert(std::is_integral_v && std::is_unsigned_v, "Only unsigned integer types can be written as varints."); uint8_t stack_buffer[sizeof(T) * 8 / 7 + 1]; uint8_t* next_byte = &stack_buffer[0]; @@ -349,9 +349,9 @@ void ValueSerializer::WriteZigZag(T value) { // encoded as 0, -1 as 1, 1 as 2, -2 as 3, and so on). // See also https://developers.google.com/protocol-buffers/docs/encoding // Note that this implementation relies on the right shift being arithmetic. - static_assert(std::is_integral::value && std::is_signed::value, + static_assert(std::is_integral_v && std::is_signed_v, "Only signed integer types can be written as zigzag."); - using UnsignedT = typename std::make_unsigned::type; + using UnsignedT = std::make_unsigned_t; WriteVarint((static_cast(value) << 1) ^ (value >> (8 * sizeof(T) - 1))); } @@ -1351,7 +1351,7 @@ Maybe ValueDeserializer::ReadVarint() { // most significant 7 bits. Each byte, except the last, has the MSB set. // If the varint is larger than T, any more significant bits are discarded. // See also https://developers.google.com/protocol-buffers/docs/encoding - static_assert(std::is_integral::value && std::is_unsigned::value, + static_assert(std::is_integral_v && std::is_unsigned_v, "Only unsigned integer types can be read as varints."); if (sizeof(T) > 4) return ReadVarintLoop(); auto max_read_position = position_ + sizeof(T) + 1; @@ -1401,7 +1401,7 @@ Maybe ValueDeserializer::ReadVarint() { template Maybe ValueDeserializer::ReadVarintLoop() { - static_assert(std::is_integral::value && std::is_unsigned::value, + static_assert(std::is_integral_v && std::is_unsigned_v, "Only unsigned integer types can be read as varints."); T value = 0; unsigned shift = 0; @@ -1431,9 +1431,9 @@ Maybe ValueDeserializer::ReadZigZag() { // Writes a signed integer as a varint using ZigZag encoding (i.e. 0 is // encoded as 0, -1 as 1, 1 as 2, -2 as 3, and so on). // See also https://developers.google.com/protocol-buffers/docs/encoding - static_assert(std::is_integral::value && std::is_signed::value, + static_assert(std::is_integral_v && std::is_signed_v, "Only signed integer types can be read as zigzag."); - using UnsignedT = typename std::make_unsigned::type; + using UnsignedT = std::make_unsigned_t; UnsignedT unsigned_value; if (!ReadVarint().To(&unsigned_value)) return Nothing(); return Just(static_cast((unsigned_value >> 1) ^ diff --git a/src/regexp/experimental/experimental.cc b/src/regexp/experimental/experimental.cc index 543bf560f2c..b219589e0d9 100644 --- a/src/regexp/experimental/experimental.cc +++ b/src/regexp/experimental/experimental.cc @@ -57,7 +57,7 @@ bool ExperimentalRegExp::IsCompiled(DirectHandle re_data, template Handle VectorToByteArray(Isolate* isolate, base::Vector data) { - static_assert(std::is_trivial::value); + static_assert(std::is_trivial_v); int byte_length = sizeof(T) * data.length(); Handle byte_array = diff --git a/src/runtime/runtime-classes.cc b/src/runtime/runtime-classes.cc index a4e9c8d7460..2350898990c 100644 --- a/src/runtime/runtime-classes.cc +++ b/src/runtime/runtime-classes.cc @@ -119,8 +119,8 @@ namespace { template Handle KeyToName(Isolate* isolate, Handle key) { - static_assert((std::is_same::value || - std::is_same::value)); + static_assert((std::is_same_v || + std::is_same_v)); DCHECK(IsName(*key)); return Cast(key); } diff --git a/src/runtime/runtime-typedarray.cc b/src/runtime/runtime-typedarray.cc index 84f932585d3..7eaa3544c8b 100644 --- a/src/runtime/runtime-typedarray.cc +++ b/src/runtime/runtime-typedarray.cc @@ -82,7 +82,7 @@ bool CompareNum(T x, T y) { return true; } else if (x > y) { return false; - } else if (!std::is_integral::value) { + } else if (!std::is_integral_v) { double _x = x, _y = y; if (x == 0 && x == y) { /* -0.0 is less than +0.0 */ diff --git a/src/strings/string-case.cc b/src/strings/string-case.cc index 820c655cf23..11c7232d988 100644 --- a/src/strings/string-case.cc +++ b/src/strings/string-case.cc @@ -15,7 +15,7 @@ namespace internal { // FastAsciiConvert tries to do character processing on a word_t basis if // source and destination strings are properly aligned. Natural alignment of // string data depends on kTaggedSize so we define word_t via Tagged_t. -using word_t = std::make_unsigned::type; +using word_t = std::make_unsigned_t; const word_t kWordTAllBitsSet = std::numeric_limits::max(); const word_t kOneInEveryByte = kWordTAllBitsSet / 0xFF; diff --git a/src/wasm/baseline/liftoff-compiler.cc b/src/wasm/baseline/liftoff-compiler.cc index 43cbff33c84..ab9e7bb8a47 100644 --- a/src/wasm/baseline/liftoff-compiler.cc +++ b/src/wasm/baseline/liftoff-compiler.cc @@ -1996,14 +1996,14 @@ class LiftoffCompiler { template void CallEmitFn(EmitFn fn, Args... args) - requires(!std::is_member_function_pointer::value) + requires(!std::is_member_function_pointer_v) { fn(args...); } template void CallEmitFn(EmitFn fn, Args... args) - requires std::is_member_function_pointer::value + requires std::is_member_function_pointer_v { (asm_.*fn)(ConvertAssemblerArg(args)...); } @@ -2020,8 +2020,8 @@ class LiftoffCompiler { // Convert {LiftoffRegister} to {AssemblerRegisterConverter}, other types stay // unchanged. template - typename std::conditional::value, - AssemblerRegisterConverter, T>::type + std::conditional_t, + AssemblerRegisterConverter, T> ConvertAssemblerArg(T t) { return {t}; } diff --git a/src/wasm/fuzzing/random-module-generation.cc b/src/wasm/fuzzing/random-module-generation.cc index 93fa29a8b0f..ad7066ec61c 100644 --- a/src/wasm/fuzzing/random-module-generation.cc +++ b/src/wasm/fuzzing/random-module-generation.cc @@ -138,7 +138,7 @@ class DataRange { template T getPseudoRandom() { - static_assert(!std::is_same::value, "bool needs special handling"); + static_assert(!std::is_same_v, "bool needs special handling"); static_assert(max_bytes <= sizeof(T)); // Special handling for signed integers: Calling getPseudoRandom // () should be equal to getPseudoRandom(). (The NextBytes() below @@ -167,7 +167,7 @@ class DataRange { template T get() { // Bool needs special handling (see template specialization below). - static_assert(!std::is_same::value, "bool needs special handling"); + static_assert(!std::is_same_v, "bool needs special handling"); // We want to support the case where we have less than sizeof(T) bytes // remaining in the slice. We'll just use what we have, so we get a bit of diff --git a/src/wasm/wasm-serialization.cc b/src/wasm/wasm-serialization.cc index f24e79ba5bd..b3868ea9669 100644 --- a/src/wasm/wasm-serialization.cc +++ b/src/wasm/wasm-serialization.cc @@ -297,7 +297,7 @@ class ExternalReferenceList { uint32_t tags_ordered_by_address_[kNumExternalReferences]; }; -static_assert(std::is_trivially_destructible::value, +static_assert(std::is_trivially_destructible_v, "static destructors not allowed"); } // namespace