#ifndef V8_COMPILER_LOOP_UNROLLING_H_
#define V8_COMPILER_LOOP_UNROLLING_H_
#include "src/compiler/common-operator.h"
#include "src/compiler/loop-analysis.h"
namespace v8 {
namespace internal {
namespace compiler {
static constexpr uint32_t kMaximumUnnestedSize = 50;
static constexpr uint32_t kMaximumUnrollingCount = 5;
V8_INLINE uint32_t unrolling_count_heuristic(uint32_t size, uint32_t depth) {
return std::min((depth + 1) * kMaximumUnnestedSize / size,
kMaximumUnrollingCount);
}
V8_INLINE uint32_t maximum_unrollable_size(uint32_t depth) {
return (depth + 1) * kMaximumUnnestedSize;
}
void UnrollLoop(Node* loop_node, ZoneUnorderedSet<Node*>* loop, uint32_t depth,
TFGraph* graph, CommonOperatorBuilder* common, Zone* tmp_zone,
SourcePositionTable* source_positions,
NodeOriginTable* node_origins);
}
}
}
#endif