| 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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 703 // Return the single character string with only {code}. | 703 // Return the single character string with only {code}. |
| 704 Node* StringFromCharCode(Node* code); | 704 Node* StringFromCharCode(Node* code); |
| 705 // Return a new string object which holds a substring containing the range | 705 // Return a new string object which holds a substring containing the range |
| 706 // [from,to[ of string. |from| and |to| are expected to be tagged. | 706 // [from,to[ of string. |from| and |to| are expected to be tagged. |
| 707 Node* SubString(Node* context, Node* string, Node* from, Node* to); | 707 Node* SubString(Node* context, Node* string, Node* from, Node* to); |
| 708 | 708 |
| 709 // Return a new string object produced by concatenating |first| with |second|. | 709 // Return a new string object produced by concatenating |first| with |second|. |
| 710 Node* StringAdd(Node* context, Node* first, Node* second, | 710 Node* StringAdd(Node* context, Node* first, Node* second, |
| 711 AllocationFlags flags = kNone); | 711 AllocationFlags flags = kNone); |
| 712 | 712 |
| 713 // Check if |var_string| has an indirect (thin or flat cons) string type, |
| 714 // and unpack it if so. |
| 715 void MaybeDerefIndirectString(Variable* var_string, Node* instance_type, |
| 716 Variable* var_did_something); |
| 717 // Check if |var_left| or |var_right| has an indirect (thin or flat cons) |
| 718 // string type, and unpack it/them if so. Fall through if nothing was done. |
| 719 void MaybeDerefIndirectStrings(Variable* var_left, Node* left_instance_type, |
| 720 Variable* var_right, Node* right_instance_type, |
| 721 Label* did_something); |
| 722 |
| 713 // Return the first index >= {from} at which {needle_char} was found in | 723 // Return the first index >= {from} at which {needle_char} was found in |
| 714 // {string}, or -1 if such an index does not exist. The returned value is | 724 // {string}, or -1 if such an index does not exist. The returned value is |
| 715 // a Smi, {string} is expected to be a String, {needle_char} is an intptr, | 725 // a Smi, {string} is expected to be a String, {needle_char} is an intptr, |
| 716 // and {from} is expected to be tagged. | 726 // and {from} is expected to be tagged. |
| 717 Node* StringIndexOfChar(Node* context, Node* string, Node* needle_char, | 727 Node* StringIndexOfChar(Node* context, Node* string, Node* needle_char, |
| 718 Node* from); | 728 Node* from); |
| 719 | 729 |
| 720 Node* StringFromCodePoint(Node* codepoint, UnicodeEncoding encoding); | 730 Node* StringFromCodePoint(Node* codepoint, UnicodeEncoding encoding); |
| 721 | 731 |
| 722 // Type conversion helpers. | 732 // Type conversion helpers. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 734 // 2^32−1, inclusive. | 744 // 2^32−1, inclusive. |
| 735 // ES#sec-touint32 | 745 // ES#sec-touint32 |
| 736 compiler::Node* ToUint32(compiler::Node* context, compiler::Node* input); | 746 compiler::Node* ToUint32(compiler::Node* context, compiler::Node* input); |
| 737 | 747 |
| 738 // Convert any object to a String. | 748 // Convert any object to a String. |
| 739 Node* ToString(Node* context, Node* input); | 749 Node* ToString(Node* context, Node* input); |
| 740 | 750 |
| 741 // Convert any object to a Primitive. | 751 // Convert any object to a Primitive. |
| 742 Node* JSReceiverToPrimitive(Node* context, Node* input); | 752 Node* JSReceiverToPrimitive(Node* context, Node* input); |
| 743 | 753 |
| 744 // Convert a String to a flat String. | |
| 745 Node* FlattenString(Node* string); | |
| 746 | |
| 747 enum ToIntegerTruncationMode { | 754 enum ToIntegerTruncationMode { |
| 748 kNoTruncation, | 755 kNoTruncation, |
| 749 kTruncateMinusZero, | 756 kTruncateMinusZero, |
| 750 }; | 757 }; |
| 751 | 758 |
| 752 // Convert any object to an Integer. | 759 // Convert any object to an Integer. |
| 753 Node* ToInteger(Node* context, Node* input, | 760 Node* ToInteger(Node* context, Node* input, |
| 754 ToIntegerTruncationMode mode = kNoTruncation); | 761 ToIntegerTruncationMode mode = kNoTruncation); |
| 755 | 762 |
| 756 // Returns a node that contains a decoded (unsigned!) value of a bit | 763 // Returns a node that contains a decoded (unsigned!) value of a bit |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 void Increment(Variable& variable, int value = 1, | 856 void Increment(Variable& variable, int value = 1, |
| 850 ParameterMode mode = INTPTR_PARAMETERS); | 857 ParameterMode mode = INTPTR_PARAMETERS); |
| 851 | 858 |
| 852 // Generates "if (false) goto label" code. Useful for marking a label as | 859 // Generates "if (false) goto label" code. Useful for marking a label as |
| 853 // "live" to avoid assertion failures during graph building. In the resulting | 860 // "live" to avoid assertion failures during graph building. In the resulting |
| 854 // code this check will be eliminated. | 861 // code this check will be eliminated. |
| 855 void Use(Label* label); | 862 void Use(Label* label); |
| 856 | 863 |
| 857 // Various building blocks for stubs doing property lookups. | 864 // Various building blocks for stubs doing property lookups. |
| 858 void TryToName(Node* key, Label* if_keyisindex, Variable* var_index, | 865 void TryToName(Node* key, Label* if_keyisindex, Variable* var_index, |
| 859 Label* if_keyisunique, Label* if_bailout); | 866 Label* if_keyisunique, Variable* var_unique, |
| 867 Label* if_bailout); |
| 860 | 868 |
| 861 // Calculates array index for given dictionary entry and entry field. | 869 // Calculates array index for given dictionary entry and entry field. |
| 862 // See Dictionary::EntryToIndex(). | 870 // See Dictionary::EntryToIndex(). |
| 863 template <typename Dictionary> | 871 template <typename Dictionary> |
| 864 Node* EntryToIndex(Node* entry, int field_index); | 872 Node* EntryToIndex(Node* entry, int field_index); |
| 865 template <typename Dictionary> | 873 template <typename Dictionary> |
| 866 Node* EntryToIndex(Node* entry) { | 874 Node* EntryToIndex(Node* entry) { |
| 867 return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex); | 875 return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex); |
| 868 } | 876 } |
| 869 // Calculate a valid size for the a hash table. | 877 // Calculate a valid size for the a hash table. |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 } | 1284 } |
| 1277 #else | 1285 #else |
| 1278 #define CSA_SLOW_ASSERT(csa, x) ((void)0) | 1286 #define CSA_SLOW_ASSERT(csa, x) ((void)0) |
| 1279 #endif | 1287 #endif |
| 1280 | 1288 |
| 1281 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); | 1289 DEFINE_OPERATORS_FOR_FLAGS(CodeStubAssembler::AllocationFlags); |
| 1282 | 1290 |
| 1283 } // namespace internal | 1291 } // namespace internal |
| 1284 } // namespace v8 | 1292 } // namespace v8 |
| 1285 #endif // V8_CODE_STUB_ASSEMBLER_H_ | 1293 #endif // V8_CODE_STUB_ASSEMBLER_H_ |
| OLD | NEW |