#include <optional>
#if !V8_ENABLE_WEBASSEMBLY
#error This header should only be included if WebAssembly is enabled.
#endif
#ifndef V8_COMPILER_TURBOSHAFT_WASM_LOAD_ELIMINATION_REDUCER_H_
#define V8_COMPILER_TURBOSHAFT_WASM_LOAD_ELIMINATION_REDUCER_H_
#include "src/base/doubly-threaded-list.h"
#include "src/compiler/turboshaft/analyzer-iterator.h"
#include "src/compiler/turboshaft/assembler.h"
#include "src/compiler/turboshaft/graph.h"
#include "src/compiler/turboshaft/loop-finder.h"
#include "src/compiler/turboshaft/phase.h"
#include "src/compiler/turboshaft/snapshot-table-opindex.h"
#include "src/compiler/turboshaft/utils.h"
#include "src/wasm/wasm-subtyping.h"
#include "src/zone/zone.h"
namespace v8::internal::compiler::turboshaft {
#include "src/compiler/turboshaft/define-assembler-macros.inc"
namespace wle {
static constexpr int kArrayLengthFieldIndex = …;
static constexpr int kStringPrepareForGetCodeunitIndex = …;
static constexpr int kStringAsWtf16Index = …;
static constexpr int kAnyConvertExternIndex = …;
static constexpr int kAssertNotNullIndex = …;
static constexpr uint32_t kLoadLikeType = …;
static constexpr int kLoadLikeSize = …;
struct WasmMemoryAddress { … };
inline size_t hash_value(WasmMemoryAddress const& mem) { … }
struct KeyData { … };
struct OffsetListTraits { … };
struct BaseListTraits { … };
struct BaseData { … };
class WasmMemoryContentTable
: public ChangeTrackingSnapshotTable<WasmMemoryContentTable, OpIndex,
KeyData> { … };
}
class WasmLoadEliminationAnalyzer { … };
template <class Next>
class WasmLoadEliminationReducer : public Next { … };
void WasmLoadEliminationAnalyzer::ProcessBlock(const Block& block,
bool compute_start_snapshot) { … }
bool RepIsCompatible(RegisterRepresentation actual,
RegisterRepresentation expected_reg_repr,
uint8_t in_memory_size) { … }
void WasmLoadEliminationAnalyzer::ProcessStructGet(OpIndex op_idx,
const StructGetOp& get) { … }
void WasmLoadEliminationAnalyzer::ProcessStructSet(OpIndex op_idx,
const StructSetOp& set) { … }
void WasmLoadEliminationAnalyzer::ProcessArrayLength(
OpIndex op_idx, const ArrayLengthOp& length) { … }
void WasmLoadEliminationAnalyzer::ProcessWasmAllocateArray(
OpIndex op_idx, const WasmAllocateArrayOp& alloc) { … }
void WasmLoadEliminationAnalyzer::ProcessStringAsWtf16(
OpIndex op_idx, const StringAsWtf16Op& op) { … }
void WasmLoadEliminationAnalyzer::ProcessStringPrepareForGetCodeUnit(
OpIndex op_idx, const StringPrepareForGetCodeUnitOp& prep) { … }
void WasmLoadEliminationAnalyzer::ProcessAnyConvertExtern(
OpIndex op_idx, const AnyConvertExternOp& convert) { … }
void WasmLoadEliminationAnalyzer::ProcessAssertNotNull(
OpIndex op_idx, const AssertNotNullOp& assert) { … }
void WasmLoadEliminationAnalyzer::ProcessCall(OpIndex op_idx,
const CallOp& op) { … }
void WasmLoadEliminationAnalyzer::InvalidateAllNonAliasingInputs(
const Operation& op) { … }
void WasmLoadEliminationAnalyzer::InvalidateIfAlias(OpIndex op_idx) { … }
void WasmLoadEliminationAnalyzer::DcheckWordBinop(OpIndex op_idx,
const WordBinopOp& binop) { … }
void WasmLoadEliminationAnalyzer::ProcessAllocate(OpIndex op_idx,
const AllocateOp&) { … }
void WasmLoadEliminationAnalyzer::ProcessPhi(OpIndex op_idx, const PhiOp& phi) { … }
void WasmLoadEliminationAnalyzer::FinishBlock(const Block* block) { … }
void WasmLoadEliminationAnalyzer::SealAndDiscard() { … }
void WasmLoadEliminationAnalyzer::StoreLoopSnapshotInForwardPredecessor(
const Block& loop_header) { … }
bool WasmLoadEliminationAnalyzer::BackedgeHasSnapshot(
const Block& loop_header) const { … }
template <bool for_loop_revisit>
bool WasmLoadEliminationAnalyzer::BeginBlock(const Block* block) { … }
#include "src/compiler/turboshaft/undef-assembler-macros.inc"
}
#endif