Index: src/interpreter/bytecodes.h |
diff --git a/src/interpreter/bytecodes.h b/src/interpreter/bytecodes.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e3e70f599388e48f5711e462545cc7d69f4bf4f5 |
--- /dev/null |
+++ b/src/interpreter/bytecodes.h |
@@ -0,0 +1,56 @@ |
+// 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_BYTECODES_H_ |
+#define V8_INTERPRETER_BYTECODES_H_ |
+ |
+#include <iosfwd> |
+ |
+#include "src/utils.h" |
+ |
+namespace v8 { |
+namespace internal { |
+namespace interpreter { |
+ |
+// The list of bytecodes which are interpreted by the interpreter. |
+#define BYTECODE_LIST(V) \ |
+ V(LoadLiteral0, 1) \ |
+ V(Return, 0) |
+ |
+enum class Bytecode : uint8_t { |
+#define DECLARE_BYTECODE(Name, _) k##Name, |
+ BYTECODE_LIST(DECLARE_BYTECODE) |
+#undef DECLARE_BYTECODE |
+ kLast = -1 |
+#define COUNT_BYTECODE(x, _) +1 |
+ BYTECODE_LIST(COUNT_BYTECODE) |
+#undef COUNT_BYTECODE |
+}; |
+ |
+class Bytecodes { |
+ public: |
+ // Returns string representation of |bytecode|. |
+ static const char* ToString(Bytecode bytecode); |
+ |
+ // Returns the number of arguments expected by |bytecode|. |
+ static const int NumberOfArguments(Bytecode bytecode); |
+ |
+ // Returns the size of the bytecode including its arguments. |
+ static const int Size(Bytecode bytecode); |
+ |
+ // Returns true if the bytecode is a function return bytecode. |
+ static const bool IsReturn(Bytecode bytecode); |
+ |
+ private: |
+ Bytecodes() { UNREACHABLE(); } |
+}; |
+ |
+ |
+std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
+ |
+} // namespace interpreter |
+} // namespace internal |
+} // namespace v8 |
+ |
+#endif // V8_INTERPRETER_BYTECODES_H_ |