From c7d5491d642c75ae5c2d36d90c6d18f215601c04 Mon Sep 17 00:00:00 2001 From: Clemens Backes Date: Wed, 6 Apr 2022 14:21:15 +0200 Subject: [PATCH] [base] Remove type-traits.h Replace by std types defined in since C++17. R=mslekova@chromium.org Bug: v8:12425 Change-Id: I7ec8454634ecb63a3da4f93412d7a6c5002bb7c6 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3572045 Reviewed-by: Maya Lekova Commit-Queue: Clemens Backes Cr-Commit-Position: refs/heads/main@{#79818} --- BUILD.bazel | 1 - BUILD.gn | 1 - src/base/type-traits.h | 48 ---------------------------- src/compiler/code-assembler.h | 20 ++++++------ src/compiler/raw-machine-assembler.h | 20 ++++++------ 5 files changed, 20 insertions(+), 70 deletions(-) delete mode 100644 src/base/type-traits.h diff --git a/BUILD.bazel b/BUILD.bazel index 3b9f04f131..c873b20952 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -666,7 +666,6 @@ filegroup( "src/base/template-utils.h", "src/base/timezone-cache.h", "src/base/threaded-list.h", - "src/base/type-traits.h", "src/base/utils/random-number-generator.cc", "src/base/utils/random-number-generator.h", "src/base/vector.h", diff --git a/BUILD.gn b/BUILD.gn index 1972bea4d3..84284af993 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -5193,7 +5193,6 @@ v8_component("v8_libbase") { "src/base/template-utils.h", "src/base/threaded-list.h", "src/base/timezone-cache.h", - "src/base/type-traits.h", "src/base/utils/random-number-generator.cc", "src/base/utils/random-number-generator.h", "src/base/v8-fallthrough.h", diff --git a/src/base/type-traits.h b/src/base/type-traits.h deleted file mode 100644 index 9b6e8971a7..0000000000 --- a/src/base/type-traits.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2019 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef V8_BASE_TYPE_TRAITS_H_ -#define V8_BASE_TYPE_TRAITS_H_ - -#include - -namespace v8 { -namespace internal { - -// Conjunction metafunction. -template -struct conjunction; - -template <> -struct conjunction<> : std::true_type {}; - -template -struct conjunction : T {}; - -template -struct conjunction - : std::conditional, T>::type {}; - -// Disjunction metafunction. -template -struct disjunction; - -template <> -struct disjunction<> : std::true_type {}; - -template -struct disjunction : T {}; - -template -struct disjunction - : std::conditional>::type {}; - -// Negation metafunction. -template -struct negation : std::integral_constant {}; - -} // namespace internal -} // namespace v8 - -#endif // V8_BASE_TYPE_TRAITS_H_ diff --git a/src/compiler/code-assembler.h b/src/compiler/code-assembler.h index b97f0a342f..97231eecd9 100644 --- a/src/compiler/code-assembler.h +++ b/src/compiler/code-assembler.h @@ -9,13 +9,13 @@ #include #include #include +#include // Clients of this interface shouldn't depend on lots of compiler internals. // Do not include anything from src/compiler here! #include "include/cppgc/source-location.h" #include "src/base/macros.h" #include "src/base/optional.h" -#include "src/base/type-traits.h" #include "src/builtins/builtins.h" #include "src/codegen/atomic-memory-order.h" #include "src/codegen/code-factory.h" @@ -1253,9 +1253,9 @@ class V8_EXPORT_PRIVATE CodeAssembler { template Node* CallCFunction(Node* function, base::Optional return_type, CArgs... cargs) { - static_assert(v8::internal::conjunction< - std::is_convertible...>::value, - "invalid argument types"); + static_assert( + std::conjunction_v...>, + "invalid argument types"); return CallCFunction(function, return_type, {cargs...}); } @@ -1264,9 +1264,9 @@ class V8_EXPORT_PRIVATE CodeAssembler { Node* CallCFunctionWithoutFunctionDescriptor(Node* function, MachineType return_type, CArgs... cargs) { - static_assert(v8::internal::conjunction< - std::is_convertible...>::value, - "invalid argument types"); + static_assert( + std::conjunction_v...>, + "invalid argument types"); return CallCFunctionWithoutFunctionDescriptor(function, return_type, {cargs...}); } @@ -1277,9 +1277,9 @@ class V8_EXPORT_PRIVATE CodeAssembler { MachineType return_type, SaveFPRegsMode mode, CArgs... cargs) { - static_assert(v8::internal::conjunction< - std::is_convertible...>::value, - "invalid argument types"); + static_assert( + std::conjunction_v...>, + "invalid argument types"); return CallCFunctionWithCallerSavedRegisters(function, return_type, mode, {cargs...}); } diff --git a/src/compiler/raw-machine-assembler.h b/src/compiler/raw-machine-assembler.h index 23051dfbba..787f7f9269 100644 --- a/src/compiler/raw-machine-assembler.h +++ b/src/compiler/raw-machine-assembler.h @@ -6,8 +6,8 @@ #define V8_COMPILER_RAW_MACHINE_ASSEMBLER_H_ #include +#include -#include "src/base/type-traits.h" #include "src/codegen/assembler.h" #include "src/common/globals.h" #include "src/compiler/access-builder.h" @@ -969,9 +969,9 @@ class V8_EXPORT_PRIVATE RawMachineAssembler { template Node* CallCFunction(Node* function, base::Optional return_type, CArgs... cargs) { - static_assert(v8::internal::conjunction< - std::is_convertible...>::value, - "invalid argument types"); + static_assert( + std::conjunction_v...>, + "invalid argument types"); return CallCFunction(function, return_type, {cargs...}); } @@ -983,9 +983,9 @@ class V8_EXPORT_PRIVATE RawMachineAssembler { Node* CallCFunctionWithoutFunctionDescriptor(Node* function, MachineType return_type, CArgs... cargs) { - static_assert(v8::internal::conjunction< - std::is_convertible...>::value, - "invalid argument types"); + static_assert( + std::conjunction_v...>, + "invalid argument types"); return CallCFunctionWithoutFunctionDescriptor(function, return_type, {cargs...}); } @@ -1000,9 +1000,9 @@ class V8_EXPORT_PRIVATE RawMachineAssembler { MachineType return_type, SaveFPRegsMode mode, CArgs... cargs) { - static_assert(v8::internal::conjunction< - std::is_convertible...>::value, - "invalid argument types"); + static_assert( + std::conjunction_v...>, + "invalid argument types"); return CallCFunctionWithCallerSavedRegisters(function, return_type, mode, {cargs...}); }