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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "src/ast.h" | 10 #include "src/ast.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 // Set number of contexts required for bytecode array. | 39 // Set number of contexts required for bytecode array. |
40 void set_context_count(int number_of_contexts); | 40 void set_context_count(int number_of_contexts); |
41 int context_count() const; | 41 int context_count() const; |
42 | 42 |
43 Register first_context_register() const; | 43 Register first_context_register() const; |
44 Register last_context_register() const; | 44 Register last_context_register() const; |
45 | 45 |
46 Register Parameter(int parameter_index) const; | 46 Register Parameter(int parameter_index) const; |
47 | 47 |
48 // Constant loads to accumulator. | 48 // Constant loads to the accumulator. |
49 BytecodeArrayBuilder& LoadLiteral(v8::internal::Smi* value); | 49 BytecodeArrayBuilder& LoadLiteral(v8::internal::Smi* value); |
50 BytecodeArrayBuilder& LoadLiteral(Handle<Object> object); | 50 BytecodeArrayBuilder& LoadLiteral(Handle<Object> object); |
51 BytecodeArrayBuilder& LoadUndefined(); | 51 BytecodeArrayBuilder& LoadUndefined(); |
52 BytecodeArrayBuilder& LoadNull(); | 52 BytecodeArrayBuilder& LoadNull(); |
53 BytecodeArrayBuilder& LoadTheHole(); | 53 BytecodeArrayBuilder& LoadTheHole(); |
54 BytecodeArrayBuilder& LoadTrue(); | 54 BytecodeArrayBuilder& LoadTrue(); |
55 BytecodeArrayBuilder& LoadFalse(); | 55 BytecodeArrayBuilder& LoadFalse(); |
56 | 56 |
57 // Global loads to accumulator and stores from accumulator. | 57 // Global loads to accumulator and stores from the accumulator. |
58 BytecodeArrayBuilder& LoadGlobal(int slot_index); | 58 BytecodeArrayBuilder& LoadGlobal(int slot_index); |
59 BytecodeArrayBuilder& StoreGlobal(int slot_index, LanguageMode language_mode); | 59 BytecodeArrayBuilder& StoreGlobal(int slot_index, LanguageMode language_mode); |
60 | 60 |
61 // Load the object at |slot_index| in |context| into the accumulator. | 61 // Load the object at |slot_index| in |context| into the accumulator. |
62 BytecodeArrayBuilder& LoadContextSlot(Register context, int slot_index); | 62 BytecodeArrayBuilder& LoadContextSlot(Register context, int slot_index); |
63 | 63 |
64 // Register-accumulator transfers. | 64 // Register-accumulator transfers. |
65 BytecodeArrayBuilder& LoadAccumulatorWithRegister(Register reg); | 65 BytecodeArrayBuilder& LoadAccumulatorWithRegister(Register reg); |
66 BytecodeArrayBuilder& StoreAccumulatorInRegister(Register reg); | 66 BytecodeArrayBuilder& StoreAccumulatorInRegister(Register reg); |
67 | 67 |
68 // Load properties. The property name should be in the accumulator. | 68 // Load properties. The property name should be in the accumulator. |
69 BytecodeArrayBuilder& LoadNamedProperty(Register object, int feedback_slot, | 69 BytecodeArrayBuilder& LoadNamedProperty(Register object, int feedback_slot, |
70 LanguageMode language_mode); | 70 LanguageMode language_mode); |
71 BytecodeArrayBuilder& LoadKeyedProperty(Register object, int feedback_slot, | 71 BytecodeArrayBuilder& LoadKeyedProperty(Register object, int feedback_slot, |
72 LanguageMode language_mode); | 72 LanguageMode language_mode); |
73 | 73 |
74 // Store properties. The value to be stored should be in the accumulator. | 74 // Store properties. The value to be stored should be in the accumulator. |
75 BytecodeArrayBuilder& StoreNamedProperty(Register object, Register name, | 75 BytecodeArrayBuilder& StoreNamedProperty(Register object, Register name, |
76 int feedback_slot, | 76 int feedback_slot, |
77 LanguageMode language_mode); | 77 LanguageMode language_mode); |
78 BytecodeArrayBuilder& StoreKeyedProperty(Register object, Register key, | 78 BytecodeArrayBuilder& StoreKeyedProperty(Register object, Register key, |
79 int feedback_slot, | 79 int feedback_slot, |
80 LanguageMode language_mode); | 80 LanguageMode language_mode); |
| 81 BytecodeArrayBuilder& GenericStoreKeyedProperty(Register object, |
| 82 Register key); |
81 | 83 |
82 // Push the context in accumulator as the new context, and store in register | 84 // Push the context in accumulator as the new context, and store in register |
83 // |context|. | 85 // |context|. |
84 BytecodeArrayBuilder& PushContext(Register context); | 86 BytecodeArrayBuilder& PushContext(Register context); |
85 // Pop the current context and replace with |context| | 87 // Pop the current context and replace with |context| |
86 BytecodeArrayBuilder& PopContext(Register context); | 88 BytecodeArrayBuilder& PopContext(Register context); |
87 | 89 |
| 90 // Literals creation. Constant elements should be in the accumulator. |
| 91 BytecodeArrayBuilder& CreateArrayLiteral(int literal_index, int flags); |
88 | 92 |
89 // Call a JS function. The JSFunction or Callable to be called should be in | 93 // Call a JS function. The JSFunction or Callable to be called should be in |
90 // |callable|, the receiver should be in |receiver| and all subsequent | 94 // |callable|, the receiver should be in |receiver| and all subsequent |
91 // arguments should be in registers <receiver + 1> to | 95 // arguments should be in registers <receiver + 1> to |
92 // <receiver + 1 + arg_count>. | 96 // <receiver + 1 + arg_count>. |
93 BytecodeArrayBuilder& Call(Register callable, Register receiver, | 97 BytecodeArrayBuilder& Call(Register callable, Register receiver, |
94 size_t arg_count); | 98 size_t arg_count); |
95 | 99 |
96 // Call the runtime function with |function_id|. The first argument should be | 100 // Call the runtime function with |function_id|. The first argument should be |
97 // in |first_arg| and all subsequent arguments should be in registers | 101 // in |first_arg| and all subsequent arguments should be in registers |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 255 |
252 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); | 256 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); |
253 }; | 257 }; |
254 | 258 |
255 | 259 |
256 } // namespace interpreter | 260 } // namespace interpreter |
257 } // namespace internal | 261 } // namespace internal |
258 } // namespace v8 | 262 } // namespace v8 |
259 | 263 |
260 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 264 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
OLD | NEW |