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

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

Issue 1319833004: [Interpreter] Add support for property store operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_implicit_ret
Patch Set: Created 5 years, 3 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(Imm8) \ 21 V(Imm8) \
22 V(Idx) \ 22 V(Idx) \
23 V(Reg) 23 V(Reg)
24 24
25 // The list of bytecodes which are interpreted by the interpreter. 25 // The list of bytecodes which are interpreted by the interpreter.
26 #define BYTECODE_LIST(V) \ 26 #define BYTECODE_LIST(V) \
27 \ 27 \
28 /* Loading the accumulator */ \ 28 /* Loading the accumulator */ \
29 V(LdaZero, OperandType::kNone) \ 29 V(LdaZero, OperandType::kNone) \
30 V(LdaSmi8, OperandType::kImm8) \ 30 V(LdaSmi8, OperandType::kImm8) \
31 V(LdaConstant, OperandType::kIdx) \ 31 V(LdaConstant, OperandType::kIdx) \
32 V(LdaUndefined, OperandType::kNone) \ 32 V(LdaUndefined, OperandType::kNone) \
33 V(LdaNull, OperandType::kNone) \ 33 V(LdaNull, OperandType::kNone) \
34 V(LdaTheHole, OperandType::kNone) \ 34 V(LdaTheHole, OperandType::kNone) \
35 V(LdaTrue, OperandType::kNone) \ 35 V(LdaTrue, OperandType::kNone) \
36 V(LdaFalse, OperandType::kNone) \ 36 V(LdaFalse, OperandType::kNone) \
37 \ 37 \
38 /* Register-accumulator transfers */ \ 38 /* Register-accumulator transfers */ \
39 V(Ldar, OperandType::kReg) \ 39 V(Ldar, OperandType::kReg) \
40 V(Star, OperandType::kReg) \ 40 V(Star, OperandType::kReg) \
41 \ 41 \
42 /* LoadIC operations */ \ 42 /* LoadIC operations */ \
43 V(LoadIC, OperandType::kReg, OperandType::kIdx) \ 43 V(LoadIC, OperandType::kReg, OperandType::kIdx) \
44 V(KeyedLoadIC, OperandType::kReg, OperandType::kIdx) \ 44 V(KeyedLoadIC, OperandType::kReg, OperandType::kIdx) \
45 \ 45 \
46 /* Binary Operators */ \ 46 /* StoreIC operations */ \
47 V(Add, OperandType::kReg) \ 47 V(StoreIC, OperandType::kReg, OperandType::kReg, OperandType::kIdx) \
48 V(Sub, OperandType::kReg) \ 48 V(KeyedStoreIC, OperandType::kReg, OperandType::kReg, OperandType::kIdx) \
49 V(Mul, OperandType::kReg) \ 49 \
50 V(Div, OperandType::kReg) \ 50 /* Binary Operators */ \
51 V(Mod, OperandType::kReg) \ 51 V(Add, OperandType::kReg) \
52 \ 52 V(Sub, OperandType::kReg) \
53 /* Control Flow */ \ 53 V(Mul, OperandType::kReg) \
54 V(Div, OperandType::kReg) \
55 V(Mod, OperandType::kReg) \
56 \
57 /* Control Flow */ \
54 V(Return, OperandType::kNone) 58 V(Return, OperandType::kNone)
55 59
56 60
57 // Enumeration of operand types used by bytecodes. 61 // Enumeration of operand types used by bytecodes.
58 enum class OperandType : uint8_t { 62 enum class OperandType : uint8_t {
59 #define DECLARE_OPERAND_TYPE(Name) k##Name, 63 #define DECLARE_OPERAND_TYPE(Name) k##Name,
60 OPERAND_TYPE_LIST(DECLARE_OPERAND_TYPE) 64 OPERAND_TYPE_LIST(DECLARE_OPERAND_TYPE)
61 #undef DECLARE_OPERAND_TYPE 65 #undef DECLARE_OPERAND_TYPE
62 #define COUNT_OPERAND_TYPES(x) +1 66 #define COUNT_OPERAND_TYPES(x) +1
63 // The COUNT_OPERAND macro will turn this into kLast = -1 +1 +1... which will 67 // The COUNT_OPERAND macro will turn this into kLast = -1 +1 +1... which will
(...skipping 16 matching lines...) Expand all
80 }; 84 };
81 85
82 86
83 // An interpreter register which is located in the function's register file 87 // An interpreter register which is located in the function's register file
84 // in its stack-frame. Register hold parameters, this, and expression values. 88 // in its stack-frame. Register hold parameters, this, and expression values.
85 class Register { 89 class Register {
86 public: 90 public:
87 static const int kMaxRegisterIndex = 127; 91 static const int kMaxRegisterIndex = 127;
88 static const int kMinRegisterIndex = -128; 92 static const int kMinRegisterIndex = -128;
89 93
94 Register() : index_(kIllegalIndex) {}
95
90 explicit Register(int index) : index_(index) { 96 explicit Register(int index) : index_(index) {
91 DCHECK_LE(index_, kMaxRegisterIndex); 97 DCHECK_LE(index_, kMaxRegisterIndex);
92 DCHECK_GE(index_, kMinRegisterIndex); 98 DCHECK_GE(index_, kMinRegisterIndex);
93 } 99 }
94 100
95 int index() const { return index_; } 101 int index() const { return index_; }
oth 2015/09/09 14:37:29 Could fail fast here - DCHECK(is_valid(index())).
rmcilroy 2015/09/09 15:18:57 Done.
96 bool is_parameter() const { return index_ < 0; } 102 bool is_parameter() const { return index_ < 0; }
97 103
98 static Register FromParameterIndex(int index, int parameter_count); 104 static Register FromParameterIndex(int index, int parameter_count);
99 int ToParameterIndex(int parameter_count) const; 105 int ToParameterIndex(int parameter_count) const;
100 static int MaxParameterIndex(); 106 static int MaxParameterIndex();
101 107
102 static Register FromOperand(uint8_t operand); 108 static Register FromOperand(uint8_t operand);
103 uint8_t ToOperand() const; 109 uint8_t ToOperand() const;
104 110
105 private: 111 private:
112 static const int kIllegalIndex = kMaxInt;
113
106 void* operator new(size_t size); 114 void* operator new(size_t size);
107 void operator delete(void* p); 115 void operator delete(void* p);
108 116
109 int index_; 117 int index_;
110 }; 118 };
111 119
112 120
113 class Bytecodes { 121 class Bytecodes {
114 public: 122 public:
115 // Returns string representation of |bytecode|. 123 // Returns string representation of |bytecode|.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 }; 156 };
149 157
150 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); 158 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode);
151 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); 159 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type);
152 160
153 } // namespace interpreter 161 } // namespace interpreter
154 } // namespace internal 162 } // namespace internal
155 } // namespace v8 163 } // namespace v8
156 164
157 #endif // V8_INTERPRETER_BYTECODES_H_ 165 #endif // V8_INTERPRETER_BYTECODES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698