Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1243)

Unified Diff: src/interpreter/bytecode-array-writer.h

Issue 1947403002: [interpreter] Introduce bytecode generation pipeline. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/bytecode-array-iterator.cc ('k') | src/interpreter/bytecode-array-writer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_
« no previous file with comments | « src/interpreter/bytecode-array-iterator.cc ('k') | src/interpreter/bytecode-array-writer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698