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 #include "src/interpreter/bytecode-dead-code-optimizer.h" | 5 #include "src/interpreter/bytecode-dead-code-optimizer.h" |
6 | 6 |
7 namespace v8 { | 7 namespace v8 { |
8 namespace internal { | 8 namespace internal { |
9 namespace interpreter { | 9 namespace interpreter { |
10 | 10 |
11 BytecodeDeadCodeOptimizer::BytecodeDeadCodeOptimizer( | 11 BytecodeDeadCodeOptimizer::BytecodeDeadCodeOptimizer( |
12 BytecodePipelineStage* next_stage) | 12 BytecodePipelineStage* next_stage) |
13 : next_stage_(next_stage), exit_seen_in_block_(false) {} | 13 : next_stage_(next_stage), exit_seen_in_block_(false) {} |
14 | 14 |
15 // override | 15 // override |
16 Handle<BytecodeArray> BytecodeDeadCodeOptimizer::ToBytecodeArray( | 16 Handle<BytecodeArray> BytecodeDeadCodeOptimizer::ToBytecodeArray( |
17 int fixed_register_count, int parameter_count, | 17 Isolate* isolate, int fixed_register_count, int parameter_count, |
18 Handle<FixedArray> handler_table) { | 18 Handle<FixedArray> handler_table) { |
19 return next_stage_->ToBytecodeArray(fixed_register_count, parameter_count, | 19 return next_stage_->ToBytecodeArray(isolate, fixed_register_count, |
20 handler_table); | 20 parameter_count, handler_table); |
21 } | 21 } |
22 | 22 |
23 // override | 23 // override |
24 void BytecodeDeadCodeOptimizer::Write(BytecodeNode* node) { | 24 void BytecodeDeadCodeOptimizer::Write(BytecodeNode* node) { |
25 // Don't emit dead code. | 25 // Don't emit dead code. |
26 if (exit_seen_in_block_) return; | 26 if (exit_seen_in_block_) return; |
27 | 27 |
28 switch (node->bytecode()) { | 28 switch (node->bytecode()) { |
29 case Bytecode::kReturn: | 29 case Bytecode::kReturn: |
30 case Bytecode::kThrow: | 30 case Bytecode::kThrow: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void BytecodeDeadCodeOptimizer::BindLabel(const BytecodeLabel& target, | 68 void BytecodeDeadCodeOptimizer::BindLabel(const BytecodeLabel& target, |
69 BytecodeLabel* label) { | 69 BytecodeLabel* label) { |
70 next_stage_->BindLabel(target, label); | 70 next_stage_->BindLabel(target, label); |
71 // exit_seen_in_block_ was reset when target was bound, so shouldn't be | 71 // exit_seen_in_block_ was reset when target was bound, so shouldn't be |
72 // changed here. | 72 // changed here. |
73 } | 73 } |
74 | 74 |
75 } // namespace interpreter | 75 } // namespace interpreter |
76 } // namespace internal | 76 } // namespace internal |
77 } // namespace v8 | 77 } // namespace v8 |
OLD | NEW |