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 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 static inline bool IsOneByte(T t, int chars); | 821 static inline bool IsOneByte(T t, int chars); |
822 | 822 |
823 template<typename T> | 823 template<typename T> |
824 MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringImpl( | 824 MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringImpl( |
825 T t, int chars, uint32_t hash_field); | 825 T t, int chars, uint32_t hash_field); |
826 | 826 |
827 template<bool is_one_byte, typename T> | 827 template<bool is_one_byte, typename T> |
828 MUST_USE_RESULT MaybeObject* AllocateInternalizedStringImpl( | 828 MUST_USE_RESULT MaybeObject* AllocateInternalizedStringImpl( |
829 T t, int chars, uint32_t hash_field); | 829 T t, int chars, uint32_t hash_field); |
830 | 830 |
831 // Computes a single character string where the character has code. | |
832 // A cache is used for ASCII codes. | |
833 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | |
834 // failed. Please note this does not perform a garbage collection. | |
835 MUST_USE_RESULT MaybeObject* LookupSingleCharacterStringFromCode( | |
836 uint16_t code); | |
837 | |
838 // Allocate a byte array of the specified length | 831 // Allocate a byte array of the specified length |
839 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 832 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
840 // failed. | 833 // failed. |
841 // Please note this does not perform a garbage collection. | 834 // Please note this does not perform a garbage collection. |
842 MUST_USE_RESULT MaybeObject* AllocateByteArray( | 835 MUST_USE_RESULT MaybeObject* AllocateByteArray( |
843 int length, | 836 int length, |
844 PretenureFlag pretenure = NOT_TENURED); | 837 PretenureFlag pretenure = NOT_TENURED); |
845 | 838 |
846 // Allocates an external array of the specified length and type. | 839 // Allocates an external array of the specified length and type. |
847 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 840 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 | 991 |
999 // Copy the code and scope info part of the code object, but insert | 992 // Copy the code and scope info part of the code object, but insert |
1000 // the provided data as the relocation information. | 993 // the provided data as the relocation information. |
1001 MUST_USE_RESULT MaybeObject* CopyCode(Code* code, Vector<byte> reloc_info); | 994 MUST_USE_RESULT MaybeObject* CopyCode(Code* code, Vector<byte> reloc_info); |
1002 | 995 |
1003 // Finds the internalized copy for string in the string table. | 996 // Finds the internalized copy for string in the string table. |
1004 // If not found, a new string is added to the table and returned. | 997 // If not found, a new string is added to the table and returned. |
1005 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation | 998 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation |
1006 // failed. | 999 // failed. |
1007 // Please note this function does not perform a garbage collection. | 1000 // Please note this function does not perform a garbage collection. |
1008 MUST_USE_RESULT MaybeObject* InternalizeUtf8String(const char* str) { | |
1009 return InternalizeUtf8String(CStrVector(str)); | |
1010 } | |
1011 MUST_USE_RESULT MaybeObject* InternalizeUtf8String(Vector<const char> str); | |
1012 | |
1013 MUST_USE_RESULT MaybeObject* InternalizeString(String* str); | |
1014 MUST_USE_RESULT MaybeObject* InternalizeStringWithKey(HashTableKey* key); | 1001 MUST_USE_RESULT MaybeObject* InternalizeStringWithKey(HashTableKey* key); |
1015 | 1002 |
1016 bool InternalizeStringIfExists(String* str, String** result); | 1003 bool InternalizeStringIfExists(String* str, String** result); |
1017 bool InternalizeTwoCharsStringIfExists(String* str, String** result); | 1004 bool InternalizeTwoCharsStringIfExists(String* str, String** result); |
1018 | 1005 |
1019 // Compute the matching internalized string map for a string if possible. | 1006 // Compute the matching internalized string map for a string if possible. |
1020 // NULL is returned if string is in new space or not flattened. | 1007 // NULL is returned if string is in new space or not flattened. |
1021 Map* InternalizedStringMapForString(String* str); | 1008 Map* InternalizedStringMapForString(String* str); |
1022 | 1009 |
1023 // Converts the given boolean condition to JavaScript boolean value. | 1010 // Converts the given boolean condition to JavaScript boolean value. |
(...skipping 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2919 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2906 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2920 | 2907 |
2921 private: | 2908 private: |
2922 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2909 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2923 }; | 2910 }; |
2924 #endif // DEBUG | 2911 #endif // DEBUG |
2925 | 2912 |
2926 } } // namespace v8::internal | 2913 } } // namespace v8::internal |
2927 | 2914 |
2928 #endif // V8_HEAP_H_ | 2915 #endif // V8_HEAP_H_ |
OLD | NEW |