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 <functional> | 8 #include <functional> |
9 | 9 |
10 #include "src/compiler/code-assembler.h" | 10 #include "src/compiler/code-assembler.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 181 |
182 void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* lhs_map, | 182 void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* lhs_map, |
183 compiler::Node* rhs, compiler::Node* rhs_map, | 183 compiler::Node* rhs, compiler::Node* rhs_map, |
184 Label* if_equal, Label* if_notequal); | 184 Label* if_equal, Label* if_notequal); |
185 void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* rhs, | 185 void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* rhs, |
186 Label* if_equal, Label* if_notequal) { | 186 Label* if_equal, Label* if_notequal) { |
187 BranchIfSimd128Equal(lhs, LoadMap(lhs), rhs, LoadMap(rhs), if_equal, | 187 BranchIfSimd128Equal(lhs, LoadMap(lhs), rhs, LoadMap(rhs), if_equal, |
188 if_notequal); | 188 if_notequal); |
189 } | 189 } |
190 | 190 |
| 191 void BranchIfJSReceiver(compiler::Node* object, Label* if_true, |
| 192 Label* if_false); |
| 193 void BranchIfJSObject(compiler::Node* object, Label* if_true, |
| 194 Label* if_false); |
| 195 |
191 void BranchIfFastJSArray(compiler::Node* object, compiler::Node* context, | 196 void BranchIfFastJSArray(compiler::Node* object, compiler::Node* context, |
192 Label* if_true, Label* if_false); | 197 Label* if_true, Label* if_false); |
193 | 198 |
194 // Load value from current frame by given offset in bytes. | 199 // Load value from current frame by given offset in bytes. |
195 compiler::Node* LoadFromFrame(int offset, | 200 compiler::Node* LoadFromFrame(int offset, |
196 MachineType rep = MachineType::AnyTagged()); | 201 MachineType rep = MachineType::AnyTagged()); |
197 // Load value from current parent frame by given offset in bytes. | 202 // Load value from current parent frame by given offset in bytes. |
198 compiler::Node* LoadFromParentFrame( | 203 compiler::Node* LoadFromParentFrame( |
199 int offset, MachineType rep = MachineType::AnyTagged()); | 204 int offset, MachineType rep = MachineType::AnyTagged()); |
200 | 205 |
(...skipping 15 matching lines...) Expand all Loading... |
216 compiler::Node* LoadAndUntagSmi(compiler::Node* base, int index); | 221 compiler::Node* LoadAndUntagSmi(compiler::Node* base, int index); |
217 // Load a SMI root, untag it, and convert to Word32. | 222 // Load a SMI root, untag it, and convert to Word32. |
218 compiler::Node* LoadAndUntagToWord32Root(Heap::RootListIndex root_index); | 223 compiler::Node* LoadAndUntagToWord32Root(Heap::RootListIndex root_index); |
219 | 224 |
220 // Load the floating point value of a HeapNumber. | 225 // Load the floating point value of a HeapNumber. |
221 compiler::Node* LoadHeapNumberValue(compiler::Node* object); | 226 compiler::Node* LoadHeapNumberValue(compiler::Node* object); |
222 // Load the Map of an HeapObject. | 227 // Load the Map of an HeapObject. |
223 compiler::Node* LoadMap(compiler::Node* object); | 228 compiler::Node* LoadMap(compiler::Node* object); |
224 // Load the instance type of an HeapObject. | 229 // Load the instance type of an HeapObject. |
225 compiler::Node* LoadInstanceType(compiler::Node* object); | 230 compiler::Node* LoadInstanceType(compiler::Node* object); |
| 231 // Compare the instance the type of the object against the provided one. |
| 232 compiler::Node* HasInstanceType(compiler::Node* object, InstanceType type); |
226 // Checks that given heap object has given instance type. | 233 // Checks that given heap object has given instance type. |
227 void AssertInstanceType(compiler::Node* object, InstanceType instance_type); | 234 void AssertInstanceType(compiler::Node* object, InstanceType instance_type); |
228 // Load the properties backing store of a JSObject. | 235 // Load the properties backing store of a JSObject. |
229 compiler::Node* LoadProperties(compiler::Node* object); | 236 compiler::Node* LoadProperties(compiler::Node* object); |
230 // Load the elements backing store of a JSObject. | 237 // Load the elements backing store of a JSObject. |
231 compiler::Node* LoadElements(compiler::Node* object); | 238 compiler::Node* LoadElements(compiler::Node* object); |
232 // Load the length of a JSArray instance. | 239 // Load the length of a JSArray instance. |
233 compiler::Node* LoadJSArrayLength(compiler::Node* array); | 240 compiler::Node* LoadJSArrayLength(compiler::Node* array); |
234 // Load the length of a fixed array base instance. | 241 // Load the length of a fixed array base instance. |
235 compiler::Node* LoadFixedArrayBaseLength(compiler::Node* array); | 242 compiler::Node* LoadFixedArrayBaseLength(compiler::Node* array); |
236 // Load the length of a fixed array base instance. | 243 // Load the length of a fixed array base instance. |
237 compiler::Node* LoadAndUntagFixedArrayBaseLength(compiler::Node* array); | 244 compiler::Node* LoadAndUntagFixedArrayBaseLength(compiler::Node* array); |
238 // Load the bit field of a Map. | 245 // Load the bit field of a Map. |
239 compiler::Node* LoadMapBitField(compiler::Node* map); | 246 compiler::Node* LoadMapBitField(compiler::Node* map); |
240 // Load bit field 2 of a map. | 247 // Load bit field 2 of a map. |
241 compiler::Node* LoadMapBitField2(compiler::Node* map); | 248 compiler::Node* LoadMapBitField2(compiler::Node* map); |
242 // Load bit field 3 of a map. | 249 // Load bit field 3 of a map. |
243 compiler::Node* LoadMapBitField3(compiler::Node* map); | 250 compiler::Node* LoadMapBitField3(compiler::Node* map); |
244 // Load the instance type of a map. | 251 // Load the instance type of a map. |
245 compiler::Node* LoadMapInstanceType(compiler::Node* map); | 252 compiler::Node* LoadMapInstanceType(compiler::Node* map); |
246 // Load the ElementsKind of a map. | 253 // Load the ElementsKind of a map. |
247 compiler::Node* LoadMapElementsKind(compiler::Node* map); | 254 compiler::Node* LoadMapElementsKind(compiler::Node* map); |
248 // Load the instance descriptors of a map. | 255 // Load the instance descriptors of a map. |
249 compiler::Node* LoadMapDescriptors(compiler::Node* map); | 256 compiler::Node* LoadMapDescriptors(compiler::Node* map); |
250 // Load the prototype of a map. | 257 // Load the prototype of a map. |
251 compiler::Node* LoadMapPrototype(compiler::Node* map); | 258 compiler::Node* LoadMapPrototype(compiler::Node* map); |
| 259 // Load the prototype info of a map. The result has to be checked if it is a |
| 260 // prototype info object or not. |
| 261 compiler::Node* LoadMapPrototypeInfo(compiler::Node* map, |
| 262 Label* if_has_no_proto_info); |
252 // Load the instance size of a Map. | 263 // Load the instance size of a Map. |
253 compiler::Node* LoadMapInstanceSize(compiler::Node* map); | 264 compiler::Node* LoadMapInstanceSize(compiler::Node* map); |
254 // Load the inobject properties count of a Map (valid only for JSObjects). | 265 // Load the inobject properties count of a Map (valid only for JSObjects). |
255 compiler::Node* LoadMapInobjectProperties(compiler::Node* map); | 266 compiler::Node* LoadMapInobjectProperties(compiler::Node* map); |
256 // Load the constructor function index of a Map (only for primitive maps). | 267 // Load the constructor function index of a Map (only for primitive maps). |
257 compiler::Node* LoadMapConstructorFunctionIndex(compiler::Node* map); | 268 compiler::Node* LoadMapConstructorFunctionIndex(compiler::Node* map); |
258 // Load the constructor of a Map (equivalent to Map::GetConstructor()). | 269 // Load the constructor of a Map (equivalent to Map::GetConstructor()). |
259 compiler::Node* LoadMapConstructor(compiler::Node* map); | 270 compiler::Node* LoadMapConstructor(compiler::Node* map); |
| 271 // Check whether the map is for an object with special properties, such as a |
| 272 // JSProxy or an object with interceptors. |
| 273 compiler::Node* IsSpecialReceiverMap(compiler::Node* map); |
| 274 compiler::Node* IsSpecialReceiverInstanceType(compiler::Node* instance_type); |
260 | 275 |
261 // Load the hash field of a name as an uint32 value. | 276 // Load the hash field of a name as an uint32 value. |
262 compiler::Node* LoadNameHashField(compiler::Node* name); | 277 compiler::Node* LoadNameHashField(compiler::Node* name); |
263 // Load the hash value of a name as an uint32 value. | 278 // Load the hash value of a name as an uint32 value. |
264 // If {if_hash_not_computed} label is specified then it also checks if | 279 // If {if_hash_not_computed} label is specified then it also checks if |
265 // hash is actually computed. | 280 // hash is actually computed. |
266 compiler::Node* LoadNameHash(compiler::Node* name, | 281 compiler::Node* LoadNameHash(compiler::Node* name, |
267 Label* if_hash_not_computed = nullptr); | 282 Label* if_hash_not_computed = nullptr); |
268 | 283 |
269 // Load length field of a String object. | 284 // Load length field of a String object. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 // Store an array element to a FixedArray. | 343 // Store an array element to a FixedArray. |
329 compiler::Node* StoreFixedArrayElement( | 344 compiler::Node* StoreFixedArrayElement( |
330 compiler::Node* object, compiler::Node* index, compiler::Node* value, | 345 compiler::Node* object, compiler::Node* index, compiler::Node* value, |
331 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, | 346 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, |
332 ParameterMode parameter_mode = INTEGER_PARAMETERS); | 347 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
333 | 348 |
334 compiler::Node* StoreFixedDoubleArrayElement( | 349 compiler::Node* StoreFixedDoubleArrayElement( |
335 compiler::Node* object, compiler::Node* index, compiler::Node* value, | 350 compiler::Node* object, compiler::Node* index, compiler::Node* value, |
336 ParameterMode parameter_mode = INTEGER_PARAMETERS); | 351 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
337 | 352 |
| 353 void StoreFieldsNoWriteBarrier(compiler::Node* start_address, |
| 354 compiler::Node* end_address, |
| 355 compiler::Node* value); |
| 356 |
338 // Allocate a HeapNumber without initializing its value. | 357 // Allocate a HeapNumber without initializing its value. |
339 compiler::Node* AllocateHeapNumber(MutableMode mode = IMMUTABLE); | 358 compiler::Node* AllocateHeapNumber(MutableMode mode = IMMUTABLE); |
340 // Allocate a HeapNumber with a specific value. | 359 // Allocate a HeapNumber with a specific value. |
341 compiler::Node* AllocateHeapNumberWithValue(compiler::Node* value, | 360 compiler::Node* AllocateHeapNumberWithValue(compiler::Node* value, |
342 MutableMode mode = IMMUTABLE); | 361 MutableMode mode = IMMUTABLE); |
343 // Allocate a SeqOneByteString with the given length. | 362 // Allocate a SeqOneByteString with the given length. |
344 compiler::Node* AllocateSeqOneByteString(int length); | 363 compiler::Node* AllocateSeqOneByteString(int length); |
345 compiler::Node* AllocateSeqOneByteString(compiler::Node* context, | 364 compiler::Node* AllocateSeqOneByteString(compiler::Node* context, |
346 compiler::Node* length); | 365 compiler::Node* length); |
347 // Allocate a SeqTwoByteString with the given length. | 366 // Allocate a SeqTwoByteString with the given length. |
(...skipping 27 matching lines...) Expand all Loading... |
375 | 394 |
376 // Allocate a RegExpResult with the given length (the number of captures, | 395 // Allocate a RegExpResult with the given length (the number of captures, |
377 // including the match itself), index (the index where the match starts), | 396 // including the match itself), index (the index where the match starts), |
378 // and input string. |length| and |index| are expected to be tagged, and | 397 // and input string. |length| and |index| are expected to be tagged, and |
379 // |input| must be a string. | 398 // |input| must be a string. |
380 compiler::Node* AllocateRegExpResult(compiler::Node* context, | 399 compiler::Node* AllocateRegExpResult(compiler::Node* context, |
381 compiler::Node* length, | 400 compiler::Node* length, |
382 compiler::Node* index, | 401 compiler::Node* index, |
383 compiler::Node* input); | 402 compiler::Node* input); |
384 | 403 |
| 404 compiler::Node* AllocateJSObjectFromMap(compiler::Node* map, |
| 405 compiler::Node* properties = nullptr, |
| 406 compiler::Node* elements = nullptr); |
| 407 |
| 408 void InitializeJSObjectFromMap(compiler::Node* object, compiler::Node* map, |
| 409 compiler::Node* size, |
| 410 compiler::Node* properties = nullptr, |
| 411 compiler::Node* elements = nullptr); |
| 412 |
| 413 void InitializeJSObjectBody(compiler::Node* object, compiler::Node* map, |
| 414 compiler::Node* size, |
| 415 int start_offset = JSObject::kHeaderSize); |
| 416 |
385 // Allocate a JSArray without elements and initialize the header fields. | 417 // Allocate a JSArray without elements and initialize the header fields. |
386 compiler::Node* AllocateUninitializedJSArrayWithoutElements( | 418 compiler::Node* AllocateUninitializedJSArrayWithoutElements( |
387 ElementsKind kind, compiler::Node* array_map, compiler::Node* length, | 419 ElementsKind kind, compiler::Node* array_map, compiler::Node* length, |
388 compiler::Node* allocation_site); | 420 compiler::Node* allocation_site); |
389 // Allocate and return a JSArray with initialized header fields and its | 421 // Allocate and return a JSArray with initialized header fields and its |
390 // uninitialized elements. | 422 // uninitialized elements. |
391 // The ParameterMode argument is only used for the capacity parameter. | 423 // The ParameterMode argument is only used for the capacity parameter. |
392 std::pair<compiler::Node*, compiler::Node*> | 424 std::pair<compiler::Node*, compiler::Node*> |
393 AllocateUninitializedJSArrayWithElements( | 425 AllocateUninitializedJSArrayWithElements( |
394 ElementsKind kind, compiler::Node* array_map, compiler::Node* length, | 426 ElementsKind kind, compiler::Node* array_map, compiler::Node* length, |
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 static const int kElementLoopUnrollThreshold = 8; | 1022 static const int kElementLoopUnrollThreshold = 8; |
991 }; | 1023 }; |
992 | 1024 |
993 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) | 1025 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) |
994 | 1026 |
995 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1027 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
996 | 1028 |
997 } // namespace internal | 1029 } // namespace internal |
998 } // namespace v8 | 1030 } // namespace v8 |
999 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1031 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
OLD | NEW |