Index: src/interpreter/bytecode-array-writer.h |
diff --git a/src/interpreter/bytecode-array-writer.h b/src/interpreter/bytecode-array-writer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b1303c9f6ab47665e82d8caafa5bd85982a07376 |
--- /dev/null |
+++ b/src/interpreter/bytecode-array-writer.h |
@@ -0,0 +1,50 @@ |
+// Copyright 2015 the V8 project authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ |
+#define V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ |
+ |
+#include "src/interpreter/bytecode-pipeline.h" |
+ |
+namespace v8 { |
+namespace internal { |
+namespace interpreter { |
+ |
+class SourcePositionTableBuilder; |
+ |
+// Class for emitting bytecode as the final stage of the bytecode |
+// generation pipeline. |
+class BytecodeArrayWriter final : public BytecodePipelineStage { |
+ public: |
+ BytecodeArrayWriter( |
+ Zone* zone, SourcePositionTableBuilder* source_position_table_builder); |
+ virtual ~BytecodeArrayWriter(); |
+ |
+ void Write(BytecodeNode* node) override; |
+ size_t FlushForOffset() override; |
+ void FlushBasicBlock() override; |
+ |
+ // Get the bytecode vector. |
+ ZoneVector<uint8_t>* bytecodes() { return &bytecodes_; } |
+ |
+ // Returns the size in bytes of the frame associated with the |
+ // bytecode written. |
+ int GetMaximumFrameSizeUsed(); |
+ |
+ private: |
+ void EmitBytecode(const BytecodeNode* const node); |
+ void UpdateSourcePositionTable(const BytecodeNode* const node); |
+ |
+ ZoneVector<uint8_t> bytecodes_; |
+ int max_register_count_; |
+ SourcePositionTableBuilder* source_position_table_builder_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BytecodeArrayWriter); |
+}; |
+ |
+} // namespace interpreter |
+} // namespace internal |
+} // namespace v8 |
+ |
+#endif // V8_INTERPRETER_BYTECODE_ARRAY_WRITER_H_ |