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_ARRAY_WRITER_H_ |
| 6 #define V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ |
| 7 |
| 8 #include "src/interpreter/bytecode-pipeline.h" |
| 9 |
| 10 namespace v8 { |
| 11 namespace internal { |
| 12 namespace interpreter { |
| 13 |
| 14 class SourcePositionTableBuilder; |
| 15 |
| 16 // Class for emitting bytecode as the final stage of the bytecode |
| 17 // generation pipeline. |
| 18 class BytecodeArrayWriter : public BytecodePipelineStage { |
| 19 public: |
| 20 BytecodeArrayWriter( |
| 21 Zone* zone, SourcePositionTableBuilder* source_position_table_builder); |
| 22 virtual ~BytecodeArrayWriter(); |
| 23 |
| 24 size_t FlushForOffset() override; |
| 25 void FlushBasicBlock() override; |
| 26 void Write(BytecodeNode* node) override; |
| 27 |
| 28 // Get the bytecode vector. |
| 29 ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; } |
| 30 |
| 31 // Returns the size in bytes of the frame associated with the |
| 32 // bytecode written. |
| 33 int GetMeasuredFrameSize(); |
| 34 |
| 35 private: |
| 36 void EmitBytecode(const BytecodeNode* const node); |
| 37 void UpdateSourcePositionTable(const BytecodeNode* const node); |
| 38 |
| 39 ZoneVector<uint8_t> bytecodes_; |
| 40 int max_register_count_; |
| 41 SourcePositionTableBuilder* source_position_table_builder_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(BytecodeArrayWriter); |
| 44 }; |
| 45 |
| 46 } // namespace interpreter |
| 47 } // namespace internal |
| 48 } // namespace v8 |
| 49 |
| 50 #endif // V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ |
OLD | NEW |