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

Side by Side 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: 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef V8_INTERPRETER_BYTECODES_H_
6 #define V8_INTERPRETER_BYTECODES_H_
7
8 #include <iosfwd>
9
10 #include "src/utils.h"
11
12 namespace v8 {
13 namespace internal {
14 namespace interpreter {
15
16 // The list of bytecodes which are interpreted by the interpreter.
17 #define BYTECODE_LIST(V) \
18 V(LoadLiteral0, 1) \
19 V(Return, 0)
20
21 enum class Bytecode : uint8_t {
22 #define DECLARE_BYTECODE(Name, _) k##Name,
23 BYTECODE_LIST(DECLARE_BYTECODE)
24 #undef DECLARE_BYTECODE
25 kLast = -1
26 #define COUNT_BYTECODE(x, _) +1
27 BYTECODE_LIST(COUNT_BYTECODE)
28 #undef COUNT_BYTECODE
29 };
30
31 class Bytecodes {
32 public:
33 // Returns string representation of |bytecode|.
34 static const char* ToString(Bytecode bytecode);
35
36 // Returns the number of arguments expected by |bytecode|.
37 static const int NumberOfArguments(Bytecode bytecode);
38
39 // Returns the size of the bytecode including its arguments.
40 static const int Size(Bytecode bytecode);
41
42 // Returns true if the bytecode is a function return bytecode.
43 static const bool IsReturn(Bytecode bytecode);
44
45 private:
46 Bytecodes() { UNREACHABLE(); }
47 };
48
49
50 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode);
51
52 } // namespace interpreter
53 } // namespace internal
54 } // namespace v8
55
56 #endif // V8_INTERPRETER_BYTECODES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698