[cleanup] Use type trait typedefs (foo_t<T> over foo<T>::type)
Run clang-tidy modernize-type-traits. Change-Id: Ie196acc5bfe1ee4a20a6e07aa0bec8fceb5844d7 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6087924 Reviewed-by: Clemens Backes <clemensb@chromium.org> Commit-Queue: Clemens Backes <clemensb@chromium.org> Auto-Submit: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/main@{#97729}
This commit is contained in:
1 parent
3c2f11e056
commit
8889d80370
38 files changed
+178
-198
No files matched your search
@@ -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,
|
||||
|
||||
+2
-2
@@ -793,7 +793,7 @@ constexpr InstanceTypeChecker::TaggedAddressRange kStringMapRange =
|
||||
V(StringMapLowerBound, kStringMapRange.first) \
|
||||
V(StringMapUpperBound, kStringMapRange.second)
|
||||
|
||||
static_assert(std::is_same<Internals::Tagged_t, Tagged_t>::value);
|
||||
static_assert(std::is_same_v<Internals::Tagged_t, Tagged_t>);
|
||||
// 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<T>& info) {
|
||||
CHECK(i::IsSmi(key) || i::IsName(key));
|
||||
CHECK(info.Data()->IsValue());
|
||||
USE(info.ShouldThrowOnError());
|
||||
if (!std::is_same<T, void>::value) {
|
||||
if (!std::is_same_v<T, void>) {
|
||||
CHECK(info.GetReturnValue().Get()->IsValue());
|
||||
}
|
||||
return true;
|
||||
|
||||
+1
-1
@@ -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<IsolateT, Isolate>::value) {
|
||||
if constexpr (std::is_same_v<IsolateT, Isolate>) {
|
||||
isolate->PushStackTraceAndDie(
|
||||
reinterpret_cast<void*>(it->second->ptr()),
|
||||
reinterpret_cast<void*>(scope_info->ptr()));
|
||||
|
||||
@@ -480,9 +480,9 @@ void CallOrConstructBuiltinsAssembler::CallOrConstructWithSpread(
|
||||
template <class Descriptor>
|
||||
void CallOrConstructBuiltinsAssembler::CallReceiver(
|
||||
Builtin id, std::optional<TNode<Object>> receiver) {
|
||||
static_assert(std::is_same<Descriptor,
|
||||
CallTrampoline_Baseline_CompactDescriptor>::value,
|
||||
"Incompatible Descriptor");
|
||||
static_assert(
|
||||
std::is_same_v<Descriptor, CallTrampoline_Baseline_CompactDescriptor>,
|
||||
"Incompatible Descriptor");
|
||||
auto bitfield = UncheckedParameter<Word32T>(Descriptor::kBitField);
|
||||
TNode<Int32T> argc =
|
||||
Signed(DecodeWord32<
|
||||
|
||||
@@ -129,9 +129,8 @@ TNode<JSRegExpResult> RegExpBuiltinsAssembler::AllocateRegExpResult(
|
||||
Label finish_initialization(this);
|
||||
GotoIfNot(has_indices, &finish_initialization, GotoHint::kLabel);
|
||||
{
|
||||
static_assert(
|
||||
std::is_base_of<JSRegExpResult, JSRegExpResultWithIndices>::value,
|
||||
"JSRegExpResultWithIndices is a subclass of JSRegExpResult");
|
||||
static_assert(std::is_base_of_v<JSRegExpResult, JSRegExpResultWithIndices>,
|
||||
"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> context,
|
||||
&maybe_result_with_indices, BranchHint::kTrue);
|
||||
BIND(&maybe_result_with_indices);
|
||||
{
|
||||
static_assert(
|
||||
std::is_base_of<JSRegExpResult, JSRegExpResultWithIndices>::value,
|
||||
"JSRegExpResultWithIndices is a subclass of JSRegExpResult");
|
||||
static_assert(std::is_base_of_v<JSRegExpResult, JSRegExpResultWithIndices>,
|
||||
"JSRegExpResultWithIndices is a subclass of JSRegExpResult");
|
||||
const TNode<Object> initial_regexp_result_with_indices_map =
|
||||
LoadContextElement(native_context,
|
||||
Context::REGEXP_RESULT_WITH_INDICES_MAP_INDEX);
|
||||
|
||||
@@ -523,11 +523,11 @@ void TypedArrayBuiltinsAssembler::StoreJSTypedArrayElementFromPreparedValue(
|
||||
TNode<Context> context, TNode<JSTypedArray> typed_array,
|
||||
TNode<UintPtrT> index, TNode<TValue> prepared_value,
|
||||
ElementsKind elements_kind, Label* if_detached_or_out_of_bounds) {
|
||||
static_assert(std::is_same<TValue, Word32T>::value ||
|
||||
std::is_same<TValue, Float16RawBitsT>::value ||
|
||||
std::is_same<TValue, Float32T>::value ||
|
||||
std::is_same<TValue, Float64T>::value ||
|
||||
std::is_same<TValue, BigInt>::value,
|
||||
static_assert(std::is_same_v<TValue, Word32T> ||
|
||||
std::is_same_v<TValue, Float16RawBitsT> ||
|
||||
std::is_same_v<TValue, Float32T> ||
|
||||
std::is_same_v<TValue, Float64T> ||
|
||||
std::is_same_v<TValue, BigInt>,
|
||||
"Only Word32T, Float16T, Float32T, Float64T or BigInt values "
|
||||
"are allowed");
|
||||
// ToNumber/ToBigInt (or other functions called by the upper level) may
|
||||
|
||||
@@ -2764,10 +2764,9 @@ TNode<TValue> CodeStubAssembler::LoadArrayElement(TNode<Array> array,
|
||||
int additional_offset) {
|
||||
// TODO(v8:9708): Do we want to keep both IntPtrT and UintPtrT variants?
|
||||
static_assert(
|
||||
std::is_same<TIndex, Smi>::value ||
|
||||
std::is_same<TIndex, UintPtrT>::value ||
|
||||
std::is_same<TIndex, IntPtrT>::value ||
|
||||
std::is_same<TIndex, TaggedIndex>::value,
|
||||
std::is_same_v<TIndex, Smi> || std::is_same_v<TIndex, UintPtrT> ||
|
||||
std::is_same_v<TIndex, IntPtrT> ||
|
||||
std::is_same_v<TIndex, TaggedIndex>,
|
||||
"Only Smi, UintPtrT, IntPtrT or TaggedIndex indices are allowed");
|
||||
CSA_DCHECK(this, IntPtrGreaterThanOrEqual(ParameterToIntPtr(index_node),
|
||||
IntPtrConstant(0)));
|
||||
@@ -2802,10 +2801,9 @@ TNode<Object> CodeStubAssembler::LoadFixedArrayElement(
|
||||
CheckBounds check_bounds) {
|
||||
// TODO(v8:9708): Do we want to keep both IntPtrT and UintPtrT variants?
|
||||
static_assert(
|
||||
std::is_same<TIndex, Smi>::value ||
|
||||
std::is_same<TIndex, UintPtrT>::value ||
|
||||
std::is_same<TIndex, IntPtrT>::value ||
|
||||
std::is_same<TIndex, TaggedIndex>::value,
|
||||
std::is_same_v<TIndex, Smi> || std::is_same_v<TIndex, UintPtrT> ||
|
||||
std::is_same_v<TIndex, IntPtrT> ||
|
||||
std::is_same_v<TIndex, TaggedIndex>,
|
||||
"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<UnionOf<FixedArray, PropertyArray>> object, TNode<TIndex> index_node,
|
||||
TNode<Object> 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<TIndex, Smi>::value ||
|
||||
std::is_same<TIndex, UintPtrT>::value ||
|
||||
std::is_same<TIndex, IntPtrT>::value,
|
||||
static_assert(std::is_same_v<TIndex, Smi> ||
|
||||
std::is_same_v<TIndex, UintPtrT> ||
|
||||
std::is_same_v<TIndex, IntPtrT>,
|
||||
"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<FixedDoubleArray> object, TNode<TIndex> index, TNode<Float64T> value,
|
||||
CheckBounds check_bounds) {
|
||||
// TODO(v8:9708): Do we want to keep both IntPtrT and UintPtrT variants?
|
||||
static_assert(std::is_same<TIndex, Smi>::value ||
|
||||
std::is_same<TIndex, UintPtrT>::value ||
|
||||
std::is_same<TIndex, IntPtrT>::value,
|
||||
static_assert(std::is_same_v<TIndex, Smi> ||
|
||||
std::is_same_v<TIndex, UintPtrT> ||
|
||||
std::is_same_v<TIndex, IntPtrT>,
|
||||
"Only Smi, UintPtrT or IntPtrT index is allowed");
|
||||
if (NeedsBoundsCheck(check_bounds)) {
|
||||
FixedArrayBoundsCheck(object, index, 0);
|
||||
@@ -5141,9 +5139,8 @@ template <typename TIndex>
|
||||
TNode<FixedArrayBase> CodeStubAssembler::AllocateFixedArray(
|
||||
ElementsKind kind, TNode<TIndex> capacity, AllocationFlags flags,
|
||||
std::optional<TNode<Map>> fixed_array_map) {
|
||||
static_assert(
|
||||
std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
|
||||
"Only Smi or IntPtrT capacity is allowed");
|
||||
static_assert(std::is_same_v<TIndex, Smi> || std::is_same_v<TIndex, IntPtrT>,
|
||||
"Only Smi or IntPtrT capacity is allowed");
|
||||
Comment("AllocateFixedArray");
|
||||
CSA_DCHECK(this,
|
||||
IntPtrOrSmiGreaterThan(capacity, IntPtrOrSmiConstant<TIndex>(0)));
|
||||
@@ -5210,9 +5207,8 @@ TNode<FixedArray> CodeStubAssembler::ExtractToFixedArray(
|
||||
AllocationFlags allocation_flags, ExtractFixedArrayFlags extract_flags,
|
||||
HoleConversionMode convert_holes, TVariable<BoolT>* var_holes_converted,
|
||||
std::optional<TNode<Int32T>> source_elements_kind) {
|
||||
static_assert(
|
||||
std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
|
||||
"Only Smi or IntPtrT first, count, and capacity are allowed");
|
||||
static_assert(std::is_same_v<TIndex, Smi> || std::is_same_v<TIndex, IntPtrT>,
|
||||
"Only Smi or IntPtrT first, count, and capacity are allowed");
|
||||
|
||||
DCHECK(extract_flags & ExtractFixedArrayFlag::kFixedArrays);
|
||||
CSA_DCHECK(this,
|
||||
@@ -5309,9 +5305,8 @@ TNode<FixedArrayBase> CodeStubAssembler::ExtractFixedDoubleArrayFillingHoles(
|
||||
TNode<TIndex> capacity, TNode<Map> fixed_array_map,
|
||||
TVariable<BoolT>* var_holes_converted, AllocationFlags allocation_flags,
|
||||
ExtractFixedArrayFlags extract_flags) {
|
||||
static_assert(
|
||||
std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
|
||||
"Only Smi or IntPtrT first, count, and capacity are allowed");
|
||||
static_assert(std::is_same_v<TIndex, Smi> || std::is_same_v<TIndex, IntPtrT>,
|
||||
"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<FixedArrayBase> CodeStubAssembler::ExtractFixedArray(
|
||||
std::optional<TNode<TIndex>> count, std::optional<TNode<TIndex>> capacity,
|
||||
ExtractFixedArrayFlags extract_flags, TVariable<BoolT>* var_holes_converted,
|
||||
std::optional<TNode<Int32T>> source_elements_kind) {
|
||||
static_assert(
|
||||
std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
|
||||
"Only Smi or IntPtrT first, count, and capacity are allowed");
|
||||
static_assert(std::is_same_v<TIndex, Smi> || std::is_same_v<TIndex, IntPtrT>,
|
||||
"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<TIndex> from_index,
|
||||
TNode<TIndex> to_index,
|
||||
RootIndex value_root_index) {
|
||||
static_assert(
|
||||
std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
|
||||
"Only Smi or IntPtrT from and to are allowed");
|
||||
static_assert(std::is_same_v<TIndex, Smi> || std::is_same_v<TIndex, IntPtrT>,
|
||||
"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<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
|
||||
"Only Smi or IntPtrT indices are allowed");
|
||||
static_assert(std::is_same_v<TIndex, Smi> || std::is_same_v<TIndex, IntPtrT>,
|
||||
"Only Smi or IntPtrT indices are allowed");
|
||||
|
||||
const int first_element_offset =
|
||||
OFFSET_OF_DATA_START(FixedArray) - kHeapObjectTag;
|
||||
@@ -6179,9 +6171,8 @@ TNode<Float64T> CodeStubAssembler::LoadElementAndPrepareForStore(
|
||||
template <typename TIndex>
|
||||
TNode<TIndex> CodeStubAssembler::CalculateNewElementsCapacity(
|
||||
TNode<TIndex> old_capacity) {
|
||||
static_assert(
|
||||
std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
|
||||
"Only Smi or IntPtrT old_capacity is allowed");
|
||||
static_assert(std::is_same_v<TIndex, Smi> || std::is_same_v<TIndex, IntPtrT>,
|
||||
"Only Smi or IntPtrT old_capacity is allowed");
|
||||
Comment("TryGrowElementsCapacity");
|
||||
TNode<TIndex> half_old_capacity = WordOrSmiShr(old_capacity, 1);
|
||||
TNode<TIndex> new_capacity = IntPtrOrSmiAdd(half_old_capacity, old_capacity);
|
||||
@@ -6210,9 +6201,8 @@ template <typename TIndex>
|
||||
TNode<FixedArrayBase> CodeStubAssembler::TryGrowElementsCapacity(
|
||||
TNode<HeapObject> object, TNode<FixedArrayBase> elements, ElementsKind kind,
|
||||
TNode<TIndex> key, TNode<TIndex> capacity, Label* bailout) {
|
||||
static_assert(
|
||||
std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
|
||||
"Only Smi or IntPtrT key and capacity nodes are allowed");
|
||||
static_assert(std::is_same_v<TIndex, Smi> || std::is_same_v<TIndex, IntPtrT>,
|
||||
"Only Smi or IntPtrT key and capacity nodes are allowed");
|
||||
Comment("TryGrowElementsCapacity");
|
||||
CSA_SLOW_DCHECK(this, IsFixedArrayWithKindOrEmpty(elements, kind));
|
||||
|
||||
@@ -6234,9 +6224,8 @@ TNode<FixedArrayBase> CodeStubAssembler::GrowElementsCapacity(
|
||||
TNode<HeapObject> object, TNode<FixedArrayBase> elements,
|
||||
ElementsKind from_kind, ElementsKind to_kind, TNode<TIndex> capacity,
|
||||
TNode<TIndex> new_capacity, Label* bailout) {
|
||||
static_assert(
|
||||
std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
|
||||
"Only Smi or IntPtrT capacities are allowed");
|
||||
static_assert(std::is_same_v<TIndex, Smi> || std::is_same_v<TIndex, IntPtrT>,
|
||||
"Only Smi or IntPtrT capacities are allowed");
|
||||
Comment("[ GrowElementsCapacity");
|
||||
CSA_SLOW_DCHECK(this, IsFixedArrayWithKindOrEmpty(elements, from_kind));
|
||||
|
||||
@@ -8417,9 +8406,8 @@ TNode<IntPtrT> CodeStubAssembler::LoadMemoryChunkFlags(
|
||||
template <typename TIndex>
|
||||
TNode<BoolT> CodeStubAssembler::FixedArraySizeDoesntFitInNewSpace(
|
||||
TNode<TIndex> element_count, int base_size) {
|
||||
static_assert(
|
||||
std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
|
||||
"Only Smi or IntPtrT element_count is allowed");
|
||||
static_assert(std::is_same_v<TIndex, Smi> || std::is_same_v<TIndex, IntPtrT>,
|
||||
"Only Smi or IntPtrT element_count is allowed");
|
||||
int max_newspace_elements =
|
||||
(kMaxRegularHeapObjectSize - base_size) / kTaggedSize;
|
||||
return IntPtrOrSmiGreaterThan(
|
||||
@@ -9901,7 +9889,7 @@ TNode<MaybeObject> CodeStubAssembler::LoadFieldTypeByDescriptorEntry(
|
||||
template <class ContainerType>
|
||||
TNode<Object> CodeStubAssembler::LoadValueByKeyIndex(
|
||||
TNode<ContainerType> container, TNode<IntPtrT> key_index) {
|
||||
static_assert(!std::is_same<ContainerType, DescriptorArray>::value,
|
||||
static_assert(!std::is_same_v<ContainerType, DescriptorArray>,
|
||||
"Use the non-templatized version for DescriptorArray");
|
||||
const int kKeyToValueOffset =
|
||||
(ContainerType::kEntryValueIndex - ContainerType::kEntryKeyIndex) *
|
||||
@@ -9921,7 +9909,7 @@ V8_EXPORT_PRIVATE TNode<Object> CodeStubAssembler::LoadValueByKeyIndex(
|
||||
template <class ContainerType>
|
||||
TNode<Uint32T> CodeStubAssembler::LoadDetailsByKeyIndex(
|
||||
TNode<ContainerType> container, TNode<IntPtrT> key_index) {
|
||||
static_assert(!std::is_same<ContainerType, DescriptorArray>::value,
|
||||
static_assert(!std::is_same_v<ContainerType, DescriptorArray>,
|
||||
"Use the non-templatized version for DescriptorArray");
|
||||
const int kKeyToDetailsOffset =
|
||||
(ContainerType::kEntryDetailsIndex - ContainerType::kEntryKeyIndex) *
|
||||
@@ -10102,9 +10090,9 @@ template <typename Dictionary>
|
||||
void CodeStubAssembler::NameDictionaryLookup(
|
||||
TNode<Dictionary> dictionary, TNode<Name> unique_name, Label* if_found,
|
||||
TVariable<IntPtrT>* var_name_index, Label* if_not_found, LookupMode mode) {
|
||||
static_assert(std::is_same<Dictionary, NameDictionary>::value ||
|
||||
std::is_same<Dictionary, GlobalDictionary>::value ||
|
||||
std::is_same<Dictionary, NameToIndexHashTable>::value,
|
||||
static_assert(std::is_same_v<Dictionary, NameDictionary> ||
|
||||
std::is_same_v<Dictionary, GlobalDictionary> ||
|
||||
std::is_same_v<Dictionary, NameToIndexHashTable>,
|
||||
"Unexpected NameDictionary");
|
||||
DCHECK_IMPLIES(var_name_index != nullptr,
|
||||
MachineType::PointerRepresentation() == var_name_index->rep());
|
||||
@@ -10196,11 +10184,11 @@ void CodeStubAssembler::NameDictionaryLookupWithForwardIndex(
|
||||
TVariable<IntPtrT>* 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<Dictionary, NameDictionary>::value) {
|
||||
if constexpr (std::is_same_v<Dictionary, NameDictionary>) {
|
||||
func_ref = mode == kFindInsertionIndex
|
||||
? ER::name_dictionary_find_insertion_entry_forwarded_string()
|
||||
: ER::name_dictionary_lookup_forwarded_string();
|
||||
} else if constexpr (std::is_same<Dictionary, GlobalDictionary>::value) {
|
||||
} else if constexpr (std::is_same_v<Dictionary, GlobalDictionary>) {
|
||||
func_ref =
|
||||
mode == kFindInsertionIndex
|
||||
? ER::global_dictionary_find_insertion_entry_forwarded_string()
|
||||
@@ -10571,9 +10559,9 @@ void CodeStubAssembler::LookupLinear(TNode<Name> unique_name,
|
||||
Label* if_found,
|
||||
TVariable<IntPtrT>* var_name_index,
|
||||
Label* if_not_found) {
|
||||
static_assert(std::is_base_of<FixedArray, Array>::value ||
|
||||
std::is_base_of<WeakFixedArray, Array>::value ||
|
||||
std::is_base_of<DescriptorArray, Array>::value,
|
||||
static_assert(std::is_base_of_v<FixedArray, Array> ||
|
||||
std::is_base_of_v<WeakFixedArray, Array> ||
|
||||
std::is_base_of_v<DescriptorArray, Array>,
|
||||
"T must be a descendant of FixedArray or a WeakFixedArray");
|
||||
Comment("LookupLinear");
|
||||
CSA_DCHECK(this, IsUniqueName(unique_name));
|
||||
@@ -10662,8 +10650,8 @@ TNode<Uint32T> CodeStubAssembler::GetSortedKeyIndex<TransitionArray>(
|
||||
template <typename Array>
|
||||
TNode<Name> CodeStubAssembler::GetKey(TNode<Array> array,
|
||||
TNode<Uint32T> entry_index) {
|
||||
static_assert(std::is_base_of<TransitionArray, Array>::value ||
|
||||
std::is_base_of<DescriptorArray, Array>::value,
|
||||
static_assert(std::is_base_of_v<TransitionArray, Array> ||
|
||||
std::is_base_of_v<DescriptorArray, Array>,
|
||||
"T must be a descendant of DescriptorArray or TransitionArray");
|
||||
const int key_offset = Array::ToKeyIndex(0) * kTaggedSize;
|
||||
TNode<MaybeObject> element =
|
||||
@@ -12315,17 +12303,16 @@ template <typename TIndex>
|
||||
TNode<IntPtrT> CodeStubAssembler::ElementOffsetFromIndex(
|
||||
TNode<TIndex> index_node, ElementsKind kind, int base_size) {
|
||||
// TODO(v8:9708): Remove IntPtrT variant in favor of UintPtrT.
|
||||
static_assert(std::is_same<TIndex, Smi>::value ||
|
||||
std::is_same<TIndex, TaggedIndex>::value ||
|
||||
std::is_same<TIndex, IntPtrT>::value ||
|
||||
std::is_same<TIndex, UintPtrT>::value,
|
||||
"Only Smi, UintPtrT or IntPtrT index nodes are allowed");
|
||||
static_assert(
|
||||
std::is_same_v<TIndex, Smi> || std::is_same_v<TIndex, TaggedIndex> ||
|
||||
std::is_same_v<TIndex, IntPtrT> || std::is_same_v<TIndex, UintPtrT>,
|
||||
"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<IntPtrT> intptr_index_node;
|
||||
bool constant_index = false;
|
||||
if (std::is_same<TIndex, Smi>::value) {
|
||||
if (std::is_same_v<TIndex, Smi>) {
|
||||
TNode<Smi> smi_index_node = ReinterpretCast<Smi>(index_node);
|
||||
int const kSmiShiftBits = kSmiShiftSize + kSmiTagSize;
|
||||
element_size_shift -= kSmiShiftBits;
|
||||
@@ -12339,7 +12326,7 @@ TNode<IntPtrT> CodeStubAssembler::ElementOffsetFromIndex(
|
||||
}
|
||||
}
|
||||
intptr_index_node = BitcastTaggedToWordForTagAndSmiBits(smi_index_node);
|
||||
} else if (std::is_same<TIndex, TaggedIndex>::value) {
|
||||
} else if (std::is_same_v<TIndex, TaggedIndex>) {
|
||||
TNode<TaggedIndex> tagged_index_node =
|
||||
ReinterpretCast<TaggedIndex>(index_node);
|
||||
element_size_shift -= kSmiTagSize;
|
||||
@@ -12699,9 +12686,9 @@ void CodeStubAssembler::StoreElementTypedArrayBigInt(TNode<RawPtrT> elements,
|
||||
ElementsKind kind,
|
||||
TNode<TIndex> index,
|
||||
TNode<BigInt> value) {
|
||||
static_assert(std::is_same<TIndex, UintPtrT>::value ||
|
||||
std::is_same<TIndex, IntPtrT>::value,
|
||||
"Only UintPtrT or IntPtrT indices is allowed");
|
||||
static_assert(
|
||||
std::is_same_v<TIndex, UintPtrT> || std::is_same_v<TIndex, IntPtrT>,
|
||||
"Only UintPtrT or IntPtrT indices is allowed");
|
||||
DCHECK(kind == BIGINT64_ELEMENTS || kind == BIGUINT64_ELEMENTS);
|
||||
TNode<IntPtrT> offset = ElementOffsetFromIndex(index, kind, 0);
|
||||
TVARIABLE(UintPtrT, var_low);
|
||||
@@ -12750,9 +12737,9 @@ void CodeStubAssembler::StoreElementTypedArrayWord32(TNode<RawPtrT> elements,
|
||||
ElementsKind kind,
|
||||
TNode<TIndex> index,
|
||||
TNode<Word32T> value) {
|
||||
static_assert(std::is_same<TIndex, UintPtrT>::value ||
|
||||
std::is_same<TIndex, IntPtrT>::value,
|
||||
"Only UintPtrT or IntPtrT indices is allowed");
|
||||
static_assert(
|
||||
std::is_same_v<TIndex, UintPtrT> || std::is_same_v<TIndex, IntPtrT>,
|
||||
"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<TArray> elements,
|
||||
TNode<TIndex> index,
|
||||
TNode<TValue> value) {
|
||||
// TODO(v8:9708): Do we want to keep both IntPtrT and UintPtrT variants?
|
||||
static_assert(std::is_same<TIndex, Smi>::value ||
|
||||
std::is_same<TIndex, UintPtrT>::value ||
|
||||
std::is_same<TIndex, IntPtrT>::value,
|
||||
static_assert(std::is_same_v<TIndex, Smi> ||
|
||||
std::is_same_v<TIndex, UintPtrT> ||
|
||||
std::is_same_v<TIndex, IntPtrT>,
|
||||
"Only Smi, UintPtrT or IntPtrT indices is allowed");
|
||||
static_assert(std::is_same<TArray, RawPtrT>::value ||
|
||||
std::is_same<TArray, FixedArrayBase>::value,
|
||||
"Only RawPtrT or FixedArrayBase elements are allowed");
|
||||
static_assert(std::is_same<TValue, Float16RawBitsT>::value ||
|
||||
std::is_same<TValue, Int32T>::value ||
|
||||
std::is_same<TValue, Float32T>::value ||
|
||||
std::is_same<TValue, Float64T>::value ||
|
||||
std::is_same<TValue, Object>::value,
|
||||
"Only Int32T, Float32T, Float64T or object value "
|
||||
"types are allowed");
|
||||
static_assert(
|
||||
std::is_same_v<TArray, RawPtrT> || std::is_same_v<TArray, FixedArrayBase>,
|
||||
"Only RawPtrT or FixedArrayBase elements are allowed");
|
||||
static_assert(
|
||||
std::is_same_v<TValue, Float16RawBitsT> ||
|
||||
std::is_same_v<TValue, Int32T> || std::is_same_v<TValue, Float32T> ||
|
||||
std::is_same_v<TValue, Float64T> || std::is_same_v<TValue, Object>,
|
||||
"Only Int32T, Float32T, Float64T or object value "
|
||||
"types are allowed");
|
||||
DCHECK(IsTypedArrayElementsKind(kind));
|
||||
TNode<IntPtrT> offset = ElementOffsetFromIndex(index, kind, 0);
|
||||
// TODO(cbruni): Add OOB check once typed.
|
||||
@@ -12810,9 +12796,8 @@ template <typename TIndex>
|
||||
void CodeStubAssembler::StoreElement(TNode<FixedArrayBase> elements,
|
||||
ElementsKind kind, TNode<TIndex> index,
|
||||
TNode<Object> value) {
|
||||
static_assert(
|
||||
std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
|
||||
"Only Smi or IntPtrT indices are allowed");
|
||||
static_assert(std::is_same_v<TIndex, Smi> || std::is_same_v<TIndex, IntPtrT>,
|
||||
"Only Smi or IntPtrT indices are allowed");
|
||||
DCHECK(!IsDoubleElementsKind(kind));
|
||||
if (IsTypedArrayElementsKind(kind)) {
|
||||
StoreElementTypedArray(elements, kind, index, value);
|
||||
@@ -12828,9 +12813,8 @@ template <typename TIndex>
|
||||
void CodeStubAssembler::StoreElement(TNode<FixedArrayBase> elements,
|
||||
ElementsKind kind, TNode<TIndex> index,
|
||||
TNode<Float64T> value) {
|
||||
static_assert(
|
||||
std::is_same<TIndex, Smi>::value || std::is_same<TIndex, IntPtrT>::value,
|
||||
"Only Smi or IntPtrT indices are allowed");
|
||||
static_assert(std::is_same_v<TIndex, Smi> || std::is_same_v<TIndex, IntPtrT>,
|
||||
"Only Smi or IntPtrT indices are allowed");
|
||||
DCHECK(IsDoubleElementsKind(kind));
|
||||
StoreFixedDoubleArrayElement(CAST(elements), index, value);
|
||||
}
|
||||
@@ -12838,17 +12822,15 @@ void CodeStubAssembler::StoreElement(TNode<FixedArrayBase> elements,
|
||||
template <typename TIndex, typename TValue>
|
||||
void CodeStubAssembler::StoreElement(TNode<RawPtrT> elements, ElementsKind kind,
|
||||
TNode<TIndex> index, TNode<TValue> value) {
|
||||
static_assert(std::is_same<TIndex, Smi>::value ||
|
||||
std::is_same<TIndex, IntPtrT>::value ||
|
||||
std::is_same<TIndex, UintPtrT>::value,
|
||||
static_assert(std::is_same_v<TIndex, Smi> ||
|
||||
std::is_same_v<TIndex, IntPtrT> ||
|
||||
std::is_same_v<TIndex, UintPtrT>,
|
||||
"Only Smi, IntPtrT or UintPtrT indices are allowed");
|
||||
static_assert(
|
||||
std::is_same<TValue, Float16RawBitsT>::value ||
|
||||
std::is_same<TValue, Int32T>::value ||
|
||||
std::is_same<TValue, Word32T>::value ||
|
||||
std::is_same<TValue, Float32T>::value ||
|
||||
std::is_same<TValue, Float64T>::value ||
|
||||
std::is_same<TValue, BigInt>::value,
|
||||
std::is_same_v<TValue, Float16RawBitsT> ||
|
||||
std::is_same_v<TValue, Int32T> || std::is_same_v<TValue, Word32T> ||
|
||||
std::is_same_v<TValue, Float32T> ||
|
||||
std::is_same_v<TValue, Float64T> || std::is_same_v<TValue, BigInt>,
|
||||
"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<TIndex, Smi>::value,
|
||||
!std::is_same_v<TIndex, Smi>,
|
||||
"Smi indices are currently not supported because it's not clear whether "
|
||||
"the use case allows unsigned comparisons or not");
|
||||
var_index = start_index;
|
||||
|
||||
@@ -406,7 +406,7 @@ namespace {
|
||||
// allow void.
|
||||
template <typename T>
|
||||
constexpr bool AllScalar() {
|
||||
return std::is_scalar<T>::value || std::is_void<T>::value;
|
||||
return std::is_scalar_v<T> || std::is_void_v<T>;
|
||||
}
|
||||
|
||||
template <typename T1, typename T2, typename... Rest>
|
||||
|
||||
@@ -55,7 +55,7 @@ void SubtractFromEntry(PositionTableEntry* value,
|
||||
// Helper: Encode an integer.
|
||||
template <typename T>
|
||||
void EncodeInt(ZoneVector<uint8_t>* bytes, T value) {
|
||||
using unsigned_type = typename std::make_unsigned<T>::type;
|
||||
using unsigned_type = std::make_unsigned_t<T>;
|
||||
// Zig-zag encoding.
|
||||
static constexpr int kShift = sizeof(T) * kBitsPerByte - 1;
|
||||
value = ((static_cast<unsigned_type>(value) << 1) ^ (value >> kShift));
|
||||
@@ -94,8 +94,7 @@ T DecodeInt(base::Vector<const uint8_t> bytes, int* index) {
|
||||
bool more;
|
||||
do {
|
||||
current = bytes[(*index)++];
|
||||
decoded |= static_cast<typename std::make_unsigned<T>::type>(
|
||||
ValueBits::decode(current))
|
||||
decoded |= static_cast<std::make_unsigned_t<T>>(ValueBits::decode(current))
|
||||
<< shift;
|
||||
more = MoreBit::decode(current);
|
||||
shift += ValueBits::kSize;
|
||||
|
||||
@@ -189,7 +189,7 @@ Operand MacroAssembler::RootAsOperand(RootIndex index) {
|
||||
|
||||
void MacroAssembler::LoadTaggedRoot(Register destination, RootIndex index) {
|
||||
static_assert(!CanBeImmediate(RootIndex::kUndefinedValue) ||
|
||||
std::is_same<Tagged_t, uint32_t>::value);
|
||||
std::is_same_v<Tagged_t, uint32_t>);
|
||||
if (CanBeImmediate(index)) {
|
||||
mov_tagged(destination,
|
||||
Immediate(static_cast<uint32_t>(ReadOnlyRootPtr(index))));
|
||||
|
||||
@@ -3135,7 +3135,7 @@ void InstructionSelectorT<Adapter>::VisitComment(node_t node) {
|
||||
->Get(node)
|
||||
.template Cast<turboshaft::CommentOp>();
|
||||
using ptrsize_int_t =
|
||||
std::conditional<kSystemPointerSize == 8, int64_t, int32_t>::type;
|
||||
std::conditional_t<kSystemPointerSize == 8, int64_t, int32_t>;
|
||||
InstructionOperand operand = sequence()->AddImmediate(
|
||||
Constant{reinterpret_cast<ptrsize_int_t>(comment.message)});
|
||||
Emit(kArchComment, 0, nullptr, 1, &operand);
|
||||
|
||||
@@ -39,13 +39,13 @@ constexpr MachineType MachineTypeOf<MaybeObject>::value;
|
||||
|
||||
namespace compiler {
|
||||
|
||||
static_assert(std::is_convertible<TNode<Number>, TNode<Object>>::value,
|
||||
static_assert(std::is_convertible_v<TNode<Number>, TNode<Object>>,
|
||||
"test subtyping");
|
||||
static_assert(
|
||||
std::is_convertible<TNode<Number>, TNode<UnionOf<Smi, HeapObject>>>::value,
|
||||
std::is_convertible_v<TNode<Number>, TNode<UnionOf<Smi, HeapObject>>>,
|
||||
"test subtyping");
|
||||
static_assert(
|
||||
!std::is_convertible<TNode<UnionOf<Smi, HeapObject>>, TNode<Number>>::value,
|
||||
!std::is_convertible_v<TNode<UnionOf<Smi, HeapObject>>, TNode<Number>>,
|
||||
"test subtyping");
|
||||
|
||||
CodeAssemblerState::CodeAssemblerState(
|
||||
|
||||
@@ -1625,7 +1625,7 @@ namespace {
|
||||
// overflow".
|
||||
template <typename T>
|
||||
bool CanRevertLeftShiftWithRightShift(T value, T shift) {
|
||||
using unsigned_T = typename std::make_unsigned<T>::type;
|
||||
using unsigned_T = std::make_unsigned_t<T>;
|
||||
if (shift < 0 || shift >= std::numeric_limits<T>::digits + 1) {
|
||||
// This shift would be UB in C++
|
||||
return false;
|
||||
|
||||
+1
-1
@@ -679,7 +679,7 @@ MaybeLocal<T> Shell::CompileString(Isolate* isolate, Local<Context> context,
|
||||
v8::ScriptCompiler::StreamedSource::TWO_BYTE);
|
||||
std::unique_ptr<v8::ScriptCompiler::ScriptStreamingTask> streaming_task(
|
||||
v8::ScriptCompiler::StartStreaming(isolate, &streamed_source,
|
||||
std::is_same<T, Module>::value
|
||||
std::is_same_v<T, Module>
|
||||
? v8::ScriptType::kModule
|
||||
: v8::ScriptType::kClassic));
|
||||
StreamerThread::StartThreadForTaskAndJoin(streaming_task.get());
|
||||
|
||||
@@ -513,7 +513,7 @@ double GetScalarElement(Tagged<T> array, int index) {
|
||||
|
||||
template <class T>
|
||||
void DoPrintElements(std::ostream& os, Tagged<Object> object, int length) {
|
||||
const bool print_the_hole = std::is_same<T, FixedDoubleArray>::value;
|
||||
const bool print_the_hole = std::is_same_v<T, FixedDoubleArray>;
|
||||
Tagged<T> array = Cast<T>(object);
|
||||
if (length == 0) return;
|
||||
int previous_index = 0;
|
||||
|
||||
@@ -4151,7 +4151,7 @@ template <typename T, int SIZE>
|
||||
void ShiftRight(Simulator* simulator, int Vd, int Vm, int shift,
|
||||
bool is_unsigned) {
|
||||
if (is_unsigned) {
|
||||
using unsigned_T = typename std::make_unsigned<T>::type;
|
||||
using unsigned_T = std::make_unsigned_t<T>;
|
||||
LogicalShiftRight<unsigned_T, SIZE>(simulator, Vd, Vm, shift);
|
||||
} else {
|
||||
ArithmeticShiftRight<T, SIZE>(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<T>::type;
|
||||
using unsignedT = std::make_unsigned_t<T>;
|
||||
src[i] = static_cast<unsignedT>(src[i]) << shift_value;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -1095,7 +1095,7 @@ int Simulator::CodeFromName(const char* name) {
|
||||
template <typename T>
|
||||
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<T>::value, "operands must be unsigned");
|
||||
static_assert(std::is_unsigned_v<T>, "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 <typename T>
|
||||
void Simulator::AddSubWithCarry(Instruction* instr) {
|
||||
// Use unsigned types to avoid implementation-defined overflow behaviour.
|
||||
static_assert(std::is_unsigned<T>::value, "operands must be unsigned");
|
||||
static_assert(std::is_unsigned_v<T>, "operands must be unsigned");
|
||||
|
||||
T op2 = reg<T>(instr->Rm());
|
||||
T new_val;
|
||||
@@ -1169,7 +1169,7 @@ sim_uint128_t Simulator::Eor128(sim_uint128_t x, sim_uint128_t y) const {
|
||||
|
||||
template <typename T>
|
||||
T Simulator::ShiftOperand(T value, Shift shift_type, unsigned amount) {
|
||||
using unsignedT = typename std::make_unsigned<T>::type;
|
||||
using unsignedT = std::make_unsigned_t<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<T>::type;
|
||||
using unsignedT = std::make_unsigned_t<T>;
|
||||
|
||||
switch (extend_type) {
|
||||
case UXTB:
|
||||
@@ -1871,7 +1871,7 @@ void Simulator::VisitCompareBranch(Instruction* instr) {
|
||||
template <typename T>
|
||||
void Simulator::AddSubHelper(Instruction* instr, T op2) {
|
||||
// Use unsigned types to avoid implementation-defined overflow behaviour.
|
||||
static_assert(std::is_unsigned<T>::value, "operands must be unsigned");
|
||||
static_assert(std::is_unsigned_v<T>, "operands must be unsigned");
|
||||
|
||||
bool set_flags = instr->FlagsUpdate();
|
||||
T new_val = 0;
|
||||
@@ -2017,7 +2017,7 @@ void Simulator::VisitConditionalCompareImmediate(Instruction* instr) {
|
||||
template <typename T>
|
||||
void Simulator::ConditionalCompareHelper(Instruction* instr, T op2) {
|
||||
// Use unsigned types to avoid implementation-defined overflow behaviour.
|
||||
static_assert(std::is_unsigned<T>::value, "operands must be unsigned");
|
||||
static_assert(std::is_unsigned_v<T>, "operands must be unsigned");
|
||||
|
||||
T op1 = reg<T>(instr->Rn());
|
||||
|
||||
@@ -3071,7 +3071,7 @@ void Simulator::DataProcessing2Source(Instruction* instr) {
|
||||
}
|
||||
case UDIV_w:
|
||||
case UDIV_x: {
|
||||
using unsignedT = typename std::make_unsigned<T>::type;
|
||||
using unsignedT = std::make_unsigned_t<T>;
|
||||
unsignedT rn = static_cast<unsignedT>(reg<T>(instr->Rn()));
|
||||
unsignedT rm = static_cast<unsignedT>(reg<T>(instr->Rm()));
|
||||
if (rm == 0) {
|
||||
@@ -3179,7 +3179,7 @@ void Simulator::VisitDataProcessing3Source(Instruction* instr) {
|
||||
|
||||
template <typename T>
|
||||
void Simulator::BitfieldHelper(Instruction* instr) {
|
||||
using unsignedT = typename std::make_unsigned<T>::type;
|
||||
using unsignedT = std::make_unsigned_t<T>;
|
||||
T reg_size = sizeof(T) * 8;
|
||||
T R = instr->ImmR();
|
||||
T S = instr->ImmS();
|
||||
|
||||
@@ -4032,7 +4032,7 @@ inline uint64_t Bits(uint64_t val, int start_bit, int end_bit) {
|
||||
|
||||
template <typename T>
|
||||
T Simulator::FPRecipSqrtEstimate(T op) {
|
||||
static_assert(std::is_same<float, T>::value || std::is_same<double, T>::value,
|
||||
static_assert(std::is_same_v<float, T> || std::is_same_v<double, T>,
|
||||
"T must be a float or double");
|
||||
|
||||
if (std::isnan(op)) {
|
||||
@@ -4119,7 +4119,7 @@ LogicVRegister Simulator::frsqrte(VectorFormat vform, LogicVRegister dst,
|
||||
|
||||
template <typename T>
|
||||
T Simulator::FPRecipEstimate(T op, FPRounding rounding) {
|
||||
static_assert(std::is_same<float, T>::value || std::is_same<double, T>::value,
|
||||
static_assert(std::is_same_v<float, T> || std::is_same_v<double, T>,
|
||||
"T must be a float or double");
|
||||
uint32_t sign;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace internal {
|
||||
#if defined(CPPGC_YOUNG_GENERATION)
|
||||
|
||||
static_assert(
|
||||
std::is_trivially_default_constructible<AgeTable>::value,
|
||||
std::is_trivially_default_constructible_v<AgeTable>,
|
||||
"To support lazy committing, AgeTable must be trivially constructible");
|
||||
|
||||
void AgeTable::SetAgeForRange(uintptr_t offset_begin, uintptr_t offset_end,
|
||||
|
||||
+12
-12
@@ -4208,16 +4208,16 @@ template <HeapObjectReferenceType reference_type, typename TSlot>
|
||||
static inline void UpdateSlot(PtrComprCageBase cage_base, TSlot slot,
|
||||
Tagged<HeapObject> heap_obj) {
|
||||
static_assert(
|
||||
std::is_same<TSlot, FullObjectSlot>::value ||
|
||||
std::is_same<TSlot, ObjectSlot>::value ||
|
||||
std::is_same<TSlot, FullMaybeObjectSlot>::value ||
|
||||
std::is_same<TSlot, MaybeObjectSlot>::value ||
|
||||
std::is_same<TSlot, OffHeapObjectSlot>::value ||
|
||||
std::is_same<TSlot, InstructionStreamSlot>::value ||
|
||||
std::is_same<TSlot, ProtectedPointerSlot>::value ||
|
||||
std::is_same<TSlot, ProtectedMaybeObjectSlot>::value ||
|
||||
std::is_same<TSlot, WriteProtectedSlot<ObjectSlot>>::value ||
|
||||
std::is_same<TSlot, WriteProtectedSlot<ProtectedPointerSlot>>::value,
|
||||
std::is_same_v<TSlot, FullObjectSlot> ||
|
||||
std::is_same_v<TSlot, ObjectSlot> ||
|
||||
std::is_same_v<TSlot, FullMaybeObjectSlot> ||
|
||||
std::is_same_v<TSlot, MaybeObjectSlot> ||
|
||||
std::is_same_v<TSlot, OffHeapObjectSlot> ||
|
||||
std::is_same_v<TSlot, InstructionStreamSlot> ||
|
||||
std::is_same_v<TSlot, ProtectedPointerSlot> ||
|
||||
std::is_same_v<TSlot, ProtectedMaybeObjectSlot> ||
|
||||
std::is_same_v<TSlot, WriteProtectedSlot<ObjectSlot>> ||
|
||||
std::is_same_v<TSlot, WriteProtectedSlot<ProtectedPointerSlot>>,
|
||||
"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<TSlot, FullMaybeObjectSlot>::value ||
|
||||
std::is_same<TSlot, MaybeObjectSlot>::value,
|
||||
std::is_same_v<TSlot, FullMaybeObjectSlot> ||
|
||||
std::is_same_v<TSlot, MaybeObjectSlot>,
|
||||
"Only FullMaybeObjectSlot and MaybeObjectSlot are expected here");
|
||||
Tagged<HeapObject> heap_object;
|
||||
if (!(*slot).GetHeapObject(&heap_object)) return;
|
||||
|
||||
@@ -156,8 +156,8 @@ class IterateAndScavengePromotedObjectsVisitor final
|
||||
V8_INLINE void HandleSlot(Tagged<HeapObject> host, THeapObjectSlot slot,
|
||||
Tagged<HeapObject> target) {
|
||||
static_assert(
|
||||
std::is_same<THeapObjectSlot, FullHeapObjectSlot>::value ||
|
||||
std::is_same<THeapObjectSlot, HeapObjectSlot>::value,
|
||||
std::is_same_v<THeapObjectSlot, FullHeapObjectSlot> ||
|
||||
std::is_same_v<THeapObjectSlot, HeapObjectSlot>,
|
||||
"Only FullHeapObjectSlot and HeapObjectSlot are expected here");
|
||||
scavenger_->SynchronizePageAccess(target);
|
||||
|
||||
|
||||
+1
-1
@@ -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<KeyedAccessLoadMode>::type;
|
||||
using T = std::underlying_type_t<KeyedAccessLoadMode>;
|
||||
return ((static_cast<T>(old_mode) ^
|
||||
static_cast<T>(GeneralizeKeyedAccessLoadMode(old_mode, new_mode))) &
|
||||
0b11) != 0;
|
||||
|
||||
@@ -1121,8 +1121,8 @@ template <ElementsKind kind>
|
||||
JsonStringifier::Result JsonStringifier::SerializeFixedArrayWithInterruptCheck(
|
||||
DirectHandle<JSArray> array, uint32_t length, uint32_t* slow_path_index) {
|
||||
static_assert(IsSmiElementsKind(kind) || IsDoubleElementsKind(kind));
|
||||
using ArrayT = typename std::conditional<IsDoubleElementsKind(kind),
|
||||
FixedDoubleArray, FixedArray>::type;
|
||||
using ArrayT = std::conditional_t<IsDoubleElementsKind(kind),
|
||||
FixedDoubleArray, FixedArray>;
|
||||
|
||||
StackLimitCheck interrupt_check(isolate_);
|
||||
constexpr uint32_t kInterruptLength = 4000;
|
||||
@@ -2343,8 +2343,8 @@ FastJsonStringifierResult
|
||||
FastJsonStringifier<Char>::SerializeFixedArrayWithInterruptCheck(
|
||||
Tagged<JSArray> array, uint32_t length, uint32_t start_index,
|
||||
uint32_t* bailout_idx) {
|
||||
using ArrayT = typename std::conditional<IsDoubleElementsKind(kind),
|
||||
FixedDoubleArray, FixedArray>::type;
|
||||
using ArrayT = std::conditional_t<IsDoubleElementsKind(kind),
|
||||
FixedDoubleArray, FixedArray>;
|
||||
|
||||
StackLimitCheck interrupt_check(isolate_);
|
||||
uint32_t limit = std::min(length, kArrayInterruptLength);
|
||||
@@ -2385,8 +2385,8 @@ template <typename Char>
|
||||
template <ElementsKind kind>
|
||||
FastJsonStringifierResult FastJsonStringifier<Char>::SerializeFixedArray(
|
||||
Tagged<JSArray> array, uint32_t limit, uint32_t start_index) {
|
||||
using ArrayT = typename std::conditional<IsDoubleElementsKind(kind),
|
||||
FixedDoubleArray, FixedArray>::type;
|
||||
using ArrayT = std::conditional_t<IsDoubleElementsKind(kind),
|
||||
FixedDoubleArray, FixedArray>;
|
||||
|
||||
for (uint32_t i = start_index; i < limit; i++) {
|
||||
FastJsonStringifierResult result = SerializeFixedArrayElement<kind>(
|
||||
|
||||
@@ -807,7 +807,7 @@ class MaglevCodeGeneratingNodeProcessor {
|
||||
PatchJumps(node);
|
||||
|
||||
// Emit Phi moves before visiting the control node.
|
||||
if (std::is_base_of<UnconditionalControlNode, NodeT>::value) {
|
||||
if (std::is_base_of_v<UnconditionalControlNode, NodeT>) {
|
||||
EmitBlockEndGapMoves(node->template Cast<UnconditionalControlNode>(),
|
||||
state);
|
||||
}
|
||||
@@ -850,7 +850,7 @@ class MaglevCodeGeneratingNodeProcessor {
|
||||
masm()->set_allow_deferred_call(false);
|
||||
#endif
|
||||
|
||||
if (std::is_base_of<ValueNode, NodeT>::value) {
|
||||
if (std::is_base_of_v<ValueNode, NodeT>) {
|
||||
ValueNode* value_node = node->template Cast<ValueNode>();
|
||||
if (value_node->has_valid_live_range() && value_node->is_spilled()) {
|
||||
compiler::AllocatedOperand source =
|
||||
|
||||
@@ -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<IsEmptyFunction, std::nullptr_t>::value) {
|
||||
if constexpr (!std::is_same_v<IsEmptyFunction, std::nullptr_t>) {
|
||||
if (IsEmpty(a->second)) {
|
||||
++a;
|
||||
continue;
|
||||
|
||||
@@ -132,7 +132,7 @@ V8_OBJECT class MutableBigInt : public FreshlyAllocatedBigInt {
|
||||
|
||||
static bool IsMutableBigInt(Tagged<MutableBigInt> o) { return IsBigInt(o); }
|
||||
|
||||
static_assert(std::is_same<bigint::digit_t, BigIntBase::digit_t>::value,
|
||||
static_assert(std::is_same_v<bigint::digit_t, BigIntBase::digit_t>,
|
||||
"We must be able to call BigInt library functions");
|
||||
|
||||
NEVER_READ_ONLY_SPACE
|
||||
|
||||
@@ -3738,7 +3738,7 @@ class TypedElementsAccessor
|
||||
double search_value = Object::NumberValue(*value);
|
||||
if (!std::isfinite(search_value)) {
|
||||
if (!IsFloat16TypedArrayElementsKind(Kind) &&
|
||||
std::is_integral<ElementType>::value) {
|
||||
std::is_integral_v<ElementType>) {
|
||||
// Integral types cannot represent +Inf or NaN.
|
||||
return Just<int64_t>(-1);
|
||||
} else if (std::isnan(search_value)) {
|
||||
|
||||
@@ -170,8 +170,8 @@ void DictionaryUpdateMaxNumberKey(HandleType<Dictionary> dictionary,
|
||||
requires(
|
||||
std::is_convertible_v<HandleType<Dictionary>, DirectHandle<Dictionary>>)
|
||||
{
|
||||
static_assert((std::is_same<Dictionary, SwissNameDictionary>::value ||
|
||||
std::is_same<Dictionary, NameDictionary>::value));
|
||||
static_assert((std::is_same_v<Dictionary, SwissNameDictionary> ||
|
||||
std::is_same_v<Dictionary, NameDictionary>));
|
||||
// No-op for (ordered) name dictionaries.
|
||||
}
|
||||
|
||||
@@ -204,10 +204,10 @@ void AddToDictionaryTemplate(IsolateT* isolate, Handle<Dictionary> dictionary,
|
||||
InternalIndex entry = dictionary->FindEntry(isolate, key);
|
||||
|
||||
const bool is_elements_dictionary =
|
||||
std::is_same<Dictionary, NumberDictionary>::value;
|
||||
std::is_same_v<Dictionary, NumberDictionary>;
|
||||
static_assert(is_elements_dictionary !=
|
||||
(std::is_same<Dictionary, NameDictionary>::value ||
|
||||
std::is_same<Dictionary, SwissNameDictionary>::value));
|
||||
(std::is_same_v<Dictionary, NameDictionary> ||
|
||||
std::is_same_v<Dictionary, SwissNameDictionary>));
|
||||
|
||||
if (entry.is_not_found()) {
|
||||
// Entry not found, add new one.
|
||||
|
||||
@@ -5890,7 +5890,7 @@ DirectHandle<FixedArray> BaseNameDictionary<Derived, Shape>::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<Derived, GlobalDictionary>::value) {
|
||||
if (std::is_same_v<Derived, GlobalDictionary>) {
|
||||
DCHECK_LE(array_size, dictionary->NumberOfElements());
|
||||
} else {
|
||||
DCHECK_EQ(array_size, dictionary->NumberOfElements());
|
||||
|
||||
+6
-6
@@ -173,11 +173,11 @@ template <typename T>
|
||||
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<T>::value;
|
||||
sizeof(T) == sizeof(uint32_t) && std::is_integral_v<T>;
|
||||
static constexpr bool is_uint64 =
|
||||
sizeof(T) == sizeof(uint64_t) && std::is_integral<T>::value;
|
||||
sizeof(T) == sizeof(uint64_t) && std::is_integral_v<T>;
|
||||
static constexpr bool is_double =
|
||||
sizeof(T) == sizeof(double) && std::is_floating_point<T>::value;
|
||||
sizeof(T) == sizeof(double) && std::is_floating_point_v<T>;
|
||||
|
||||
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<T>::value;
|
||||
sizeof(T) == sizeof(uint32_t) && std::is_integral_v<T>;
|
||||
static constexpr bool is_uint64 =
|
||||
sizeof(T) == sizeof(uint64_t) && std::is_integral<T>::value;
|
||||
sizeof(T) == sizeof(uint64_t) && std::is_integral_v<T>;
|
||||
static constexpr bool is_double =
|
||||
sizeof(T) == sizeof(double) && std::is_floating_point<T>::value;
|
||||
sizeof(T) == sizeof(double) && std::is_floating_point_v<T>;
|
||||
|
||||
static_assert(is_uint32 || is_uint64 || is_double);
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ using JSArrayBufferViewIsBackedByRab =
|
||||
|
||||
template <typename T>
|
||||
static size_t BytesNeededForVarint(T value) {
|
||||
static_assert(std::is_integral<T>::value && std::is_unsigned<T>::value,
|
||||
static_assert(std::is_integral_v<T> && std::is_unsigned_v<T>,
|
||||
"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<T>::value && std::is_unsigned<T>::value,
|
||||
static_assert(std::is_integral_v<T> && std::is_unsigned_v<T>,
|
||||
"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<T>::value && std::is_signed<T>::value,
|
||||
static_assert(std::is_integral_v<T> && std::is_signed_v<T>,
|
||||
"Only signed integer types can be written as zigzag.");
|
||||
using UnsignedT = typename std::make_unsigned<T>::type;
|
||||
using UnsignedT = std::make_unsigned_t<T>;
|
||||
WriteVarint((static_cast<UnsignedT>(value) << 1) ^
|
||||
(value >> (8 * sizeof(T) - 1)));
|
||||
}
|
||||
@@ -1351,7 +1351,7 @@ Maybe<T> 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<T>::value && std::is_unsigned<T>::value,
|
||||
static_assert(std::is_integral_v<T> && std::is_unsigned_v<T>,
|
||||
"Only unsigned integer types can be read as varints.");
|
||||
if (sizeof(T) > 4) return ReadVarintLoop<T>();
|
||||
auto max_read_position = position_ + sizeof(T) + 1;
|
||||
@@ -1401,7 +1401,7 @@ Maybe<T> ValueDeserializer::ReadVarint() {
|
||||
|
||||
template <typename T>
|
||||
Maybe<T> ValueDeserializer::ReadVarintLoop() {
|
||||
static_assert(std::is_integral<T>::value && std::is_unsigned<T>::value,
|
||||
static_assert(std::is_integral_v<T> && std::is_unsigned_v<T>,
|
||||
"Only unsigned integer types can be read as varints.");
|
||||
T value = 0;
|
||||
unsigned shift = 0;
|
||||
@@ -1431,9 +1431,9 @@ Maybe<T> 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<T>::value && std::is_signed<T>::value,
|
||||
static_assert(std::is_integral_v<T> && std::is_signed_v<T>,
|
||||
"Only signed integer types can be read as zigzag.");
|
||||
using UnsignedT = typename std::make_unsigned<T>::type;
|
||||
using UnsignedT = std::make_unsigned_t<T>;
|
||||
UnsignedT unsigned_value;
|
||||
if (!ReadVarint<UnsignedT>().To(&unsigned_value)) return Nothing<T>();
|
||||
return Just(static_cast<T>((unsigned_value >> 1) ^
|
||||
|
||||
@@ -57,7 +57,7 @@ bool ExperimentalRegExp::IsCompiled(DirectHandle<IrRegExpData> re_data,
|
||||
template <class T>
|
||||
Handle<TrustedByteArray> VectorToByteArray(Isolate* isolate,
|
||||
base::Vector<T> data) {
|
||||
static_assert(std::is_trivial<T>::value);
|
||||
static_assert(std::is_trivial_v<T>);
|
||||
|
||||
int byte_length = sizeof(T) * data.length();
|
||||
Handle<TrustedByteArray> byte_array =
|
||||
|
||||
@@ -119,8 +119,8 @@ namespace {
|
||||
|
||||
template <typename Dictionary>
|
||||
Handle<Name> KeyToName(Isolate* isolate, Handle<Object> key) {
|
||||
static_assert((std::is_same<Dictionary, SwissNameDictionary>::value ||
|
||||
std::is_same<Dictionary, NameDictionary>::value));
|
||||
static_assert((std::is_same_v<Dictionary, SwissNameDictionary> ||
|
||||
std::is_same_v<Dictionary, NameDictionary>));
|
||||
DCHECK(IsName(*key));
|
||||
return Cast<Name>(key);
|
||||
}
|
||||
|
||||
@@ -82,7 +82,7 @@ bool CompareNum(T x, T y) {
|
||||
return true;
|
||||
} else if (x > y) {
|
||||
return false;
|
||||
} else if (!std::is_integral<T>::value) {
|
||||
} else if (!std::is_integral_v<T>) {
|
||||
double _x = x, _y = y;
|
||||
if (x == 0 && x == y) {
|
||||
/* -0.0 is less than +0.0 */
|
||||
|
||||
@@ -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<Tagged_t>::type;
|
||||
using word_t = std::make_unsigned_t<Tagged_t>;
|
||||
|
||||
const word_t kWordTAllBitsSet = std::numeric_limits<word_t>::max();
|
||||
const word_t kOneInEveryByte = kWordTAllBitsSet / 0xFF;
|
||||
|
||||
@@ -1996,14 +1996,14 @@ class LiftoffCompiler {
|
||||
|
||||
template <typename EmitFn, typename... Args>
|
||||
void CallEmitFn(EmitFn fn, Args... args)
|
||||
requires(!std::is_member_function_pointer<EmitFn>::value)
|
||||
requires(!std::is_member_function_pointer_v<EmitFn>)
|
||||
{
|
||||
fn(args...);
|
||||
}
|
||||
|
||||
template <typename EmitFn, typename... Args>
|
||||
void CallEmitFn(EmitFn fn, Args... args)
|
||||
requires std::is_member_function_pointer<EmitFn>::value
|
||||
requires std::is_member_function_pointer_v<EmitFn>
|
||||
{
|
||||
(asm_.*fn)(ConvertAssemblerArg(args)...);
|
||||
}
|
||||
@@ -2020,8 +2020,8 @@ class LiftoffCompiler {
|
||||
// Convert {LiftoffRegister} to {AssemblerRegisterConverter}, other types stay
|
||||
// unchanged.
|
||||
template <typename T>
|
||||
typename std::conditional<std::is_same<LiftoffRegister, T>::value,
|
||||
AssemblerRegisterConverter, T>::type
|
||||
std::conditional_t<std::is_same_v<LiftoffRegister, T>,
|
||||
AssemblerRegisterConverter, T>
|
||||
ConvertAssemblerArg(T t) {
|
||||
return {t};
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ class DataRange {
|
||||
|
||||
template <typename T, size_t max_bytes = sizeof(T)>
|
||||
T getPseudoRandom() {
|
||||
static_assert(!std::is_same<T, bool>::value, "bool needs special handling");
|
||||
static_assert(!std::is_same_v<T, bool>, "bool needs special handling");
|
||||
static_assert(max_bytes <= sizeof(T));
|
||||
// Special handling for signed integers: Calling getPseudoRandom<int32_t, 1>
|
||||
// () should be equal to getPseudoRandom<int8_t>(). (The NextBytes() below
|
||||
@@ -167,7 +167,7 @@ class DataRange {
|
||||
template <typename T>
|
||||
T get() {
|
||||
// Bool needs special handling (see template specialization below).
|
||||
static_assert(!std::is_same<T, bool>::value, "bool needs special handling");
|
||||
static_assert(!std::is_same_v<T, bool>, "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
|
||||
|
||||
@@ -297,7 +297,7 @@ class ExternalReferenceList {
|
||||
uint32_t tags_ordered_by_address_[kNumExternalReferences];
|
||||
};
|
||||
|
||||
static_assert(std::is_trivially_destructible<ExternalReferenceList>::value,
|
||||
static_assert(std::is_trivially_destructible_v<ExternalReferenceList>,
|
||||
"static destructors not allowed");
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in new issue
Block a user