5#ifndef V8_COMPILER_TURBOSHAFT_UTILS_H_
6#define V8_COMPILER_TURBOSHAFT_UTILS_H_
18struct any_of : std::tuple<const Ts&...> {
21 template <
class T,
size_t... indices>
22 bool Contains(
const T& value, std::index_sequence<indices...>) {
23 return ((value == std::get<indices>(*
this)) || ...);
26 template <
size_t... indices>
27 std::ostream&
PrintTo(std::ostream& os, std::index_sequence<indices...>) {
30 (((first ? (first =
false, os) : os <<
", "),
31 os << base::PrintCheckOperand(std::get<indices>(*
this))),
36template <
class... Args>
39template <
class T,
class... Ts>
41 return options.
Contains(value, std::index_sequence_for<Ts...>{});
46 return any.PrintTo(os, std::index_sequence_for<Ts...>{});
50struct all_of : std::tuple<const Ts&...> {
53 template <
class T,
size_t... indices>
54 bool AllEqualTo(
const T& value, std::index_sequence<indices...>) {
55 return ((value == std::get<indices>(*
this)) && ...);
58 template <
size_t... indices>
59 std::ostream&
PrintTo(std::ostream& os, std::index_sequence<indices...>) {
62 (((first ? (first =
false, os) : os <<
", "),
63 os << base::PrintCheckOperand(std::get<indices>(*
this))),
68template <
class... Args>
71template <
class T,
class... Ts>
73 return values.
AllEqualTo(target, std::index_sequence_for<Ts...>{});
78 return all.PrintTo(os, std::index_sequence_for<Ts...>{});
94 *ptr = std::move(new_value);
143template <
typename T,
typename Enable =
void>
146template <
typename T, u
int64_t MaxValue>
149 static constexpr uint64_t
encode(T value) {
150 const uint64_t v =
static_cast<uint64_t
>(
value);
156#define DEFINE_MULTI_SWITCH_INTEGRAL(name, max_value) \
158 struct MultiSwitch<name> : MultiSwitchIntegral<name, max_value> {};
166template <
typename Head,
typename Next,
typename... Rest>
168 const Rest&... rest) {
176template <
typename... Ts>
177inline constexpr uint64_t
multi(
const Ts&... values) {
ScopedModification(T *ptr, T new_value)
const T & old_value() const
#define DEFINE_MULTI_SWITCH_INTEGRAL(name, max_value)
base::Vector< const DirectHandle< Object > > args
constexpr uint64_t multi_encode(const T &value)
constexpr uint64_t multi(const Ts &... values)
std::ostream & operator<<(std::ostream &os, PaddingSpace padding)
bool operator==(const ControlState &lhs, const ControlState &rhs)
any_of(const Args &...) -> any_of< Args... >
all_of(const Args &...) -> all_of< Args... >
V8_EXPORT_PRIVATE bool ShouldSkipOptimizationStep()
#define DCHECK_LT(v1, v2)
#define V8_EXPORT_PRIVATE
static constexpr uint64_t max_value
static constexpr uint64_t encode(T value)
all_of(const Ts &... args)
std::ostream & PrintTo(std::ostream &os, std::index_sequence< indices... >)
bool AllEqualTo(const T &value, std::index_sequence< indices... >)
bool Contains(const T &value, std::index_sequence< indices... >)
std::ostream & PrintTo(std::ostream &os, std::index_sequence< indices... >)
any_of(const Ts &... args)