1// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_COMPILER_BACKEND_FRAME_ELIDER_H_
6#define V8_COMPILER_BACKEND_FRAME_ELIDER_H_
7
8#include "src/compiler/backend/instruction.h"
9
10namespace v8 {
11namespace internal {
12namespace compiler {
13
14// Determine which instruction blocks need a frame and where frames must be
15// constructed/deconstructed.
16class FrameElider {
17 public:
18 explicit FrameElider(InstructionSequence* code);
19 void Run();
20
21 private:
22 void MarkBlocks();
23 void PropagateMarks();
24 void MarkDeConstruction();
25 bool PropagateInOrder();
26 bool PropagateReversed();
27 bool PropagateIntoBlock(InstructionBlock* block);
28 const InstructionBlocks& instruction_blocks() const;
29 InstructionBlock* InstructionBlockAt(RpoNumber rpo_number) const;
30 Instruction* InstructionAt(int index) const;
31
32 InstructionSequence* const code_;
33};
34
35} // namespace compiler
36} // namespace internal
37} // namespace v8
38
39#endif // V8_COMPILER_BACKEND_FRAME_ELIDER_H_
40