5#ifndef V8_COMPILER_TURBOSHAFT_BLOCK_INSTRUMENTATION_REDUCER_H_
6#define V8_COMPILER_TURBOSHAFT_BLOCK_INSTRUMENTATION_REDUCER_H_
22template <
typename Next>
37 Next::Bind(new_block);
39 const int block_number = new_block->
index().
id();
46 template <
Opcode opcode,
typename Continuation,
typename... Args>
50 static_assert(opcode != Opcode::kCatchBlockBegin);
51 static_assert(opcode != Opcode::kDidntThrow);
52 static_assert(opcode != Opcode::kParameter);
57 const int block_number =
__ current_block() ->
index().id();
60 return Continuation{
this}.Reduce(
args...);
65 const char* debug_name) {
68 return Next::ReduceParameter(parameter_index, rep, debug_name);
74 return Next::ReduceCatchBlockBegin();
78 V<Any> throwing_operation,
bool has_catch_block,
83 return Next::ReduceDidntThrow(throwing_operation, has_catch_block,
84 results_rep, throwing_op_effects);
88 int offset_to_counter_value = block_number *
kInt32Size;
105 __ WordPtrConstant(
reinterpret_cast<uintptr_t
>(
data_->
counts()));
106 return __ LoadOffHeap(counter_array, offset_to_counter_value,
112 int offset_to_counter_value = block_number *
kInt32Size;
130 __ WordPtrConstant(
reinterpret_cast<uintptr_t
>(
data_->
counts()));
132 offset_to_counter_value);
141 V<Word32> incremented_value =
__ Word32Add(value, 1);
145 V<Word32> overflow =
__ Uint32LessThan(incremented_value, value);
146 V<Word32> overflow_mask =
__ Word32Sub(0, overflow);
148 __ Word32BitwiseOr(incremented_value, overflow_mask);
155 const int true_id = branch.if_true->index().id();
156 const int false_id = branch.if_false->index().id();
158 return Next::ReduceInputGraphBranch(ig_index, branch);
#define REDUCE(operation)
#define REDUCE_INPUT_GRAPH(operation)
union v8::internal::@341::BuiltinMetadata::KindSpecificData data
const uint32_t * counts() const
void SetBlockId(size_t offset, int32_t id)
void AddBranch(int32_t true_block_id, int32_t false_block_id)
bool IsGeneratingEmbeddedBuiltins() const
detail::ArrayHeaderBase< HeapObjectLayout, true > Header
V< None > REDUCE_INPUT_GRAPH Branch(V< None > ig_index, const BranchOp &branch)
Handle< HeapObject > counters_array_handle_
void Bind(Block *new_block)
OpIndex ReduceOperation(Args... args)
void StoreCounterValue(int block_number, V< Word32 > value)
size_t operations_emitted_in_current_block_
const bool on_heap_counters_
V< Object > REDUCE Parameter(int32_t parameter_index, RegisterRepresentation rep, const char *debug_name)
V< Any > REDUCE DidntThrow(V< Any > throwing_operation, bool has_catch_block, const base::Vector< const RegisterRepresentation > *results_rep, OpEffects throwing_op_effects)
BasicBlockProfilerData * data_
void EmitBlockInstrumentation(int block_number)
V< Any > REDUCE CatchBlockBegin()
V< Word32 > LoadCounterValue(int block_number)
static constexpr MemoryRepresentation Uint32()
#define TURBOSHAFT_REDUCER_BOILERPLATE(Name)
Handle< SharedFunctionInfo > info
base::Vector< const DirectHandle< Object > > args
Handle< HeapObject > CreateCountersArray(Isolate *isolate)
i::Address Load(i::Address address)
#define DCHECK_NOT_NULL(val)
static constexpr Kind TaggedBase()