OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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_CODE_STUB_ASSEMBLER_H_ | 5 #ifndef V8_CODE_STUB_ASSEMBLER_H_ |
6 #define V8_CODE_STUB_ASSEMBLER_H_ | 6 #define V8_CODE_STUB_ASSEMBLER_H_ |
7 | 7 |
8 #include "src/compiler/code-assembler.h" | 8 #include "src/compiler/code-assembler.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 // TODO(rmcilroy): move result_size to the CallInterfaceDescriptor. | 25 // TODO(rmcilroy): move result_size to the CallInterfaceDescriptor. |
26 CodeStubAssembler(Isolate* isolate, Zone* zone, | 26 CodeStubAssembler(Isolate* isolate, Zone* zone, |
27 const CallInterfaceDescriptor& descriptor, | 27 const CallInterfaceDescriptor& descriptor, |
28 Code::Flags flags, const char* name, | 28 Code::Flags flags, const char* name, |
29 size_t result_size = 1); | 29 size_t result_size = 1); |
30 | 30 |
31 // Create with JSCall linkage. | 31 // Create with JSCall linkage. |
32 CodeStubAssembler(Isolate* isolate, Zone* zone, int parameter_count, | 32 CodeStubAssembler(Isolate* isolate, Zone* zone, int parameter_count, |
33 Code::Flags flags, const char* name); | 33 Code::Flags flags, const char* name); |
34 | 34 |
| 35 enum ParameterMode { INTEGER_PARAMETERS, SMI_PARAMETERS }; |
| 36 |
35 compiler::Node* BooleanMapConstant(); | 37 compiler::Node* BooleanMapConstant(); |
36 compiler::Node* EmptyStringConstant(); | 38 compiler::Node* EmptyStringConstant(); |
37 compiler::Node* HeapNumberMapConstant(); | 39 compiler::Node* HeapNumberMapConstant(); |
38 compiler::Node* NoContextConstant(); | 40 compiler::Node* NoContextConstant(); |
39 compiler::Node* NullConstant(); | 41 compiler::Node* NullConstant(); |
40 compiler::Node* UndefinedConstant(); | 42 compiler::Node* UndefinedConstant(); |
41 compiler::Node* StaleRegisterConstant(); | 43 compiler::Node* StaleRegisterConstant(); |
42 | 44 |
43 // Float64 operations. | 45 // Float64 operations. |
44 compiler::Node* Float64Ceil(compiler::Node* x); | 46 compiler::Node* Float64Ceil(compiler::Node* x); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 compiler::Node* LoadMapPrototype(compiler::Node* map); | 129 compiler::Node* LoadMapPrototype(compiler::Node* map); |
128 | 130 |
129 // Load the hash field of a name. | 131 // Load the hash field of a name. |
130 compiler::Node* LoadNameHash(compiler::Node* name); | 132 compiler::Node* LoadNameHash(compiler::Node* name); |
131 // Load the instance size of a Map. | 133 // Load the instance size of a Map. |
132 compiler::Node* LoadMapInstanceSize(compiler::Node* map); | 134 compiler::Node* LoadMapInstanceSize(compiler::Node* map); |
133 | 135 |
134 compiler::Node* AllocateUninitializedFixedArray(compiler::Node* length); | 136 compiler::Node* AllocateUninitializedFixedArray(compiler::Node* length); |
135 | 137 |
136 // Load an array element from a FixedArray. | 138 // Load an array element from a FixedArray. |
137 compiler::Node* LoadFixedArrayElementInt32Index(compiler::Node* object, | 139 compiler::Node* LoadFixedArrayElement( |
138 compiler::Node* int32_index, | 140 compiler::Node* object, compiler::Node* int32_index, |
139 int additional_offset = 0); | 141 int additional_offset = 0, |
140 compiler::Node* LoadFixedArrayElementSmiIndex(compiler::Node* object, | 142 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
141 compiler::Node* smi_index, | |
142 int additional_offset = 0); | |
143 compiler::Node* LoadFixedArrayElementConstantIndex(compiler::Node* object, | |
144 int index); | |
145 | 143 |
146 // Context manipulation | 144 // Context manipulation |
147 compiler::Node* LoadNativeContext(compiler::Node* context); | 145 compiler::Node* LoadNativeContext(compiler::Node* context); |
148 | 146 |
149 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind, | 147 compiler::Node* LoadJSArrayElementsMap(ElementsKind kind, |
150 compiler::Node* native_context); | 148 compiler::Node* native_context); |
151 | 149 |
152 // Store the floating point value of a HeapNumber. | 150 // Store the floating point value of a HeapNumber. |
153 compiler::Node* StoreHeapNumberValue(compiler::Node* object, | 151 compiler::Node* StoreHeapNumberValue(compiler::Node* object, |
154 compiler::Node* value); | 152 compiler::Node* value); |
155 // Store a field to an object on the heap. | 153 // Store a field to an object on the heap. |
156 compiler::Node* StoreObjectField( | 154 compiler::Node* StoreObjectField( |
157 compiler::Node* object, int offset, compiler::Node* value); | 155 compiler::Node* object, int offset, compiler::Node* value); |
158 compiler::Node* StoreObjectFieldNoWriteBarrier( | 156 compiler::Node* StoreObjectFieldNoWriteBarrier( |
159 compiler::Node* object, int offset, compiler::Node* value, | 157 compiler::Node* object, int offset, compiler::Node* value, |
160 MachineRepresentation rep = MachineRepresentation::kTagged); | 158 MachineRepresentation rep = MachineRepresentation::kTagged); |
161 // Store the Map of an HeapObject. | 159 // Store the Map of an HeapObject. |
162 compiler::Node* StoreMapNoWriteBarrier(compiler::Node* object, | 160 compiler::Node* StoreMapNoWriteBarrier(compiler::Node* object, |
163 compiler::Node* map); | 161 compiler::Node* map); |
164 // Store an array element to a FixedArray. | 162 // Store an array element to a FixedArray. |
165 compiler::Node* StoreFixedArrayElementInt32Index(compiler::Node* object, | 163 compiler::Node* StoreFixedArrayElement( |
166 compiler::Node* index, | 164 compiler::Node* object, compiler::Node* index, compiler::Node* value, |
167 compiler::Node* value); | 165 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, |
168 compiler::Node* StoreFixedArrayElementNoWriteBarrier(compiler::Node* object, | 166 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
169 compiler::Node* index, | 167 |
170 compiler::Node* value); | 168 compiler::Node* StoreFixedDoubleArrayElement( |
171 compiler::Node* StoreFixedDoubleArrayElementInt32Index(compiler::Node* object, | 169 compiler::Node* object, compiler::Node* index, compiler::Node* value, |
172 compiler::Node* index, | 170 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
173 compiler::Node* value); | |
174 compiler::Node* StoreFixedArrayElementInt32Index(compiler::Node* object, | |
175 int index, | |
176 compiler::Node* value); | |
177 compiler::Node* StoreFixedArrayElementNoWriteBarrier(compiler::Node* object, | |
178 int index, | |
179 compiler::Node* value); | |
180 compiler::Node* StoreFixedDoubleArrayElementInt32Index(compiler::Node* object, | |
181 int index, | |
182 compiler::Node* value); | |
183 | 171 |
184 // Allocate a HeapNumber without initializing its value. | 172 // Allocate a HeapNumber without initializing its value. |
185 compiler::Node* AllocateHeapNumber(); | 173 compiler::Node* AllocateHeapNumber(); |
186 // Allocate a HeapNumber with a specific value. | 174 // Allocate a HeapNumber with a specific value. |
187 compiler::Node* AllocateHeapNumberWithValue(compiler::Node* value); | 175 compiler::Node* AllocateHeapNumberWithValue(compiler::Node* value); |
188 // Allocate a SeqOneByteString with the given length. | 176 // Allocate a SeqOneByteString with the given length. |
189 compiler::Node* AllocateSeqOneByteString(int length); | 177 compiler::Node* AllocateSeqOneByteString(int length); |
190 // Allocate a SeqTwoByteString with the given length. | 178 // Allocate a SeqTwoByteString with the given length. |
191 compiler::Node* AllocateSeqTwoByteString(int length); | 179 compiler::Node* AllocateSeqTwoByteString(int length); |
192 // Allocated an JSArray | 180 // Allocated an JSArray |
193 compiler::Node* AllocateJSArray(ElementsKind kind, compiler::Node* array_map, | 181 compiler::Node* AllocateJSArray(ElementsKind kind, compiler::Node* array_map, |
194 int capacity, int length, | 182 compiler::Node* capacity, |
195 compiler::Node* allocation_site = nullptr); | 183 compiler::Node* length, |
| 184 compiler::Node* allocation_site = nullptr, |
| 185 ParameterMode mode = INTEGER_PARAMETERS); |
196 | 186 |
197 // Allocation site manipulation | 187 // Allocation site manipulation |
198 void InitializeAllocationMemento(compiler::Node* base_allocation, | 188 void InitializeAllocationMemento(compiler::Node* base_allocation, |
199 int base_allocation_size, | 189 int base_allocation_size, |
200 compiler::Node* allocation_site); | 190 compiler::Node* allocation_site); |
201 | 191 |
202 compiler::Node* TruncateTaggedToFloat64(compiler::Node* context, | 192 compiler::Node* TruncateTaggedToFloat64(compiler::Node* context, |
203 compiler::Node* value); | 193 compiler::Node* value); |
204 compiler::Node* TruncateTaggedToWord32(compiler::Node* context, | 194 compiler::Node* TruncateTaggedToWord32(compiler::Node* context, |
205 compiler::Node* value); | 195 compiler::Node* value); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 Label* if_found, Label* if_not_found, | 237 Label* if_found, Label* if_not_found, |
248 Label* call_runtime); | 238 Label* call_runtime); |
249 | 239 |
250 // Instanceof helpers. | 240 // Instanceof helpers. |
251 // ES6 section 7.3.19 OrdinaryHasInstance (C, O) | 241 // ES6 section 7.3.19 OrdinaryHasInstance (C, O) |
252 compiler::Node* OrdinaryHasInstance(compiler::Node* context, | 242 compiler::Node* OrdinaryHasInstance(compiler::Node* context, |
253 compiler::Node* callable, | 243 compiler::Node* callable, |
254 compiler::Node* object); | 244 compiler::Node* object); |
255 | 245 |
256 private: | 246 private: |
| 247 compiler::Node* ElementOffsetFromIndex(compiler::Node* index, |
| 248 ElementsKind kind, ParameterMode mode, |
| 249 int base_size = 0); |
| 250 |
257 compiler::Node* AllocateRawAligned(compiler::Node* size_in_bytes, | 251 compiler::Node* AllocateRawAligned(compiler::Node* size_in_bytes, |
258 AllocationFlags flags, | 252 AllocationFlags flags, |
259 compiler::Node* top_address, | 253 compiler::Node* top_address, |
260 compiler::Node* limit_address); | 254 compiler::Node* limit_address); |
261 compiler::Node* AllocateRawUnaligned(compiler::Node* size_in_bytes, | 255 compiler::Node* AllocateRawUnaligned(compiler::Node* size_in_bytes, |
262 AllocationFlags flags, | 256 AllocationFlags flags, |
263 compiler::Node* top_adddress, | 257 compiler::Node* top_adddress, |
264 compiler::Node* limit_address); | 258 compiler::Node* limit_address); |
265 | 259 |
266 static const int kElementLoopUnrollThreshold = 8; | 260 static const int kElementLoopUnrollThreshold = 8; |
267 }; | 261 }; |
268 | 262 |
269 } // namespace internal | 263 } // namespace internal |
270 } // namespace v8 | 264 } // namespace v8 |
271 | 265 |
272 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 266 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |