| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 149 |
| 150 // Smi | HeapNumber operations. | 150 // Smi | HeapNumber operations. |
| 151 compiler::Node* NumberInc(compiler::Node* value); | 151 compiler::Node* NumberInc(compiler::Node* value); |
| 152 | 152 |
| 153 // Allocate an object of the given size. | 153 // Allocate an object of the given size. |
| 154 compiler::Node* Allocate(compiler::Node* size, AllocationFlags flags = kNone); | 154 compiler::Node* Allocate(compiler::Node* size, AllocationFlags flags = kNone); |
| 155 compiler::Node* Allocate(int size, AllocationFlags flags = kNone); | 155 compiler::Node* Allocate(int size, AllocationFlags flags = kNone); |
| 156 compiler::Node* InnerAllocate(compiler::Node* previous, int offset); | 156 compiler::Node* InnerAllocate(compiler::Node* previous, int offset); |
| 157 compiler::Node* InnerAllocate(compiler::Node* previous, | 157 compiler::Node* InnerAllocate(compiler::Node* previous, |
| 158 compiler::Node* offset); | 158 compiler::Node* offset); |
| 159 compiler::Node* IsRegularHeapObjectSize(compiler::Node* size); |
| 159 | 160 |
| 160 void Assert(compiler::Node* condition, const char* string = nullptr, | 161 void Assert(compiler::Node* condition, const char* string = nullptr, |
| 161 const char* file = nullptr, int line = 0); | 162 const char* file = nullptr, int line = 0); |
| 162 | 163 |
| 163 // Check a value for smi-ness | 164 // Check a value for smi-ness |
| 164 compiler::Node* TaggedIsSmi(compiler::Node* a); | 165 compiler::Node* TaggedIsSmi(compiler::Node* a); |
| 165 // Check that the value is a non-negative smi. | 166 // Check that the value is a non-negative smi. |
| 166 compiler::Node* WordIsPositiveSmi(compiler::Node* a); | 167 compiler::Node* WordIsPositiveSmi(compiler::Node* a); |
| 167 | 168 |
| 168 void BranchIfSmiEqual(compiler::Node* a, compiler::Node* b, Label* if_true, | 169 void BranchIfSmiEqual(compiler::Node* a, compiler::Node* b, Label* if_true, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 192 | 193 |
| 193 void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* lhs_map, | 194 void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* lhs_map, |
| 194 compiler::Node* rhs, compiler::Node* rhs_map, | 195 compiler::Node* rhs, compiler::Node* rhs_map, |
| 195 Label* if_equal, Label* if_notequal); | 196 Label* if_equal, Label* if_notequal); |
| 196 void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* rhs, | 197 void BranchIfSimd128Equal(compiler::Node* lhs, compiler::Node* rhs, |
| 197 Label* if_equal, Label* if_notequal) { | 198 Label* if_equal, Label* if_notequal) { |
| 198 BranchIfSimd128Equal(lhs, LoadMap(lhs), rhs, LoadMap(rhs), if_equal, | 199 BranchIfSimd128Equal(lhs, LoadMap(lhs), rhs, LoadMap(rhs), if_equal, |
| 199 if_notequal); | 200 if_notequal); |
| 200 } | 201 } |
| 201 | 202 |
| 203 void BranchIfJSReceiver(compiler::Node* object, Label* if_true, |
| 204 Label* if_false); |
| 205 void BranchIfJSObject(compiler::Node* object, Label* if_true, |
| 206 Label* if_false); |
| 207 |
| 202 void BranchIfFastJSArray(compiler::Node* object, compiler::Node* context, | 208 void BranchIfFastJSArray(compiler::Node* object, compiler::Node* context, |
| 203 Label* if_true, Label* if_false); | 209 Label* if_true, Label* if_false); |
| 204 | 210 |
| 205 // Load value from current frame by given offset in bytes. | 211 // Load value from current frame by given offset in bytes. |
| 206 compiler::Node* LoadFromFrame(int offset, | 212 compiler::Node* LoadFromFrame(int offset, |
| 207 MachineType rep = MachineType::AnyTagged()); | 213 MachineType rep = MachineType::AnyTagged()); |
| 208 // Load value from current parent frame by given offset in bytes. | 214 // Load value from current parent frame by given offset in bytes. |
| 209 compiler::Node* LoadFromParentFrame( | 215 compiler::Node* LoadFromParentFrame( |
| 210 int offset, MachineType rep = MachineType::AnyTagged()); | 216 int offset, MachineType rep = MachineType::AnyTagged()); |
| 211 | 217 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 227 compiler::Node* LoadAndUntagSmi(compiler::Node* base, int index); | 233 compiler::Node* LoadAndUntagSmi(compiler::Node* base, int index); |
| 228 // Load a SMI root, untag it, and convert to Word32. | 234 // Load a SMI root, untag it, and convert to Word32. |
| 229 compiler::Node* LoadAndUntagToWord32Root(Heap::RootListIndex root_index); | 235 compiler::Node* LoadAndUntagToWord32Root(Heap::RootListIndex root_index); |
| 230 | 236 |
| 231 // Load the floating point value of a HeapNumber. | 237 // Load the floating point value of a HeapNumber. |
| 232 compiler::Node* LoadHeapNumberValue(compiler::Node* object); | 238 compiler::Node* LoadHeapNumberValue(compiler::Node* object); |
| 233 // Load the Map of an HeapObject. | 239 // Load the Map of an HeapObject. |
| 234 compiler::Node* LoadMap(compiler::Node* object); | 240 compiler::Node* LoadMap(compiler::Node* object); |
| 235 // Load the instance type of an HeapObject. | 241 // Load the instance type of an HeapObject. |
| 236 compiler::Node* LoadInstanceType(compiler::Node* object); | 242 compiler::Node* LoadInstanceType(compiler::Node* object); |
| 243 // Compare the instance the type of the object against the provided one. |
| 244 compiler::Node* HasInstanceType(compiler::Node* object, InstanceType type); |
| 237 // Checks that given heap object has given instance type. | 245 // Checks that given heap object has given instance type. |
| 238 void AssertInstanceType(compiler::Node* object, InstanceType instance_type); | 246 void AssertInstanceType(compiler::Node* object, InstanceType instance_type); |
| 239 // Load the properties backing store of a JSObject. | 247 // Load the properties backing store of a JSObject. |
| 240 compiler::Node* LoadProperties(compiler::Node* object); | 248 compiler::Node* LoadProperties(compiler::Node* object); |
| 241 // Load the elements backing store of a JSObject. | 249 // Load the elements backing store of a JSObject. |
| 242 compiler::Node* LoadElements(compiler::Node* object); | 250 compiler::Node* LoadElements(compiler::Node* object); |
| 243 // Load the length of a JSArray instance. | 251 // Load the length of a JSArray instance. |
| 244 compiler::Node* LoadJSArrayLength(compiler::Node* array); | 252 compiler::Node* LoadJSArrayLength(compiler::Node* array); |
| 245 // Load the length of a fixed array base instance. | 253 // Load the length of a fixed array base instance. |
| 246 compiler::Node* LoadFixedArrayBaseLength(compiler::Node* array); | 254 compiler::Node* LoadFixedArrayBaseLength(compiler::Node* array); |
| 247 // Load the length of a fixed array base instance. | 255 // Load the length of a fixed array base instance. |
| 248 compiler::Node* LoadAndUntagFixedArrayBaseLength(compiler::Node* array); | 256 compiler::Node* LoadAndUntagFixedArrayBaseLength(compiler::Node* array); |
| 249 // Load the bit field of a Map. | 257 // Load the bit field of a Map. |
| 250 compiler::Node* LoadMapBitField(compiler::Node* map); | 258 compiler::Node* LoadMapBitField(compiler::Node* map); |
| 251 // Load bit field 2 of a map. | 259 // Load bit field 2 of a map. |
| 252 compiler::Node* LoadMapBitField2(compiler::Node* map); | 260 compiler::Node* LoadMapBitField2(compiler::Node* map); |
| 253 // Load bit field 3 of a map. | 261 // Load bit field 3 of a map. |
| 254 compiler::Node* LoadMapBitField3(compiler::Node* map); | 262 compiler::Node* LoadMapBitField3(compiler::Node* map); |
| 255 // Load the instance type of a map. | 263 // Load the instance type of a map. |
| 256 compiler::Node* LoadMapInstanceType(compiler::Node* map); | 264 compiler::Node* LoadMapInstanceType(compiler::Node* map); |
| 257 // Load the ElementsKind of a map. | 265 // Load the ElementsKind of a map. |
| 258 compiler::Node* LoadMapElementsKind(compiler::Node* map); | 266 compiler::Node* LoadMapElementsKind(compiler::Node* map); |
| 259 // Load the instance descriptors of a map. | 267 // Load the instance descriptors of a map. |
| 260 compiler::Node* LoadMapDescriptors(compiler::Node* map); | 268 compiler::Node* LoadMapDescriptors(compiler::Node* map); |
| 261 // Load the prototype of a map. | 269 // Load the prototype of a map. |
| 262 compiler::Node* LoadMapPrototype(compiler::Node* map); | 270 compiler::Node* LoadMapPrototype(compiler::Node* map); |
| 271 // Load the prototype info of a map. The result has to be checked if it is a |
| 272 // prototype info object or not. |
| 273 compiler::Node* LoadMapPrototypeInfo(compiler::Node* map, |
| 274 Label* if_has_no_proto_info); |
| 263 // Load the instance size of a Map. | 275 // Load the instance size of a Map. |
| 264 compiler::Node* LoadMapInstanceSize(compiler::Node* map); | 276 compiler::Node* LoadMapInstanceSize(compiler::Node* map); |
| 265 // Load the inobject properties count of a Map (valid only for JSObjects). | 277 // Load the inobject properties count of a Map (valid only for JSObjects). |
| 266 compiler::Node* LoadMapInobjectProperties(compiler::Node* map); | 278 compiler::Node* LoadMapInobjectProperties(compiler::Node* map); |
| 267 // Load the constructor function index of a Map (only for primitive maps). | 279 // Load the constructor function index of a Map (only for primitive maps). |
| 268 compiler::Node* LoadMapConstructorFunctionIndex(compiler::Node* map); | 280 compiler::Node* LoadMapConstructorFunctionIndex(compiler::Node* map); |
| 269 // Load the constructor of a Map (equivalent to Map::GetConstructor()). | 281 // Load the constructor of a Map (equivalent to Map::GetConstructor()). |
| 270 compiler::Node* LoadMapConstructor(compiler::Node* map); | 282 compiler::Node* LoadMapConstructor(compiler::Node* map); |
| 283 // Check whether the map is for an object with special properties, such as a |
| 284 // JSProxy or an object with interceptors. |
| 285 compiler::Node* IsSpecialReceiverMap(compiler::Node* map); |
| 286 compiler::Node* IsSpecialReceiverInstanceType(compiler::Node* instance_type); |
| 271 | 287 |
| 272 // Load the hash field of a name as an uint32 value. | 288 // Load the hash field of a name as an uint32 value. |
| 273 compiler::Node* LoadNameHashField(compiler::Node* name); | 289 compiler::Node* LoadNameHashField(compiler::Node* name); |
| 274 // Load the hash value of a name as an uint32 value. | 290 // Load the hash value of a name as an uint32 value. |
| 275 // If {if_hash_not_computed} label is specified then it also checks if | 291 // If {if_hash_not_computed} label is specified then it also checks if |
| 276 // hash is actually computed. | 292 // hash is actually computed. |
| 277 compiler::Node* LoadNameHash(compiler::Node* name, | 293 compiler::Node* LoadNameHash(compiler::Node* name, |
| 278 Label* if_hash_not_computed = nullptr); | 294 Label* if_hash_not_computed = nullptr); |
| 279 | 295 |
| 280 // Load length field of a String object. | 296 // Load length field of a String object. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 // Store an array element to a FixedArray. | 359 // Store an array element to a FixedArray. |
| 344 compiler::Node* StoreFixedArrayElement( | 360 compiler::Node* StoreFixedArrayElement( |
| 345 compiler::Node* object, compiler::Node* index, compiler::Node* value, | 361 compiler::Node* object, compiler::Node* index, compiler::Node* value, |
| 346 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, | 362 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, |
| 347 ParameterMode parameter_mode = INTEGER_PARAMETERS); | 363 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
| 348 | 364 |
| 349 compiler::Node* StoreFixedDoubleArrayElement( | 365 compiler::Node* StoreFixedDoubleArrayElement( |
| 350 compiler::Node* object, compiler::Node* index, compiler::Node* value, | 366 compiler::Node* object, compiler::Node* index, compiler::Node* value, |
| 351 ParameterMode parameter_mode = INTEGER_PARAMETERS); | 367 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
| 352 | 368 |
| 369 void StoreFieldsNoWriteBarrier(compiler::Node* start_address, |
| 370 compiler::Node* end_address, |
| 371 compiler::Node* value); |
| 372 |
| 353 // Allocate a HeapNumber without initializing its value. | 373 // Allocate a HeapNumber without initializing its value. |
| 354 compiler::Node* AllocateHeapNumber(MutableMode mode = IMMUTABLE); | 374 compiler::Node* AllocateHeapNumber(MutableMode mode = IMMUTABLE); |
| 355 // Allocate a HeapNumber with a specific value. | 375 // Allocate a HeapNumber with a specific value. |
| 356 compiler::Node* AllocateHeapNumberWithValue(compiler::Node* value, | 376 compiler::Node* AllocateHeapNumberWithValue(compiler::Node* value, |
| 357 MutableMode mode = IMMUTABLE); | 377 MutableMode mode = IMMUTABLE); |
| 358 // Allocate a SeqOneByteString with the given length. | 378 // Allocate a SeqOneByteString with the given length. |
| 359 compiler::Node* AllocateSeqOneByteString(int length, | 379 compiler::Node* AllocateSeqOneByteString(int length, |
| 360 AllocationFlags flags = kNone); | 380 AllocationFlags flags = kNone); |
| 361 compiler::Node* AllocateSeqOneByteString( | 381 compiler::Node* AllocateSeqOneByteString( |
| 362 compiler::Node* context, compiler::Node* length, | 382 compiler::Node* context, compiler::Node* length, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 422 |
| 403 // Allocate a RegExpResult with the given length (the number of captures, | 423 // Allocate a RegExpResult with the given length (the number of captures, |
| 404 // including the match itself), index (the index where the match starts), | 424 // including the match itself), index (the index where the match starts), |
| 405 // and input string. |length| and |index| are expected to be tagged, and | 425 // and input string. |length| and |index| are expected to be tagged, and |
| 406 // |input| must be a string. | 426 // |input| must be a string. |
| 407 compiler::Node* AllocateRegExpResult(compiler::Node* context, | 427 compiler::Node* AllocateRegExpResult(compiler::Node* context, |
| 408 compiler::Node* length, | 428 compiler::Node* length, |
| 409 compiler::Node* index, | 429 compiler::Node* index, |
| 410 compiler::Node* input); | 430 compiler::Node* input); |
| 411 | 431 |
| 432 compiler::Node* AllocateJSObjectFromMap(compiler::Node* map, |
| 433 compiler::Node* properties = nullptr, |
| 434 compiler::Node* elements = nullptr); |
| 435 |
| 436 void InitializeJSObjectFromMap(compiler::Node* object, compiler::Node* map, |
| 437 compiler::Node* size, |
| 438 compiler::Node* properties = nullptr, |
| 439 compiler::Node* elements = nullptr); |
| 440 |
| 441 void InitializeJSObjectBody(compiler::Node* object, compiler::Node* map, |
| 442 compiler::Node* size, |
| 443 int start_offset = JSObject::kHeaderSize); |
| 444 |
| 412 // Allocate a JSArray without elements and initialize the header fields. | 445 // Allocate a JSArray without elements and initialize the header fields. |
| 413 compiler::Node* AllocateUninitializedJSArrayWithoutElements( | 446 compiler::Node* AllocateUninitializedJSArrayWithoutElements( |
| 414 ElementsKind kind, compiler::Node* array_map, compiler::Node* length, | 447 ElementsKind kind, compiler::Node* array_map, compiler::Node* length, |
| 415 compiler::Node* allocation_site); | 448 compiler::Node* allocation_site); |
| 416 // Allocate and return a JSArray with initialized header fields and its | 449 // Allocate and return a JSArray with initialized header fields and its |
| 417 // uninitialized elements. | 450 // uninitialized elements. |
| 418 // The ParameterMode argument is only used for the capacity parameter. | 451 // The ParameterMode argument is only used for the capacity parameter. |
| 419 std::pair<compiler::Node*, compiler::Node*> | 452 std::pair<compiler::Node*, compiler::Node*> |
| 420 AllocateUninitializedJSArrayWithElements( | 453 AllocateUninitializedJSArrayWithElements( |
| 421 ElementsKind kind, compiler::Node* array_map, compiler::Node* length, | 454 ElementsKind kind, compiler::Node* array_map, compiler::Node* length, |
| (...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 static const int kElementLoopUnrollThreshold = 8; | 1086 static const int kElementLoopUnrollThreshold = 8; |
| 1054 }; | 1087 }; |
| 1055 | 1088 |
| 1056 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) | 1089 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) |
| 1057 | 1090 |
| 1058 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1091 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
| 1059 | 1092 |
| 1060 } // namespace internal | 1093 } // namespace internal |
| 1061 } // namespace v8 | 1094 } // namespace v8 |
| 1062 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1095 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
| OLD | NEW |