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

Unified Diff: src/interpreter/bytecode-peephole-optimizer.h

Issue 1947403002: [interpreter] Introduce bytecode generation pipeline. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix return type of BytecodeSourceInfo::is_statement() 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
Index: src/interpreter/bytecode-peephole-optimizer.h
diff --git a/src/interpreter/bytecode-peephole-optimizer.h b/src/interpreter/bytecode-peephole-optimizer.h
new file mode 100644
index 0000000000000000000000000000000000000000..a5755530356f043dca8f0c0159ee0f9bd24c6bf4
--- /dev/null
+++ b/src/interpreter/bytecode-peephole-optimizer.h
@@ -0,0 +1,48 @@
+// 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_PEEPHOLE_OPTIMIZER_H_
+#define V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_
+
+#include "src/interpreter/bytecode-writer.h"
+
+namespace v8 {
+namespace internal {
+namespace interpreter {
+
+class ConstantArrayBuilder;
+
+class BytecodePeepholeOptimizer : public BytecodeWriter, public ZoneObject {
+ public:
+ BytecodePeepholeOptimizer(ConstantArrayBuilder* constant_array_builder,
+ BytecodeWriter* output_writer);
+
+ // Flush internal state for a branch.
+ size_t FlushForOffset() override;
+
+ // Signal end of basic block.
+ void LeaveBasicBlock() override;
+
+ // Write bytecode into pipeline.
+ void Write(BytecodeNode* node) override;
+
+ private:
+ BytecodeNode* Optimize(BytecodeNode* current);
+
+ Handle<Object> GetConstantForIndexOperand(const BytecodeNode* const node,
+ int index) const;
+
+ ConstantArrayBuilder* constant_array_builder_;
+ BytecodeWriter* output_writer_;
+ BytecodeNode* last_;
+ bool last_is_discardable_;
+
+ DISALLOW_COPY_AND_ASSIGN(BytecodePeepholeOptimizer);
+};
+
+} // namespace interpreter
+} // namespace internal
+} // namespace v8
+
+#endif // V8_INTERPRETER_BYTECODE_PEEPHOLE_OPTIMIZER_H_

Powered by Google App Engine
This is Rietveld 408576698