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 // Create a new closure for the SharedFunctionInfo in the accumulator. | 84 // Create a new closure for the SharedFunctionInfo in the accumulator. |
83 BytecodeArrayBuilder& CreateClosure(PretenureFlag tenured); | 85 BytecodeArrayBuilder& CreateClosure(PretenureFlag tenured); |
84 | 86 |
| 87 // Literals creation. Constant elements should be in the accumulator. |
| 88 BytecodeArrayBuilder& CreateArrayLiteral(int literal_index, int flags); |
| 89 |
85 // Push the context in accumulator as the new context, and store in register | 90 // Push the context in accumulator as the new context, and store in register |
86 // |context|. | 91 // |context|. |
87 BytecodeArrayBuilder& PushContext(Register context); | 92 BytecodeArrayBuilder& PushContext(Register context); |
| 93 |
88 // Pop the current context and replace with |context|. | 94 // Pop the current context and replace with |context|. |
89 BytecodeArrayBuilder& PopContext(Register context); | 95 BytecodeArrayBuilder& PopContext(Register context); |
90 | 96 |
91 // Call a JS function. The JSFunction or Callable to be called should be in | 97 // Call a JS function. The JSFunction or Callable to be called should be in |
92 // |callable|, the receiver should be in |receiver| and all subsequent | 98 // |callable|, the receiver should be in |receiver| and all subsequent |
93 // arguments should be in registers <receiver + 1> to | 99 // arguments should be in registers <receiver + 1> to |
94 // <receiver + 1 + arg_count>. | 100 // <receiver + 1 + arg_count>. |
95 BytecodeArrayBuilder& Call(Register callable, Register receiver, | 101 BytecodeArrayBuilder& Call(Register callable, Register receiver, |
96 size_t arg_count); | 102 size_t arg_count); |
97 | 103 |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 259 |
254 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); | 260 DISALLOW_COPY_AND_ASSIGN(TemporaryRegisterScope); |
255 }; | 261 }; |
256 | 262 |
257 | 263 |
258 } // namespace interpreter | 264 } // namespace interpreter |
259 } // namespace internal | 265 } // namespace internal |
260 } // namespace v8 | 266 } // namespace v8 |
261 | 267 |
262 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ | 268 #endif // V8_INTERPRETER_BYTECODE_ARRAY_BUILDER_H_ |
OLD | NEW |