5 #include "src/compiler/checkpoint-elimination.h" 7 #include "src/compiler/node-properties.h" 13 CheckpointElimination::CheckpointElimination(Editor* editor)
14 : AdvancedReducer(editor) {}
21 bool IsRedundantCheckpoint(Node* node) {
22 Node* effect = NodeProperties::GetEffectInput(node);
23 while (effect->op()->HasProperty(Operator::kNoWrite) &&
24 effect->op()->EffectInputCount() == 1) {
25 if (effect->opcode() == IrOpcode::kCheckpoint)
return true;
26 effect = NodeProperties::GetEffectInput(effect);
33 Reduction CheckpointElimination::ReduceCheckpoint(Node* node) {
34 DCHECK_EQ(IrOpcode::kCheckpoint, node->opcode());
35 if (IsRedundantCheckpoint(node)) {
36 return Replace(NodeProperties::GetEffectInput(node));
41 Reduction CheckpointElimination::Reduce(Node* node) {
42 DisallowHeapAccess no_heap_access;
43 switch (node->opcode()) {
44 case IrOpcode::kCheckpoint:
45 return ReduceCheckpoint(node);