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