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

Side by Side Diff: src/interpreter/bytecodes.h

Issue 1362383002: [Interpreter] Add CallRuntime support to the interpreter. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
1 // Copyright 2015 the V8 project authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_INTERPRETER_BYTECODES_H_ 5 #ifndef V8_INTERPRETER_BYTECODES_H_
6 #define V8_INTERPRETER_BYTECODES_H_ 6 #define V8_INTERPRETER_BYTECODES_H_
7 7
8 #include <iosfwd> 8 #include <iosfwd>
9 9
10 // Clients of this interface shouldn't depend on lots of interpreter internals. 10 // Clients of this interface shouldn't depend on lots of interpreter internals.
11 // Do not include anything from src/interpreter here! 11 // Do not include anything from src/interpreter here!
12 #include "src/utils.h" 12 #include "src/utils.h"
13 13
14 namespace v8 { 14 namespace v8 {
15 namespace internal { 15 namespace internal {
16 namespace interpreter { 16 namespace interpreter {
17 17
18 // The list of operand types used by bytecodes. 18 // The list of operand types used by bytecodes.
19 #define OPERAND_TYPE_LIST(V) \ 19 #define OPERAND_TYPE_LIST(V) \
20 V(None) \ 20 V(None) \
21 V(Count) \ 21 V(Count) \
22 V(Imm8) \ 22 V(Imm8) \
23 V(Idx) \ 23 V(Idx) \
24 V(Reg) 24 V(Reg)
25 25
26 // The list of bytecodes which are interpreted by the interpreter. 26 // The list of bytecodes which are interpreted by the interpreter.
27 #define BYTECODE_LIST(V) \ 27 #define BYTECODE_LIST(V) \
28 \ 28 \
29 /* Loading the accumulator */ \ 29 /* Loading the accumulator */ \
30 V(LdaZero, OperandType::kNone) \ 30 V(LdaZero, OperandType::kNone) \
31 V(LdaSmi8, OperandType::kImm8) \ 31 V(LdaSmi8, OperandType::kImm8) \
32 V(LdaConstant, OperandType::kIdx) \ 32 V(LdaConstant, OperandType::kIdx) \
33 V(LdaUndefined, OperandType::kNone) \ 33 V(LdaUndefined, OperandType::kNone) \
34 V(LdaNull, OperandType::kNone) \ 34 V(LdaNull, OperandType::kNone) \
35 V(LdaTheHole, OperandType::kNone) \ 35 V(LdaTheHole, OperandType::kNone) \
36 V(LdaTrue, OperandType::kNone) \ 36 V(LdaTrue, OperandType::kNone) \
37 V(LdaFalse, OperandType::kNone) \ 37 V(LdaFalse, OperandType::kNone) \
38 \ 38 \
39 /* Load globals */ \ 39 /* Load globals */ \
40 V(LdaGlobal, OperandType::kIdx) \ 40 V(LdaGlobal, OperandType::kIdx) \
41 \ 41 \
42 /* Register-accumulator transfers */ \ 42 /* Register-accumulator transfers */ \
43 V(Ldar, OperandType::kReg) \ 43 V(Ldar, OperandType::kReg) \
44 V(Star, OperandType::kReg) \ 44 V(Star, OperandType::kReg) \
45 \ 45 \
46 /* LoadIC operations */ \ 46 /* LoadIC operations */ \
47 V(LoadIC, OperandType::kReg, OperandType::kIdx) \ 47 V(LoadIC, OperandType::kReg, OperandType::kIdx) \
48 V(KeyedLoadIC, OperandType::kReg, OperandType::kIdx) \ 48 V(KeyedLoadIC, OperandType::kReg, OperandType::kIdx) \
49 \ 49 \
50 /* StoreIC operations */ \ 50 /* StoreIC operations */ \
51 V(StoreIC, OperandType::kReg, OperandType::kReg, OperandType::kIdx) \ 51 V(StoreIC, OperandType::kReg, OperandType::kReg, OperandType::kIdx) \
52 V(KeyedStoreIC, OperandType::kReg, OperandType::kReg, OperandType::kIdx) \ 52 V(KeyedStoreIC, OperandType::kReg, OperandType::kReg, OperandType::kIdx) \
53 \ 53 \
54 /* Binary Operators */ \ 54 /* Binary Operators */ \
55 V(Add, OperandType::kReg) \ 55 V(Add, OperandType::kReg) \
56 V(Sub, OperandType::kReg) \ 56 V(Sub, OperandType::kReg) \
57 V(Mul, OperandType::kReg) \ 57 V(Mul, OperandType::kReg) \
58 V(Div, OperandType::kReg) \ 58 V(Div, OperandType::kReg) \
59 V(Mod, OperandType::kReg) \ 59 V(Mod, OperandType::kReg) \
60 \ 60 \
61 /* Call operations. */ \ 61 /* Call operations. */ \
62 V(Call, OperandType::kReg, OperandType::kReg, OperandType::kCount) \ 62 V(Call, OperandType::kReg, OperandType::kReg, OperandType::kCount) \
63 \ 63 V(CallRuntime, OperandType::kIdx, OperandType::kReg, OperandType::kCount) \
64 /* Test Operators */ \ 64 \
65 V(TestEqual, OperandType::kReg) \ 65 /* Test Operators */ \
66 V(TestNotEqual, OperandType::kReg) \ 66 V(TestEqual, OperandType::kReg) \
67 V(TestEqualStrict, OperandType::kReg) \ 67 V(TestNotEqual, OperandType::kReg) \
68 V(TestNotEqualStrict, OperandType::kReg) \ 68 V(TestEqualStrict, OperandType::kReg) \
69 V(TestLessThan, OperandType::kReg) \ 69 V(TestNotEqualStrict, OperandType::kReg) \
70 V(TestGreaterThan, OperandType::kReg) \ 70 V(TestLessThan, OperandType::kReg) \
71 V(TestLessThanEqual, OperandType::kReg) \ 71 V(TestGreaterThan, OperandType::kReg) \
72 V(TestGreaterThanEqual, OperandType::kReg) \ 72 V(TestLessThanEqual, OperandType::kReg) \
73 V(TestInstanceOf, OperandType::kReg) \ 73 V(TestGreaterThanEqual, OperandType::kReg) \
74 V(TestIn, OperandType::kReg) \ 74 V(TestInstanceOf, OperandType::kReg) \
75 \ 75 V(TestIn, OperandType::kReg) \
76 /* Cast operators */ \ 76 \
77 V(ToBoolean, OperandType::kNone) \ 77 /* Cast operators */ \
78 \ 78 V(ToBoolean, OperandType::kNone) \
79 /* Control Flow */ \ 79 \
80 V(Jump, OperandType::kImm8) \ 80 /* Control Flow */ \
81 V(JumpConstant, OperandType::kIdx) \ 81 V(Jump, OperandType::kImm8) \
82 V(JumpIfTrue, OperandType::kImm8) \ 82 V(JumpConstant, OperandType::kIdx) \
83 V(JumpIfTrueConstant, OperandType::kIdx) \ 83 V(JumpIfTrue, OperandType::kImm8) \
84 V(JumpIfFalse, OperandType::kImm8) \ 84 V(JumpIfTrueConstant, OperandType::kIdx) \
85 V(JumpIfFalseConstant, OperandType::kIdx) \ 85 V(JumpIfFalse, OperandType::kImm8) \
86 V(JumpIfFalseConstant, OperandType::kIdx) \
86 V(Return, OperandType::kNone) 87 V(Return, OperandType::kNone)
87 88
88 89
89 // Enumeration of operand types used by bytecodes. 90 // Enumeration of operand types used by bytecodes.
90 enum class OperandType : uint8_t { 91 enum class OperandType : uint8_t {
91 #define DECLARE_OPERAND_TYPE(Name) k##Name, 92 #define DECLARE_OPERAND_TYPE(Name) k##Name,
92 OPERAND_TYPE_LIST(DECLARE_OPERAND_TYPE) 93 OPERAND_TYPE_LIST(DECLARE_OPERAND_TYPE)
93 #undef DECLARE_OPERAND_TYPE 94 #undef DECLARE_OPERAND_TYPE
94 #define COUNT_OPERAND_TYPES(x) +1 95 #define COUNT_OPERAND_TYPES(x) +1
95 // The COUNT_OPERAND macro will turn this into kLast = -1 +1 +1... which will 96 // The COUNT_OPERAND macro will turn this into kLast = -1 +1 +1... which will
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 }; 188 };
188 189
189 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); 190 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode);
190 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); 191 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type);
191 192
192 } // namespace interpreter 193 } // namespace interpreter
193 } // namespace internal 194 } // namespace internal
194 } // namespace v8 195 } // namespace v8
195 196
196 #endif // V8_INTERPRETER_BYTECODES_H_ 197 #endif // V8_INTERPRETER_BYTECODES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698