| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 // result will be ASCII encoded, otherwise it will converted to two | 692 // result will be ASCII encoded, otherwise it will converted to two |
| 693 // byte. | 693 // byte. |
| 694 // - ...FromTwoByte initializes the string from a buffer that is two-byte | 694 // - ...FromTwoByte initializes the string from a buffer that is two-byte |
| 695 // encoded. If the characters are all single-byte characters, the | 695 // encoded. If the characters are all single-byte characters, the |
| 696 // result will be converted to ASCII, otherwise it will be left as | 696 // result will be converted to ASCII, otherwise it will be left as |
| 697 // two-byte. | 697 // two-byte. |
| 698 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 698 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 699 // failed. | 699 // failed. |
| 700 // Please note this does not perform a garbage collection. | 700 // Please note this does not perform a garbage collection. |
| 701 MUST_USE_RESULT MaybeObject* AllocateStringFromOneByte( | 701 MUST_USE_RESULT MaybeObject* AllocateStringFromOneByte( |
| 702 Vector<const uint8_t> str, |
| 703 PretenureFlag pretenure = NOT_TENURED); |
| 704 // TODO(dcarney): remove this function. |
| 705 MUST_USE_RESULT inline MaybeObject* AllocateStringFromOneByte( |
| 702 Vector<const char> str, | 706 Vector<const char> str, |
| 703 PretenureFlag pretenure = NOT_TENURED); | 707 PretenureFlag pretenure = NOT_TENURED) { |
| 708 return AllocateStringFromOneByte(Vector<const uint8_t>::cast(str), |
| 709 pretenure); |
| 710 } |
| 704 MUST_USE_RESULT inline MaybeObject* AllocateStringFromUtf8( | 711 MUST_USE_RESULT inline MaybeObject* AllocateStringFromUtf8( |
| 705 Vector<const char> str, | 712 Vector<const char> str, |
| 706 PretenureFlag pretenure = NOT_TENURED); | 713 PretenureFlag pretenure = NOT_TENURED); |
| 707 MUST_USE_RESULT MaybeObject* AllocateStringFromUtf8Slow( | 714 MUST_USE_RESULT MaybeObject* AllocateStringFromUtf8Slow( |
| 708 Vector<const char> str, | 715 Vector<const char> str, |
| 709 int non_ascii_start, | 716 int non_ascii_start, |
| 710 PretenureFlag pretenure = NOT_TENURED); | 717 PretenureFlag pretenure = NOT_TENURED); |
| 711 MUST_USE_RESULT MaybeObject* AllocateStringFromTwoByte( | 718 MUST_USE_RESULT MaybeObject* AllocateStringFromTwoByte( |
| 712 Vector<const uc16> str, | 719 Vector<const uc16> str, |
| 713 PretenureFlag pretenure = NOT_TENURED); | 720 PretenureFlag pretenure = NOT_TENURED); |
| 714 | 721 |
| 715 // Allocates a symbol in old space based on the character stream. | 722 // Allocates a symbol in old space based on the character stream. |
| 716 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 723 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 717 // failed. | 724 // failed. |
| 718 // Please note this function does not perform a garbage collection. | 725 // Please note this function does not perform a garbage collection. |
| 719 MUST_USE_RESULT inline MaybeObject* AllocateSymbol(Vector<const char> str, | 726 MUST_USE_RESULT inline MaybeObject* AllocateSymbolFromUtf8( |
| 720 int chars, | 727 Vector<const char> str, |
| 721 uint32_t hash_field); | 728 int chars, |
| 729 uint32_t hash_field); |
| 722 | 730 |
| 723 MUST_USE_RESULT inline MaybeObject* AllocateAsciiSymbol( | 731 MUST_USE_RESULT inline MaybeObject* AllocateOneByteSymbol( |
| 724 Vector<const char> str, | 732 Vector<const uint8_t> str, |
| 725 uint32_t hash_field); | 733 uint32_t hash_field); |
| 726 | 734 |
| 727 MUST_USE_RESULT inline MaybeObject* AllocateTwoByteSymbol( | 735 MUST_USE_RESULT inline MaybeObject* AllocateTwoByteSymbol( |
| 728 Vector<const uc16> str, | 736 Vector<const uc16> str, |
| 729 uint32_t hash_field); | 737 uint32_t hash_field); |
| 730 | 738 |
| 731 template<typename T> | 739 template<typename T> |
| 732 static inline bool IsOneByte(T t, int chars); | 740 static inline bool IsOneByte(T t, int chars); |
| 733 | 741 |
| 734 template<typename T> | 742 template<typename T> |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 | 1039 |
| 1032 // Finds the symbol for string in the symbol table. | 1040 // Finds the symbol for string in the symbol table. |
| 1033 // If not found, a new symbol is added to the table and returned. | 1041 // If not found, a new symbol is added to the table and returned. |
| 1034 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation | 1042 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation |
| 1035 // failed. | 1043 // failed. |
| 1036 // Please note this function does not perform a garbage collection. | 1044 // Please note this function does not perform a garbage collection. |
| 1037 MUST_USE_RESULT MaybeObject* LookupUtf8Symbol(Vector<const char> str); | 1045 MUST_USE_RESULT MaybeObject* LookupUtf8Symbol(Vector<const char> str); |
| 1038 MUST_USE_RESULT MaybeObject* LookupUtf8Symbol(const char* str) { | 1046 MUST_USE_RESULT MaybeObject* LookupUtf8Symbol(const char* str) { |
| 1039 return LookupUtf8Symbol(CStrVector(str)); | 1047 return LookupUtf8Symbol(CStrVector(str)); |
| 1040 } | 1048 } |
| 1041 MUST_USE_RESULT MaybeObject* LookupOneByteSymbol(Vector<const char> str); | 1049 MUST_USE_RESULT MaybeObject* LookupOneByteSymbol(Vector<const uint8_t> str); |
| 1042 MUST_USE_RESULT MaybeObject* LookupTwoByteSymbol(Vector<const uc16> str); | 1050 MUST_USE_RESULT MaybeObject* LookupTwoByteSymbol(Vector<const uc16> str); |
| 1043 MUST_USE_RESULT MaybeObject* LookupSymbol(String* str); | 1051 MUST_USE_RESULT MaybeObject* LookupSymbol(String* str); |
| 1044 MUST_USE_RESULT MaybeObject* LookupOneByteSymbol( | 1052 MUST_USE_RESULT MaybeObject* LookupOneByteSymbol( |
| 1045 Handle<SeqOneByteString> string, int from, int length); | 1053 Handle<SeqOneByteString> string, int from, int length); |
| 1046 | 1054 |
| 1047 bool LookupSymbolIfExists(String* str, String** symbol); | 1055 bool LookupSymbolIfExists(String* str, String** symbol); |
| 1048 bool LookupTwoCharsSymbolIfExists(String* str, String** symbol); | 1056 bool LookupTwoCharsSymbolIfExists(String* str, String** symbol); |
| 1049 | 1057 |
| 1050 // Compute the matching symbol map for a string if possible. | 1058 // Compute the matching symbol map for a string if possible. |
| 1051 // NULL is returned if string is in new space or not flattened. | 1059 // NULL is returned if string is in new space or not flattened. |
| (...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2841 AssertNoAllocation no_alloc; // i.e. no gc allowed. | 2849 AssertNoAllocation no_alloc; // i.e. no gc allowed. |
| 2842 | 2850 |
| 2843 private: | 2851 private: |
| 2844 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2852 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2845 }; | 2853 }; |
| 2846 #endif // DEBUG || LIVE_OBJECT_LIST | 2854 #endif // DEBUG || LIVE_OBJECT_LIST |
| 2847 | 2855 |
| 2848 } } // namespace v8::internal | 2856 } } // namespace v8::internal |
| 2849 | 2857 |
| 2850 #endif // V8_HEAP_H_ | 2858 #endif // V8_HEAP_H_ |
| OLD | NEW |