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

Unified Diff: src/interpreter/bytecodes.cc

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/bytecodes.h ('k') | src/interpreter/interpreter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecodes.cc
diff --git a/src/interpreter/bytecodes.cc b/src/interpreter/bytecodes.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0ab61e10e5a3f90bb435d109e5e71aa6cf15616a
--- /dev/null
+++ b/src/interpreter/bytecodes.cc
@@ -0,0 +1,51 @@
+// 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.
+
+#include "src/interpreter/bytecodes.h"
+
+namespace v8 {
+namespace internal {
+namespace interpreter {
+
+// static
+const char* Bytecodes::ToString(Bytecode bytecode) {
+ switch (bytecode) {
+#define CASE(Name, _) \
+ case Bytecode::k##Name: \
+ return #Name;
+ BYTECODE_LIST(CASE)
+#undef CASE
+ }
+ UNREACHABLE();
+ return "";
+}
+
+
+// static
+const int Bytecodes::NumberOfArguments(Bytecode bytecode) {
+ switch (bytecode) {
+#define CASE(Name, arg_count) \
+ case Bytecode::k##Name: \
+ return arg_count;
+ BYTECODE_LIST(CASE)
+#undef CASE
+ }
+ UNREACHABLE();
+ return 0;
+}
+
+
+// static
+const int Bytecodes::Size(Bytecode bytecode) {
+ return NumberOfArguments(bytecode) + 1;
+}
+
+
+std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode) {
+ return os << Bytecodes::ToString(bytecode);
+}
+
+} // namespace interpreter
+} // namespace internal
+} // namespace v8
« no previous file with comments | « src/interpreter/bytecodes.h ('k') | src/interpreter/interpreter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698