#include "src/maglev/maglev-interpreter-frame-state.h"
#include "include/v8-internal.h"
#include "src/base/logging.h"
#include "src/handles/handles-inl.h"
#include "src/interpreter/bytecode-register.h"
#include "src/maglev/maglev-basic-block.h"
#include "src/maglev/maglev-compilation-info.h"
#include "src/maglev/maglev-compilation-unit.h"
#include "src/maglev/maglev-graph-builder.h"
#include "src/maglev/maglev-graph-printer.h"
#include "src/maglev/maglev-graph.h"
#include "src/maglev/maglev-ir-inl.h"
#include "src/maglev/maglev-ir.h"
#include "src/objects/function-kind.h"
#include "src/zone/zone-containers.h"
namespace v8 {
namespace internal {
namespace maglev {
namespace {
NodeType GetNodeType(compiler::JSHeapBroker* broker, LocalIsolate* isolate,
const KnownNodeAspects& aspects, ValueNode* node) { … }
}
void KnownNodeAspects::Merge(const KnownNodeAspects& other, Zone* zone) { … }
namespace {
template <typename Key>
bool NextInIgnoreList(typename ZoneSet<Key>::const_iterator& ignore,
typename ZoneSet<Key>::const_iterator& ignore_end,
const Key& cur) { … }
}
void KnownNodeAspects::ClearUnstableNodeAspects() { … }
KnownNodeAspects* KnownNodeAspects::CloneForLoopHeader(
Zone* zone, bool optimistic, LoopEffects* loop_effects) const { … }
namespace {
template <typename As, typename Bs, typename CompareFunction,
typename IsEmptyFunction = std::nullptr_t>
bool AspectIncludes(const As& as, const Bs& bs, const CompareFunction& Compare,
const IsEmptyFunction IsEmpty = nullptr) { … }
template <typename As, typename Bs, typename Function>
bool MaybeEmptyAspectIncludes(const As& as, const Bs& bs,
const Function& Compare) { … }
bool NodeInfoIncludes(const NodeInfo& before, const NodeInfo& after) { … }
bool NodeInfoIsEmpty(const NodeInfo& info) { … }
bool NodeInfoTypeIs(const NodeInfo& before, const NodeInfo& after) { … }
bool SameValue(ValueNode* before, ValueNode* after) { … }
}
bool KnownNodeAspects::IsCompatibleWithLoopHeader(
const KnownNodeAspects& loop_header) const { … }
MergePointInterpreterFrameState* MergePointInterpreterFrameState::New(
const MaglevCompilationUnit& info, const InterpreterFrameState& state,
int merge_offset, int predecessor_count, BasicBlock* predecessor,
const compiler::BytecodeLivenessState* liveness) { … }
MergePointInterpreterFrameState* MergePointInterpreterFrameState::NewForLoop(
const InterpreterFrameState& start_state, const MaglevCompilationUnit& info,
int merge_offset, int predecessor_count,
const compiler::BytecodeLivenessState* liveness,
const compiler::LoopInfo* loop_info, bool has_been_peeled) { … }
MergePointInterpreterFrameState*
MergePointInterpreterFrameState::NewForCatchBlock(
const MaglevCompilationUnit& unit,
const compiler::BytecodeLivenessState* liveness, int handler_offset,
bool was_used, interpreter::Register context_register, Graph* graph) { … }
MergePointInterpreterFrameState::MergePointInterpreterFrameState(
const MaglevCompilationUnit& info, int merge_offset, int predecessor_count,
int predecessors_so_far, BasicBlock** predecessors, BasicBlockType type,
const compiler::BytecodeLivenessState* liveness)
: … { … }
namespace {
void PrintBeforeMerge(const MaglevCompilationUnit& compilation_unit,
ValueNode* current_value, ValueNode* unmerged_value,
interpreter::Register reg, KnownNodeAspects* kna) { … }
void PrintAfterMerge(const MaglevCompilationUnit& compilation_unit,
ValueNode* merged_value, KnownNodeAspects* kna) { … }
}
void MergePointInterpreterFrameState::Merge(MaglevGraphBuilder* builder,
InterpreterFrameState& unmerged,
BasicBlock* predecessor) { … }
void MergePointInterpreterFrameState::MergePhis(
MaglevGraphBuilder* builder, MaglevCompilationUnit& compilation_unit,
InterpreterFrameState& unmerged, BasicBlock* predecessor,
bool optimistic_loop_phis) { … }
void MergePointInterpreterFrameState::MergeVirtualObject(
MaglevGraphBuilder* builder, const VirtualObject::List unmerged_vos,
const KnownNodeAspects& unmerged_aspects, VirtualObject* merged,
VirtualObject* unmerged) { … }
void MergePointInterpreterFrameState::MergeVirtualObjects(
MaglevGraphBuilder* builder, MaglevCompilationUnit& compilation_unit,
const VirtualObject::List unmerged_vos,
const KnownNodeAspects& unmerged_aspects) { … }
void MergePointInterpreterFrameState::InitializeLoop(
MaglevGraphBuilder* builder, MaglevCompilationUnit& compilation_unit,
InterpreterFrameState& unmerged, BasicBlock* predecessor,
bool optimistic_initial_state, LoopEffects* loop_effects) { … }
void MergePointInterpreterFrameState::InitializeWithBasicBlock(
BasicBlock* block) { … }
void MergePointInterpreterFrameState::Merge(
MaglevGraphBuilder* builder, MaglevCompilationUnit& compilation_unit,
InterpreterFrameState& unmerged, BasicBlock* predecessor) { … }
void MergePointInterpreterFrameState::MergeLoop(
MaglevGraphBuilder* builder, InterpreterFrameState& loop_end_state,
BasicBlock* loop_end_block) { … }
void MergePointInterpreterFrameState::MergeLoop(
MaglevGraphBuilder* builder, MaglevCompilationUnit& compilation_unit,
InterpreterFrameState& loop_end_state, BasicBlock* loop_end_block) { … }
bool MergePointInterpreterFrameState::TryMergeLoop(
MaglevGraphBuilder* builder, InterpreterFrameState& loop_end_state,
const std::function<BasicBlock*()>& FinishBlock) { … }
void MergePointInterpreterFrameState::set_loop_effects(
LoopEffects* loop_effects) { … }
const LoopEffects* MergePointInterpreterFrameState::loop_effects() { … }
void MergePointInterpreterFrameState::MergeThrow(
MaglevGraphBuilder* builder, const MaglevCompilationUnit* handler_unit,
const KnownNodeAspects& known_node_aspects,
const VirtualObject::List virtual_objects) { … }
namespace {
ValueNode* FromInt32ToTagged(const MaglevGraphBuilder* builder,
NodeType node_type, ValueNode* value,
BasicBlock* predecessor) { … }
ValueNode* FromUint32ToTagged(const MaglevGraphBuilder* builder,
NodeType node_type, ValueNode* value,
BasicBlock* predecessor) { … }
ValueNode* FromFloat64ToTagged(const MaglevGraphBuilder* builder,
NodeType node_type, ValueNode* value,
BasicBlock* predecessor) { … }
ValueNode* FromHoleyFloat64ToTagged(const MaglevGraphBuilder* builder,
NodeType node_type, ValueNode* value,
BasicBlock* predecessor) { … }
ValueNode* NonTaggedToTagged(const MaglevGraphBuilder* builder,
NodeType node_type, ValueNode* value,
BasicBlock* predecessor) { … }
ValueNode* EnsureTagged(const MaglevGraphBuilder* builder,
const KnownNodeAspects& known_node_aspects,
ValueNode* value, BasicBlock* predecessor) { … }
}
NodeType MergePointInterpreterFrameState::AlternativeType(
const Alternatives* alt) { … }
ValueNode* MergePointInterpreterFrameState::MergeValue(
const MaglevGraphBuilder* builder, interpreter::Register owner,
const KnownNodeAspects& unmerged_aspects, ValueNode* merged,
ValueNode* unmerged, Alternatives::List* per_predecessor_alternatives,
bool optimistic_loop_phis) { … }
std::optional<ValueNode*>
MergePointInterpreterFrameState::MergeVirtualObjectValue(
const MaglevGraphBuilder* builder, const KnownNodeAspects& unmerged_aspects,
ValueNode* merged, ValueNode* unmerged) { … }
void MergePointInterpreterFrameState::MergeLoopValue(
MaglevGraphBuilder* builder, interpreter::Register owner,
const KnownNodeAspects& unmerged_aspects, ValueNode* merged,
ValueNode* unmerged) { … }
ValueNode* MergePointInterpreterFrameState::NewLoopPhi(
Zone* zone, interpreter::Register reg) { … }
void MergePointInterpreterFrameState::ReducePhiPredecessorCount(unsigned num) { … }
}
}
}