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