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

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: 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 unified diff | Download patch
« no previous file with comments | « src/interpreter/OWNERS ('k') | src/interpreter/bytecodes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Clients of this interface shouldn't depend on lots of interpreter internals.
11 // Do not include anything from src/interpreter here!
12 #include "src/utils.h"
13
14 namespace v8 {
15 namespace internal {
16 namespace interpreter {
17
18 // The list of bytecodes which are interpreted by the interpreter.
19 #define BYTECODE_LIST(V) \
20 V(LoadLiteral0, 1) \
21 V(Return, 0)
22
23 enum class Bytecode : uint8_t {
24 #define DECLARE_BYTECODE(Name, _) k##Name,
25 BYTECODE_LIST(DECLARE_BYTECODE)
26 #undef DECLARE_BYTECODE
27 #define COUNT_BYTECODE(x, _) +1
28 // The COUNT_BYTECODE macro will turn this into kLast = -1 +1 +1... which will
29 // evaluate to the same value as the last real bytecode.
30 kLast = -1 BYTECODE_LIST(COUNT_BYTECODE)
31 #undef COUNT_BYTECODE
32 };
33
34 class Bytecodes {
35 public:
36 // Returns string representation of |bytecode|.
37 static const char* ToString(Bytecode bytecode);
38
39 // Returns the number of arguments expected by |bytecode|.
40 static const int NumberOfArguments(Bytecode bytecode);
41
42 // Returns the size of the bytecode including its arguments.
43 static const int Size(Bytecode bytecode);
44
45 private:
46 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes);
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
« 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