OLD | NEW |
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_BYTECODE_ARRAY_BUILDER_H_ | 5 #ifndef V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 6 #define V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
7 | 7 |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/interpreter/bytecode-register-allocator.h" | 9 #include "src/interpreter/bytecode-register-allocator.h" |
10 #include "src/interpreter/bytecodes.h" | 10 #include "src/interpreter/bytecodes.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 BytecodeArrayBuilder& LoadLiteral(Handle<Object> object); | 86 BytecodeArrayBuilder& LoadLiteral(Handle<Object> object); |
87 BytecodeArrayBuilder& LoadUndefined(); | 87 BytecodeArrayBuilder& LoadUndefined(); |
88 BytecodeArrayBuilder& LoadNull(); | 88 BytecodeArrayBuilder& LoadNull(); |
89 BytecodeArrayBuilder& LoadTheHole(); | 89 BytecodeArrayBuilder& LoadTheHole(); |
90 BytecodeArrayBuilder& LoadTrue(); | 90 BytecodeArrayBuilder& LoadTrue(); |
91 BytecodeArrayBuilder& LoadFalse(); | 91 BytecodeArrayBuilder& LoadFalse(); |
92 BytecodeArrayBuilder& LoadBooleanConstant(bool value); | 92 BytecodeArrayBuilder& LoadBooleanConstant(bool value); |
93 | 93 |
94 // Global loads to the accumulator and stores from the accumulator. | 94 // Global loads to the accumulator and stores from the accumulator. |
95 BytecodeArrayBuilder& LoadGlobal(const Handle<String> name, int feedback_slot, | 95 BytecodeArrayBuilder& LoadGlobal(const Handle<String> name, int feedback_slot, |
96 LanguageMode language_mode, | |
97 TypeofMode typeof_mode); | 96 TypeofMode typeof_mode); |
98 BytecodeArrayBuilder& StoreGlobal(const Handle<String> name, | 97 BytecodeArrayBuilder& StoreGlobal(const Handle<String> name, |
99 int feedback_slot, | 98 int feedback_slot, |
100 LanguageMode language_mode); | 99 LanguageMode language_mode); |
101 | 100 |
102 // Load the object at |slot_index| in |context| into the accumulator. | 101 // Load the object at |slot_index| in |context| into the accumulator. |
103 BytecodeArrayBuilder& LoadContextSlot(Register context, int slot_index); | 102 BytecodeArrayBuilder& LoadContextSlot(Register context, int slot_index); |
104 | 103 |
105 // Stores the object in the accumulator into |slot_index| of |context|. | 104 // Stores the object in the accumulator into |slot_index| of |context|. |
106 BytecodeArrayBuilder& StoreContextSlot(Register context, int slot_index); | 105 BytecodeArrayBuilder& StoreContextSlot(Register context, int slot_index); |
107 | 106 |
108 // Register-accumulator transfers. | 107 // Register-accumulator transfers. |
109 BytecodeArrayBuilder& LoadAccumulatorWithRegister(Register reg); | 108 BytecodeArrayBuilder& LoadAccumulatorWithRegister(Register reg); |
110 BytecodeArrayBuilder& StoreAccumulatorInRegister(Register reg); | 109 BytecodeArrayBuilder& StoreAccumulatorInRegister(Register reg); |
111 | 110 |
112 // Register-register transfer. | 111 // Register-register transfer. |
113 BytecodeArrayBuilder& MoveRegister(Register from, Register to); | 112 BytecodeArrayBuilder& MoveRegister(Register from, Register to); |
114 | 113 |
115 // Named load property. | 114 // Named load property. |
116 BytecodeArrayBuilder& LoadNamedProperty(Register object, | 115 BytecodeArrayBuilder& LoadNamedProperty(Register object, |
117 const Handle<Name> name, | 116 const Handle<Name> name, |
118 int feedback_slot, | 117 int feedback_slot); |
119 LanguageMode language_mode); | |
120 // Keyed load property. The key should be in the accumulator. | 118 // Keyed load property. The key should be in the accumulator. |
121 BytecodeArrayBuilder& LoadKeyedProperty(Register object, int feedback_slot, | 119 BytecodeArrayBuilder& LoadKeyedProperty(Register object, int feedback_slot); |
122 LanguageMode language_mode); | |
123 | 120 |
124 // Store properties. The value to be stored should be in the accumulator. | 121 // Store properties. The value to be stored should be in the accumulator. |
125 BytecodeArrayBuilder& StoreNamedProperty(Register object, | 122 BytecodeArrayBuilder& StoreNamedProperty(Register object, |
126 const Handle<Name> name, | 123 const Handle<Name> name, |
127 int feedback_slot, | 124 int feedback_slot, |
128 LanguageMode language_mode); | 125 LanguageMode language_mode); |
129 BytecodeArrayBuilder& StoreKeyedProperty(Register object, Register key, | 126 BytecodeArrayBuilder& StoreKeyedProperty(Register object, Register key, |
130 int feedback_slot, | 127 int feedback_slot, |
131 LanguageMode language_mode); | 128 LanguageMode language_mode); |
132 | 129 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 void EnsureReturn(FunctionLiteral* literal); | 266 void EnsureReturn(FunctionLiteral* literal); |
270 | 267 |
271 private: | 268 private: |
272 class PreviousBytecodeHelper; | 269 class PreviousBytecodeHelper; |
273 friend class BytecodeRegisterAllocator; | 270 friend class BytecodeRegisterAllocator; |
274 | 271 |
275 static Bytecode BytecodeForBinaryOperation(Token::Value op); | 272 static Bytecode BytecodeForBinaryOperation(Token::Value op); |
276 static Bytecode BytecodeForCountOperation(Token::Value op); | 273 static Bytecode BytecodeForCountOperation(Token::Value op); |
277 static Bytecode BytecodeForCompareOperation(Token::Value op); | 274 static Bytecode BytecodeForCompareOperation(Token::Value op); |
278 static Bytecode BytecodeForWideOperands(Bytecode bytecode); | 275 static Bytecode BytecodeForWideOperands(Bytecode bytecode); |
279 static Bytecode BytecodeForLoadIC(LanguageMode language_mode); | |
280 static Bytecode BytecodeForKeyedLoadIC(LanguageMode language_mode); | |
281 static Bytecode BytecodeForStoreIC(LanguageMode language_mode); | 276 static Bytecode BytecodeForStoreIC(LanguageMode language_mode); |
282 static Bytecode BytecodeForKeyedStoreIC(LanguageMode language_mode); | 277 static Bytecode BytecodeForKeyedStoreIC(LanguageMode language_mode); |
283 static Bytecode BytecodeForLoadGlobal(LanguageMode language_mode, | 278 static Bytecode BytecodeForLoadGlobal(TypeofMode typeof_mode); |
284 TypeofMode typeof_mode); | |
285 static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode); | 279 static Bytecode BytecodeForStoreGlobal(LanguageMode language_mode); |
286 static Bytecode BytecodeForStoreLookupSlot(LanguageMode language_mode); | 280 static Bytecode BytecodeForStoreLookupSlot(LanguageMode language_mode); |
287 static Bytecode BytecodeForCreateArguments(CreateArgumentsType type); | 281 static Bytecode BytecodeForCreateArguments(CreateArgumentsType type); |
288 static Bytecode BytecodeForDelete(LanguageMode language_mode); | 282 static Bytecode BytecodeForDelete(LanguageMode language_mode); |
289 | 283 |
290 static bool FitsInIdx8Operand(int value); | 284 static bool FitsInIdx8Operand(int value); |
291 static bool FitsInIdx8Operand(size_t value); | 285 static bool FitsInIdx8Operand(size_t value); |
292 static bool FitsInImm8Operand(int value); | 286 static bool FitsInImm8Operand(int value); |
293 static bool FitsInIdx16Operand(int value); | 287 static bool FitsInIdx16Operand(int value); |
294 static bool FitsInIdx16Operand(size_t value); | 288 static bool FitsInIdx16Operand(size_t value); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 size_t offset_; | 406 size_t offset_; |
413 | 407 |
414 friend class BytecodeArrayBuilder; | 408 friend class BytecodeArrayBuilder; |
415 }; | 409 }; |
416 | 410 |
417 } // namespace interpreter | 411 } // namespace interpreter |
418 } // namespace internal | 412 } // namespace internal |
419 } // namespace v8 | 413 } // namespace v8 |
420 | 414 |
421 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 415 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
OLD | NEW |