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

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

Issue 1378523005: [Interpreter] Add support for global declarations and load/store of global variables (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_toplevel
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.
(...skipping 25 matching lines...) Expand all
36 /* Loading the accumulator */ \ 36 /* Loading the accumulator */ \
37 V(LdaZero, OperandType::kNone) \ 37 V(LdaZero, OperandType::kNone) \
38 V(LdaSmi8, OperandType::kImm8) \ 38 V(LdaSmi8, OperandType::kImm8) \
39 V(LdaConstant, OperandType::kIdx) \ 39 V(LdaConstant, OperandType::kIdx) \
40 V(LdaUndefined, OperandType::kNone) \ 40 V(LdaUndefined, OperandType::kNone) \
41 V(LdaNull, OperandType::kNone) \ 41 V(LdaNull, OperandType::kNone) \
42 V(LdaTheHole, OperandType::kNone) \ 42 V(LdaTheHole, OperandType::kNone) \
43 V(LdaTrue, OperandType::kNone) \ 43 V(LdaTrue, OperandType::kNone) \
44 V(LdaFalse, OperandType::kNone) \ 44 V(LdaFalse, OperandType::kNone) \
45 \ 45 \
46 /* Load globals */ \ 46 /* Globals */ \
47 V(LdaGlobal, OperandType::kIdx) \ 47 V(LdaGlobal, OperandType::kIdx) \
48 V(StaGlobal, OperandType::kIdx) \
49 \
50 /* Context operations */ \
51 V(LdaContextSlot, OperandType::kReg, OperandType::kIdx) \
48 \ 52 \
49 /* Register-accumulator transfers */ \ 53 /* Register-accumulator transfers */ \
50 V(Ldar, OperandType::kReg) \ 54 V(Ldar, OperandType::kReg) \
51 V(Star, OperandType::kReg) \ 55 V(Star, OperandType::kReg) \
52 \ 56 \
53 /* LoadIC operations */ \ 57 /* LoadIC operations */ \
54 V(LoadIC, OperandType::kReg, OperandType::kIdx) \ 58 V(LoadIC, OperandType::kReg, OperandType::kIdx) \
55 V(KeyedLoadIC, OperandType::kReg, OperandType::kIdx) \ 59 V(KeyedLoadIC, OperandType::kReg, OperandType::kIdx) \
56 \ 60 \
57 /* StoreIC operations */ \ 61 /* StoreIC operations */ \
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 int index() const { 150 int index() const {
147 DCHECK(index_ != kIllegalIndex); 151 DCHECK(index_ != kIllegalIndex);
148 return index_; 152 return index_;
149 } 153 }
150 bool is_parameter() const { return index() < 0; } 154 bool is_parameter() const { return index() < 0; }
151 155
152 static Register FromParameterIndex(int index, int parameter_count); 156 static Register FromParameterIndex(int index, int parameter_count);
153 int ToParameterIndex(int parameter_count) const; 157 int ToParameterIndex(int parameter_count) const;
154 static int MaxParameterIndex(); 158 static int MaxParameterIndex();
155 159
160 // Returns the register for the function's outer context.
161 static Register function_context();
162 bool is_function_context() const;
163
156 static Register FromOperand(uint8_t operand); 164 static Register FromOperand(uint8_t operand);
157 uint8_t ToOperand() const; 165 uint8_t ToOperand() const;
158 166
159 private: 167 private:
160 static const int kIllegalIndex = kMaxInt; 168 static const int kIllegalIndex = kMaxInt;
161 169
162 void* operator new(size_t size); 170 void* operator new(size_t size);
163 void operator delete(void* p); 171 void operator delete(void* p);
164 172
165 int index_; 173 int index_;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 }; 219 };
212 220
213 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); 221 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode);
214 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); 222 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type);
215 223
216 } // namespace interpreter 224 } // namespace interpreter
217 } // namespace internal 225 } // namespace internal
218 } // namespace v8 226 } // namespace v8
219 227
220 #endif // V8_INTERPRETER_BYTECODES_H_ 228 #endif // V8_INTERPRETER_BYTECODES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698