• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 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_INTERPRETER_BYTECODE_DEAD_CODE_OPTIMIZER_H_
6 #define V8_INTERPRETER_BYTECODE_DEAD_CODE_OPTIMIZER_H_
7 
8 #include "src/interpreter/bytecode-pipeline.h"
9 
10 namespace v8 {
11 namespace internal {
12 namespace interpreter {
13 
14 // An optimization stage for eliminating obviously dead code in bytecode
15 // generation.
16 class BytecodeDeadCodeOptimizer final : public BytecodePipelineStage,
17                                         public ZoneObject {
18  public:
19   explicit BytecodeDeadCodeOptimizer(BytecodePipelineStage* next_stage);
20 
21   // BytecodePipelineStage interface.
22   void Write(BytecodeNode* node) override;
23   void WriteJump(BytecodeNode* node, BytecodeLabel* label) override;
24   void BindLabel(BytecodeLabel* label) override;
25   void BindLabel(const BytecodeLabel& target, BytecodeLabel* label) override;
26   Handle<BytecodeArray> ToBytecodeArray(
27       int fixed_register_count, int parameter_count,
28       Handle<FixedArray> handler_table) override;
29 
30  private:
31   BytecodePipelineStage* next_stage_;
32   bool exit_seen_in_block_;
33 
34   DISALLOW_COPY_AND_ASSIGN(BytecodeDeadCodeOptimizer);
35 };
36 
37 }  // namespace interpreter
38 }  // namespace internal
39 }  // namespace v8
40 
41 #endif  // V8_INTERPRETER_BYTECODE_DEAD_CODE_OPTIMIZER_H_
42