| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 compiler::Node* HashSeed(); | 102 compiler::Node* HashSeed(); |
| 103 compiler::Node* StaleRegisterConstant(); | 103 compiler::Node* StaleRegisterConstant(); |
| 104 | 104 |
| 105 compiler::Node* IntPtrOrSmiConstant(int value, ParameterMode mode); | 105 compiler::Node* IntPtrOrSmiConstant(int value, ParameterMode mode); |
| 106 | 106 |
| 107 compiler::Node* IntPtrAddFoldConstants(compiler::Node* left, | 107 compiler::Node* IntPtrAddFoldConstants(compiler::Node* left, |
| 108 compiler::Node* right); | 108 compiler::Node* right); |
| 109 compiler::Node* IntPtrSubFoldConstants(compiler::Node* left, | 109 compiler::Node* IntPtrSubFoldConstants(compiler::Node* left, |
| 110 compiler::Node* right); | 110 compiler::Node* right); |
| 111 compiler::Node* IntPtrRoundUpToPowerOfTwo32(compiler::Node* word32); |
| 112 compiler::Node* IntPtrMax(compiler::Node* left, compiler::Node* right); |
| 111 | 113 |
| 112 // Float64 operations. | 114 // Float64 operations. |
| 113 compiler::Node* Float64Ceil(compiler::Node* x); | 115 compiler::Node* Float64Ceil(compiler::Node* x); |
| 114 compiler::Node* Float64Floor(compiler::Node* x); | 116 compiler::Node* Float64Floor(compiler::Node* x); |
| 115 compiler::Node* Float64Round(compiler::Node* x); | 117 compiler::Node* Float64Round(compiler::Node* x); |
| 116 compiler::Node* Float64Trunc(compiler::Node* x); | 118 compiler::Node* Float64Trunc(compiler::Node* x); |
| 117 | 119 |
| 118 // Tag a Word as a Smi value. | 120 // Tag a Word as a Smi value. |
| 119 compiler::Node* SmiTag(compiler::Node* value); | 121 compiler::Node* SmiTag(compiler::Node* value); |
| 120 // Untag a Smi value as a Word. | 122 // Untag a Smi value as a Word. |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 162 |
| 161 void Assert(compiler::Node* condition, const char* string = nullptr, | 163 void Assert(compiler::Node* condition, const char* string = nullptr, |
| 162 const char* file = nullptr, int line = 0); | 164 const char* file = nullptr, int line = 0); |
| 163 | 165 |
| 164 // Check a value for smi-ness | 166 // Check a value for smi-ness |
| 165 compiler::Node* TaggedIsSmi(compiler::Node* a); | 167 compiler::Node* TaggedIsSmi(compiler::Node* a); |
| 166 // Check that the value is a non-negative smi. | 168 // Check that the value is a non-negative smi. |
| 167 compiler::Node* WordIsPositiveSmi(compiler::Node* a); | 169 compiler::Node* WordIsPositiveSmi(compiler::Node* a); |
| 168 // Check that a word has a word-aligned address. | 170 // Check that a word has a word-aligned address. |
| 169 compiler::Node* WordIsWordAligned(compiler::Node* word); | 171 compiler::Node* WordIsWordAligned(compiler::Node* word); |
| 172 compiler::Node* WordIsPowerOfTwo(compiler::Node* value); |
| 170 | 173 |
| 171 void BranchIfSmiEqual(compiler::Node* a, compiler::Node* b, Label* if_true, | 174 void BranchIfSmiEqual(compiler::Node* a, compiler::Node* b, Label* if_true, |
| 172 Label* if_false) { | 175 Label* if_false) { |
| 173 Branch(SmiEqual(a, b), if_true, if_false); | 176 Branch(SmiEqual(a, b), if_true, if_false); |
| 174 } | 177 } |
| 175 | 178 |
| 176 void BranchIfSmiLessThan(compiler::Node* a, compiler::Node* b, Label* if_true, | 179 void BranchIfSmiLessThan(compiler::Node* a, compiler::Node* b, Label* if_true, |
| 177 Label* if_false) { | 180 Label* if_false) { |
| 178 Branch(SmiLessThan(a, b), if_true, if_false); | 181 Branch(SmiLessThan(a, b), if_true, if_false); |
| 179 } | 182 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 // Load the inobject properties count of a Map (valid only for JSObjects). | 282 // Load the inobject properties count of a Map (valid only for JSObjects). |
| 280 compiler::Node* LoadMapInobjectProperties(compiler::Node* map); | 283 compiler::Node* LoadMapInobjectProperties(compiler::Node* map); |
| 281 // Load the constructor function index of a Map (only for primitive maps). | 284 // Load the constructor function index of a Map (only for primitive maps). |
| 282 compiler::Node* LoadMapConstructorFunctionIndex(compiler::Node* map); | 285 compiler::Node* LoadMapConstructorFunctionIndex(compiler::Node* map); |
| 283 // Load the constructor of a Map (equivalent to Map::GetConstructor()). | 286 // Load the constructor of a Map (equivalent to Map::GetConstructor()). |
| 284 compiler::Node* LoadMapConstructor(compiler::Node* map); | 287 compiler::Node* LoadMapConstructor(compiler::Node* map); |
| 285 // Check whether the map is for an object with special properties, such as a | 288 // Check whether the map is for an object with special properties, such as a |
| 286 // JSProxy or an object with interceptors. | 289 // JSProxy or an object with interceptors. |
| 287 compiler::Node* IsSpecialReceiverMap(compiler::Node* map); | 290 compiler::Node* IsSpecialReceiverMap(compiler::Node* map); |
| 288 compiler::Node* IsSpecialReceiverInstanceType(compiler::Node* instance_type); | 291 compiler::Node* IsSpecialReceiverInstanceType(compiler::Node* instance_type); |
| 292 // Check if the map is set for slow properties. |
| 293 compiler::Node* IsDictionaryMap(compiler::Node* map); |
| 289 | 294 |
| 290 // Load the hash field of a name as an uint32 value. | 295 // Load the hash field of a name as an uint32 value. |
| 291 compiler::Node* LoadNameHashField(compiler::Node* name); | 296 compiler::Node* LoadNameHashField(compiler::Node* name); |
| 292 // Load the hash value of a name as an uint32 value. | 297 // Load the hash value of a name as an uint32 value. |
| 293 // If {if_hash_not_computed} label is specified then it also checks if | 298 // If {if_hash_not_computed} label is specified then it also checks if |
| 294 // hash is actually computed. | 299 // hash is actually computed. |
| 295 compiler::Node* LoadNameHash(compiler::Node* name, | 300 compiler::Node* LoadNameHash(compiler::Node* name, |
| 296 Label* if_hash_not_computed = nullptr); | 301 Label* if_hash_not_computed = nullptr); |
| 297 | 302 |
| 298 // Load length field of a String object. | 303 // Load length field of a String object. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 compiler::Node* StoreObjectFieldNoWriteBarrier( | 358 compiler::Node* StoreObjectFieldNoWriteBarrier( |
| 354 compiler::Node* object, compiler::Node* offset, compiler::Node* value, | 359 compiler::Node* object, compiler::Node* offset, compiler::Node* value, |
| 355 MachineRepresentation rep = MachineRepresentation::kTagged); | 360 MachineRepresentation rep = MachineRepresentation::kTagged); |
| 356 // Store the Map of an HeapObject. | 361 // Store the Map of an HeapObject. |
| 357 compiler::Node* StoreMapNoWriteBarrier(compiler::Node* object, | 362 compiler::Node* StoreMapNoWriteBarrier(compiler::Node* object, |
| 358 compiler::Node* map); | 363 compiler::Node* map); |
| 359 compiler::Node* StoreObjectFieldRoot(compiler::Node* object, int offset, | 364 compiler::Node* StoreObjectFieldRoot(compiler::Node* object, int offset, |
| 360 Heap::RootListIndex root); | 365 Heap::RootListIndex root); |
| 361 // Store an array element to a FixedArray. | 366 // Store an array element to a FixedArray. |
| 362 compiler::Node* StoreFixedArrayElement( | 367 compiler::Node* StoreFixedArrayElement( |
| 368 compiler::Node* object, int index, compiler::Node* value, |
| 369 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, |
| 370 ParameterMode parameter_mode = INTEGER_PARAMETERS) { |
| 371 return StoreFixedArrayElement(object, Int32Constant(index), value, |
| 372 barrier_mode, parameter_mode); |
| 373 } |
| 374 |
| 375 compiler::Node* StoreFixedArrayElement( |
| 363 compiler::Node* object, compiler::Node* index, compiler::Node* value, | 376 compiler::Node* object, compiler::Node* index, compiler::Node* value, |
| 364 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, | 377 WriteBarrierMode barrier_mode = UPDATE_WRITE_BARRIER, |
| 365 ParameterMode parameter_mode = INTEGER_PARAMETERS); | 378 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
| 366 | 379 |
| 367 compiler::Node* StoreFixedDoubleArrayElement( | 380 compiler::Node* StoreFixedDoubleArrayElement( |
| 368 compiler::Node* object, compiler::Node* index, compiler::Node* value, | 381 compiler::Node* object, compiler::Node* index, compiler::Node* value, |
| 369 ParameterMode parameter_mode = INTEGER_PARAMETERS); | 382 ParameterMode parameter_mode = INTEGER_PARAMETERS); |
| 370 | 383 |
| 371 void StoreFieldsNoWriteBarrier(compiler::Node* start_address, | 384 void StoreFieldsNoWriteBarrier(compiler::Node* start_address, |
| 372 compiler::Node* end_address, | 385 compiler::Node* end_address, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 | 437 |
| 425 // Allocate a RegExpResult with the given length (the number of captures, | 438 // Allocate a RegExpResult with the given length (the number of captures, |
| 426 // including the match itself), index (the index where the match starts), | 439 // including the match itself), index (the index where the match starts), |
| 427 // and input string. |length| and |index| are expected to be tagged, and | 440 // and input string. |length| and |index| are expected to be tagged, and |
| 428 // |input| must be a string. | 441 // |input| must be a string. |
| 429 compiler::Node* AllocateRegExpResult(compiler::Node* context, | 442 compiler::Node* AllocateRegExpResult(compiler::Node* context, |
| 430 compiler::Node* length, | 443 compiler::Node* length, |
| 431 compiler::Node* index, | 444 compiler::Node* index, |
| 432 compiler::Node* input); | 445 compiler::Node* input); |
| 433 | 446 |
| 447 compiler::Node* AllocateNameDictionary(int capacity); |
| 448 compiler::Node* AllocateNameDictionary(compiler::Node* capacity); |
| 449 |
| 434 compiler::Node* AllocateJSObjectFromMap(compiler::Node* map, | 450 compiler::Node* AllocateJSObjectFromMap(compiler::Node* map, |
| 435 compiler::Node* properties = nullptr, | 451 compiler::Node* properties = nullptr, |
| 436 compiler::Node* elements = nullptr); | 452 compiler::Node* elements = nullptr); |
| 437 | 453 |
| 438 void InitializeJSObjectFromMap(compiler::Node* object, compiler::Node* map, | 454 void InitializeJSObjectFromMap(compiler::Node* object, compiler::Node* map, |
| 439 compiler::Node* size, | 455 compiler::Node* size, |
| 440 compiler::Node* properties = nullptr, | 456 compiler::Node* properties = nullptr, |
| 441 compiler::Node* elements = nullptr); | 457 compiler::Node* elements = nullptr); |
| 442 | 458 |
| 443 void InitializeJSObjectBody(compiler::Node* object, compiler::Node* map, | 459 void InitializeJSObjectBody(compiler::Node* object, compiler::Node* map, |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 Label* if_keyisunique, Label* if_bailout); | 731 Label* if_keyisunique, Label* if_bailout); |
| 716 | 732 |
| 717 // Calculates array index for given dictionary entry and entry field. | 733 // Calculates array index for given dictionary entry and entry field. |
| 718 // See Dictionary::EntryToIndex(). | 734 // See Dictionary::EntryToIndex(). |
| 719 template <typename Dictionary> | 735 template <typename Dictionary> |
| 720 compiler::Node* EntryToIndex(compiler::Node* entry, int field_index); | 736 compiler::Node* EntryToIndex(compiler::Node* entry, int field_index); |
| 721 template <typename Dictionary> | 737 template <typename Dictionary> |
| 722 compiler::Node* EntryToIndex(compiler::Node* entry) { | 738 compiler::Node* EntryToIndex(compiler::Node* entry) { |
| 723 return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex); | 739 return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex); |
| 724 } | 740 } |
| 741 // Calculate a valid size for the a hash table. |
| 742 compiler::Node* HashTableComputeCapacity(compiler::Node* at_least_space_for); |
| 725 | 743 |
| 726 // Looks up an entry in a NameDictionaryBase successor. If the entry is found | 744 // Looks up an entry in a NameDictionaryBase successor. If the entry is found |
| 727 // control goes to {if_found} and {var_name_index} contains an index of the | 745 // control goes to {if_found} and {var_name_index} contains an index of the |
| 728 // key field of the entry found. If the key is not found control goes to | 746 // key field of the entry found. If the key is not found control goes to |
| 729 // {if_not_found}. | 747 // {if_not_found}. |
| 730 static const int kInlinedDictionaryProbes = 4; | 748 static const int kInlinedDictionaryProbes = 4; |
| 731 template <typename Dictionary> | 749 template <typename Dictionary> |
| 732 void NameDictionaryLookup(compiler::Node* dictionary, | 750 void NameDictionaryLookup(compiler::Node* dictionary, |
| 733 compiler::Node* unique_name, Label* if_found, | 751 compiler::Node* unique_name, Label* if_found, |
| 734 Variable* var_name_index, Label* if_not_found, | 752 Variable* var_name_index, Label* if_not_found, |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 static const int kElementLoopUnrollThreshold = 8; | 1143 static const int kElementLoopUnrollThreshold = 8; |
| 1126 }; | 1144 }; |
| 1127 | 1145 |
| 1128 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) | 1146 #define CSA_ASSERT(x) Assert((x), #x, __FILE__, __LINE__) |
| 1129 | 1147 |
| 1130 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1148 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
| 1131 | 1149 |
| 1132 } // namespace internal | 1150 } // namespace internal |
| 1133 } // namespace v8 | 1151 } // namespace v8 |
| 1134 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1152 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
| OLD | NEW |