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_FRAME_ELIDER_H_
6#define V8_COMPILER_FRAME_ELIDER_H_
7
8#include "src/compiler/instruction.h"
9
10namespace v8 {
11namespace internal {
12namespace compiler {
13
14
15// Determine which instruction blocks need a frame and where frames must be
16// constructed/deconstructed.
17class FrameElider {
18 public:
19  explicit FrameElider(InstructionSequence* code);
20  void Run();
21
22
23 private:
24  void MarkBlocks();
25  void PropagateMarks();
26  void MarkDeConstruction();
27  bool PropagateInOrder();
28  bool PropagateReversed();
29  bool PropagateIntoBlock(InstructionBlock* block);
30  const InstructionBlocks& instruction_blocks() const;
31  InstructionBlock* InstructionBlockAt(RpoNumber rpo_number) const;
32  Instruction* InstructionAt(int index) const;
33
34  InstructionSequence* const code_;
35};
36
37}  // namespace compiler
38}  // namespace internal
39}  // namespace v8
40
41#endif  // V8_COMPILER_FRAME_ELIDER_H_
42