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

Unified Diff: src/interpreter/bytecodes.h

Issue 1239793002: [interpreter] Add basic framework for bytecode handler code generation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix GN for realz 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
« no previous file with comments | « src/interpreter/OWNERS ('k') | src/interpreter/bytecodes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecodes.h
diff --git a/src/interpreter/bytecodes.h b/src/interpreter/bytecodes.h
new file mode 100644
index 0000000000000000000000000000000000000000..41359b0b250f799ba46d7cd366d496a1508429f8
--- /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>
+
+// Clients of this interface shouldn't depend on lots of interpreter internals.
+// Do not include anything from src/interpreter here!
+#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
+#define COUNT_BYTECODE(x, _) +1
+ // The COUNT_BYTECODE macro will turn this into kLast = -1 +1 +1... which will
+ // evaluate to the same value as the last real bytecode.
+ kLast = -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);
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes);
+};
+
+
+std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode);
+
+} // namespace interpreter
+} // namespace internal
+} // namespace v8
+
+#endif // V8_INTERPRETER_BYTECODES_H_
« no previous file with comments | « src/interpreter/OWNERS ('k') | src/interpreter/bytecodes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698