OLD | NEW |
(Empty) | |
| 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_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ |
| 6 #define V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ |
| 7 |
| 8 #include "src/interpreter/bytecode-writer.h" |
| 9 |
| 10 namespace v8 { |
| 11 namespace internal { |
| 12 namespace interpreter { |
| 13 |
| 14 class ConstantArrayBuilder; |
| 15 |
| 16 class BytecodePeepholeOptimizer : public BytecodeWriter, public ZoneObject { |
| 17 public: |
| 18 BytecodePeepholeOptimizer(ConstantArrayBuilder* constant_array_builder, |
| 19 BytecodeWriter* output_writer); |
| 20 |
| 21 // Flush internal state for a branch. |
| 22 size_t FlushForOffset() override; |
| 23 |
| 24 // Signal end of basic block. |
| 25 void LeaveBasicBlock() override; |
| 26 |
| 27 // Write bytecode into pipeline. |
| 28 void Write(BytecodeNode* node) override; |
| 29 |
| 30 private: |
| 31 BytecodeNode* Optimize(BytecodeNode* current); |
| 32 |
| 33 Handle<Object> GetConstantForIndexOperand(const BytecodeNode* const node, |
| 34 int index) const; |
| 35 |
| 36 ConstantArrayBuilder* constant_array_builder_; |
| 37 BytecodeWriter* output_writer_; |
| 38 BytecodeNode* last_; |
| 39 bool last_is_discardable_; |
| 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(BytecodePeepholeOptimizer); |
| 42 }; |
| 43 |
| 44 } // namespace interpreter |
| 45 } // namespace internal |
| 46 } // namespace v8 |
| 47 |
| 48 #endif // V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_ |
OLD | NEW |