#ifndef V8_COMPILER_GRAPH_ASSEMBLER_H_
#define V8_COMPILER_GRAPH_ASSEMBLER_H_
#include <optional>
#include <type_traits>
#include "src/base/small-vector.h"
#include "src/codegen/tnode.h"
#include "src/common/globals.h"
#include "src/compiler/feedback-source.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/node.h"
#include "src/compiler/simplified-operator.h"
#include "src/objects/hole.h"
#include "src/objects/oddball.h"
namespace v8 {
namespace internal {
class JSGraph;
class Graph;
namespace compiler {
class Reducer;
#define PURE_ASSEMBLER_MACH_UNOP_LIST(V) …
#define PURE_ASSEMBLER_MACH_BINOP_LIST(V, T) …
#define CHECKED_ASSEMBLER_MACH_BINOP_LIST(V) …
#define JSGRAPH_SINGLETON_CONSTANT_LIST(V) …
class GraphAssembler;
enum class GraphAssemblerLabelType { … };
namespace detail {
constexpr size_t kGraphAssemblerLabelDynamicCount = …;
template <size_t VarCount>
struct GraphAssemblerHelper { … };
template <>
struct GraphAssemblerHelper<kGraphAssemblerLabelDynamicCount> { … };
}
template <size_t VarCount>
class GraphAssemblerLabel { … };
GraphAssemblerDynamicLabel;
namespace detail {
template <typename T, typename Enable, typename... Us>
struct GraphAssemblerLabelForXHelper;
template <typename T, typename... Us>
struct GraphAssemblerLabelForXHelper<
T, std::enable_if_t<std::conjunction_v<std::is_assignable<T&, Us>...>>,
Us...> {
using Type = GraphAssemblerLabel<sizeof...(Us)>;
};
template <typename T, typename U>
struct GraphAssemblerLabelForXHelper<
T, std::enable_if_t<std::is_assignable_v<T&, U>>, base::SmallVector<U, 4>> {
using Type = GraphAssemblerDynamicLabel;
};
GraphAssemblerLabelForVars;
GraphAssemblerLabelForReps;
}
NodeChangedCallback;
class V8_EXPORT_PRIVATE GraphAssembler { … };
template <size_t VarCount>
Node* GraphAssemblerLabel<VarCount>::PhiAt(size_t index) { … }
template <typename... Vars>
void GraphAssembler::MergeState(
detail::GraphAssemblerLabelForVars<Vars...>* label, Vars... vars) { … }
template <size_t VarCount>
void GraphAssembler::Bind(GraphAssemblerLabel<VarCount>* label) { … }
template <typename... Vars>
void GraphAssembler::Branch(
Node* condition, detail::GraphAssemblerLabelForVars<Vars...>* if_true,
detail::GraphAssemblerLabelForVars<Vars...>* if_false, Vars... vars) { … }
template <typename... Vars>
void GraphAssembler::BranchWithHint(
Node* condition, detail::GraphAssemblerLabelForVars<Vars...>* if_true,
detail::GraphAssemblerLabelForVars<Vars...>* if_false, BranchHint hint,
Vars... vars) { … }
template <typename... Vars>
void GraphAssembler::MachineBranch(
TNode<Word32T> condition, GraphAssemblerLabel<sizeof...(Vars)>* if_true,
GraphAssemblerLabel<sizeof...(Vars)>* if_false, BranchHint hint,
Vars... vars) { … }
template <typename... Vars>
void GraphAssembler::JSBranch(TNode<Boolean> condition,
GraphAssemblerLabel<sizeof...(Vars)>* if_true,
GraphAssemblerLabel<sizeof...(Vars)>* if_false,
BranchHint hint, Vars... vars) { … }
template <typename... Vars>
void GraphAssembler::BranchImpl(BranchSemantics semantics, Node* condition,
GraphAssemblerLabel<sizeof...(Vars)>* if_true,
GraphAssemblerLabel<sizeof...(Vars)>* if_false,
BranchHint hint, Vars... vars) { … }
template <typename... Vars>
void GraphAssembler::Goto(detail::GraphAssemblerLabelForVars<Vars...>* label,
Vars... vars) { … }
template <typename... Vars>
void GraphAssembler::GotoIf(Node* condition,
detail::GraphAssemblerLabelForVars<Vars...>* label,
BranchHint hint, Vars... vars) { … }
template <typename... Vars>
void GraphAssembler::GotoIfNot(
Node* condition, detail::GraphAssemblerLabelForVars<Vars...>* label,
BranchHint hint, Vars... vars) { … }
template <typename... Vars>
void GraphAssembler::GotoIf(Node* condition,
detail::GraphAssemblerLabelForVars<Vars...>* label,
Vars... vars) { … }
template <typename... Vars>
void GraphAssembler::GotoIfNot(
Node* condition, detail::GraphAssemblerLabelForVars<Vars...>* label,
Vars... vars) { … }
template <typename... Args>
TNode<Object> GraphAssembler::Call(const CallDescriptor* call_descriptor,
Node* first_arg, Args... args) { … }
template <typename... Args>
TNode<Object> GraphAssembler::Call(const Operator* op, Node* first_arg,
Args... args) { … }
class V8_EXPORT_PRIVATE JSGraphAssembler : public GraphAssembler { … };
}
}
}
#endif