#include "src/compiler/memory-optimizer.h"
#include "src/base/logging.h"
#include "src/codegen/tick-counter.h"
#include "src/compiler/common-operator.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/linkage.h"
#include "src/compiler/node-properties.h"
#include "src/compiler/node.h"
#include "src/roots/roots-inl.h"
namespace v8 {
namespace internal {
namespace compiler {
namespace {
bool CanAllocate(const Node* node) { … }
Node* SearchAllocatingNode(Node* start, Node* limit, Zone* temp_zone) { … }
bool CanLoopAllocate(Node* loop_effect_phi, Zone* temp_zone) { … }
Node* EffectPhiForPhi(Node* phi) { … }
void WriteBarrierAssertFailed(Node* node, Node* object, const char* name,
Zone* temp_zone) { … }
}
MemoryOptimizer::MemoryOptimizer(
JSHeapBroker* broker, JSGraph* jsgraph, Zone* zone,
MemoryLowering::AllocationFolding allocation_folding,
const char* function_debug_name, TickCounter* tick_counter, bool is_wasm)
: … { … }
void MemoryOptimizer::Optimize() { … }
void MemoryOptimizer::VisitNode(Node* node, AllocationState const* state,
NodeId effect_chain) { … }
bool MemoryOptimizer::AllocationTypeNeedsUpdateToOld(Node* const node,
const Edge edge) { … }
void MemoryOptimizer::ReplaceUsesAndKillNode(Node* node, Node* replacement) { … }
void MemoryOptimizer::VisitAllocateRaw(Node* node, AllocationState const* state,
NodeId effect_chain) { … }
void MemoryOptimizer::VisitLoadFromObject(Node* node,
AllocationState const* state,
NodeId effect_chain) { … }
void MemoryOptimizer::VisitStoreToObject(Node* node,
AllocationState const* state,
NodeId effect_chain) { … }
void MemoryOptimizer::VisitLoadElement(Node* node, AllocationState const* state,
NodeId effect_chain) { … }
void MemoryOptimizer::VisitLoadField(Node* node, AllocationState const* state,
NodeId effect_chain) { … }
void MemoryOptimizer::VisitProtectedLoad(Node* node,
AllocationState const* state,
NodeId effect_chain) { … }
void MemoryOptimizer::VisitProtectedStore(Node* node,
AllocationState const* state,
NodeId effect_chain) { … }
void MemoryOptimizer::VisitStoreElement(Node* node,
AllocationState const* state,
NodeId effect_chain) { … }
void MemoryOptimizer::VisitStoreField(Node* node, AllocationState const* state,
NodeId effect_chain) { … }
void MemoryOptimizer::VisitStore(Node* node, AllocationState const* state,
NodeId effect_chain) { … }
void MemoryOptimizer::VisitCall(Node* node, AllocationState const* state,
NodeId effect_chain) { … }
void MemoryOptimizer::VisitOtherEffect(Node* node, AllocationState const* state,
NodeId effect_chain) { … }
MemoryOptimizer::AllocationState const* MemoryOptimizer::MergeStates(
AllocationStates const& states) { … }
void MemoryOptimizer::EnqueueMerge(Node* node, int index,
AllocationState const* state) { … }
void MemoryOptimizer::EnqueueUses(Node* node, AllocationState const* state,
NodeId effect_chain) { … }
void MemoryOptimizer::EnqueueUse(Node* node, int index,
AllocationState const* state,
NodeId effect_chain) { … }
Graph* MemoryOptimizer::graph() const { … }
}
}
}