OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_INTERPRETER_BYTECODE_DEAD_CODE_OPTIMIZER_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_DEAD_CODE_OPTIMIZER_H_ |
6 #define V8_INTERPRETER_BYTECODE_DEAD_CODE_OPTIMIZER_H_ | 6 #define V8_INTERPRETER_BYTECODE_DEAD_CODE_OPTIMIZER_H_ |
7 | 7 |
8 #include "src/interpreter/bytecode-pipeline.h" | 8 #include "src/interpreter/bytecode-pipeline.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 namespace internal { | 11 namespace internal { |
12 namespace interpreter { | 12 namespace interpreter { |
13 | 13 |
14 // An optimization stage for eliminating obviously dead code in bytecode | 14 // An optimization stage for eliminating obviously dead code in bytecode |
15 // generation. | 15 // generation. |
16 class BytecodeDeadCodeOptimizer final : public BytecodePipelineStage, | 16 class BytecodeDeadCodeOptimizer final : public BytecodePipelineStage, |
17 public ZoneObject { | 17 public ZoneObject { |
18 public: | 18 public: |
19 explicit BytecodeDeadCodeOptimizer(BytecodePipelineStage* next_stage); | 19 explicit BytecodeDeadCodeOptimizer(BytecodePipelineStage* next_stage); |
20 | 20 |
21 // BytecodePipelineStage interface. | 21 // BytecodePipelineStage interface. |
22 void Write(BytecodeNode* node) override; | 22 void Write(BytecodeNode* node) override; |
23 void WriteJump(BytecodeNode* node, BytecodeLabel* label) override; | 23 void WriteJump(BytecodeNode* node, BytecodeLabel* label) override; |
24 void BindLabel(BytecodeLabel* label) override; | 24 void BindLabel(BytecodeLabel* label) override; |
25 void BindLabel(const BytecodeLabel& target, BytecodeLabel* label) override; | 25 void BindLabel(const BytecodeLabel& target, BytecodeLabel* label) override; |
26 Handle<BytecodeArray> ToBytecodeArray( | 26 Handle<BytecodeArray> ToBytecodeArray( |
27 int fixed_register_count, int parameter_count, | 27 Isolate* isolate, int fixed_register_count, int parameter_count, |
28 Handle<FixedArray> handler_table) override; | 28 Handle<FixedArray> handler_table) override; |
29 | 29 |
30 private: | 30 private: |
31 BytecodePipelineStage* next_stage_; | 31 BytecodePipelineStage* next_stage_; |
32 bool exit_seen_in_block_; | 32 bool exit_seen_in_block_; |
33 | 33 |
34 DISALLOW_COPY_AND_ASSIGN(BytecodeDeadCodeOptimizer); | 34 DISALLOW_COPY_AND_ASSIGN(BytecodeDeadCodeOptimizer); |
35 }; | 35 }; |
36 | 36 |
37 } // namespace interpreter | 37 } // namespace interpreter |
38 } // namespace internal | 38 } // namespace internal |
39 } // namespace v8 | 39 } // namespace v8 |
40 | 40 |
41 #endif // V8_INTERPRETER_BYTECODE_DEAD_CODE_OPTIMIZER_H_ | 41 #endif // V8_INTERPRETER_BYTECODE_DEAD_CODE_OPTIMIZER_H_ |
OLD | NEW |