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

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

Issue 1266713004: [Intepreter] Addition of BytecodeArrayBuilder and accumulator based bytecodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tweak BytecodeArray::Disassemble(). Created 5 years, 5 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-array-builder.h
diff --git a/src/interpreter/bytecode-array-builder.h b/src/interpreter/bytecode-array-builder.h
new file mode 100644
index 0000000000000000000000000000000000000000..2372a322932ebd5abb8d6de798d73211447ff0cc
--- /dev/null
+++ b/src/interpreter/bytecode-array-builder.h
@@ -0,0 +1,60 @@
+// 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_BUILDER_H_
+#define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_
+
+#include <vector>
+
+#include "src/interpreter/bytecodes.h"
+
+namespace v8 {
+namespace internal {
+
+class Isolate;
+
+namespace interpreter {
+
+class BytecodeArrayBuilder {
+ public:
+ explicit BytecodeArrayBuilder(Isolate* isolate);
+ Handle<BytecodeArray> ToBytecodeArray() const;
+
+ void BinaryOperation(Token::Value binop, int reg);
rmcilroy 2015/07/30 10:12:25 optional suggestion - is it worth returning "this"
oth 2015/07/30 15:38:42 Done.
+ void LoadLiteral(v8::internal::Smi* value);
rmcilroy 2015/07/30 10:12:25 nit - add some section header comments (e.g., "Loa
oth 2015/07/30 15:38:42 Done.
+ void LoadUndefined();
+ void LoadNull();
+ void LoadTheHole();
+ void LoadTrue();
+ void LoadFalse();
+ void LoadAccumulatorWithRegister(int reg);
+ void StoreAccumulatorInRegister(int reg);
+ void Return();
+
+ int AllocateScratchRegister();
+ void FreeScratchRegister(int reg);
+
+ void set_stack_slots(int slots);
+
+ private:
+ static Bytecode BytecodeFor(Token::Value op);
+ void Output(Bytecode bytecode, uint8_t r0, uint8_t r1, uint8_t r2);
+ void Output(Bytecode bytecode, uint8_t r0, uint8_t r1);
+ void Output(Bytecode bytecode, uint8_t r0);
+ void Output(Bytecode bytecode);
+
+ Isolate* isolate_;
+ std::vector<uint8_t> bytecodes_;
+
+ int max_registers_;
+ int scratch_register_;
+
+ DISALLOW_IMPLICIT_CONSTRUCTORS(BytecodeArrayBuilder);
+};
+
+} // namespace interpreter
+} // namespace internal
+} // namespace v8
+
+#endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_

Powered by Google App Engine
This is Rietveld 408576698