| 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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 static inline bool IsOneByte(T t, int chars); | 819 static inline bool IsOneByte(T t, int chars); |
| 820 | 820 |
| 821 template<typename T> | 821 template<typename T> |
| 822 MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringImpl( | 822 MUST_USE_RESULT inline MaybeObject* AllocateInternalizedStringImpl( |
| 823 T t, int chars, uint32_t hash_field); | 823 T t, int chars, uint32_t hash_field); |
| 824 | 824 |
| 825 template<bool is_one_byte, typename T> | 825 template<bool is_one_byte, typename T> |
| 826 MUST_USE_RESULT MaybeObject* AllocateInternalizedStringImpl( | 826 MUST_USE_RESULT MaybeObject* AllocateInternalizedStringImpl( |
| 827 T t, int chars, uint32_t hash_field); | 827 T t, int chars, uint32_t hash_field); |
| 828 | 828 |
| 829 // Allocates and partially initializes a String. There are two String | |
| 830 // encodings: ASCII and two byte. These functions allocate a string of the | |
| 831 // given length and set its map and length fields. The characters of the | |
| 832 // string are uninitialized. | |
| 833 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | |
| 834 // failed. | |
| 835 // Please note this does not perform a garbage collection. | |
| 836 MUST_USE_RESULT MaybeObject* AllocateRawOneByteString( | |
| 837 int length, | |
| 838 PretenureFlag pretenure = NOT_TENURED); | |
| 839 MUST_USE_RESULT MaybeObject* AllocateRawTwoByteString( | |
| 840 int length, | |
| 841 PretenureFlag pretenure = NOT_TENURED); | |
| 842 | |
| 843 // Computes a single character string where the character has code. | 829 // Computes a single character string where the character has code. |
| 844 // A cache is used for ASCII codes. | 830 // A cache is used for ASCII codes. |
| 845 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 831 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 846 // failed. Please note this does not perform a garbage collection. | 832 // failed. Please note this does not perform a garbage collection. |
| 847 MUST_USE_RESULT MaybeObject* LookupSingleCharacterStringFromCode( | 833 MUST_USE_RESULT MaybeObject* LookupSingleCharacterStringFromCode( |
| 848 uint16_t code); | 834 uint16_t code); |
| 849 | 835 |
| 850 // Allocate a byte array of the specified length | 836 // Allocate a byte array of the specified length |
| 851 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 837 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 852 // failed. | 838 // failed. |
| (...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1982 // size, pretenuring decision, and preferred old-space. | 1968 // size, pretenuring decision, and preferred old-space. |
| 1983 static AllocationSpace SelectSpace(int object_size, | 1969 static AllocationSpace SelectSpace(int object_size, |
| 1984 AllocationSpace preferred_old_space, | 1970 AllocationSpace preferred_old_space, |
| 1985 PretenureFlag pretenure) { | 1971 PretenureFlag pretenure) { |
| 1986 ASSERT(preferred_old_space == OLD_POINTER_SPACE || | 1972 ASSERT(preferred_old_space == OLD_POINTER_SPACE || |
| 1987 preferred_old_space == OLD_DATA_SPACE); | 1973 preferred_old_space == OLD_DATA_SPACE); |
| 1988 if (object_size > Page::kMaxRegularHeapObjectSize) return LO_SPACE; | 1974 if (object_size > Page::kMaxRegularHeapObjectSize) return LO_SPACE; |
| 1989 return (pretenure == TENURED) ? preferred_old_space : NEW_SPACE; | 1975 return (pretenure == TENURED) ? preferred_old_space : NEW_SPACE; |
| 1990 } | 1976 } |
| 1991 | 1977 |
| 1992 // Allocates an uninitialized object. The memory is non-executable if the | 1978 // Allocate an uninitialized object. The memory is non-executable if the |
| 1993 // hardware and OS allow. This is the single choke-point for allocations | 1979 // hardware and OS allow. This is the single choke-point for allocations |
| 1994 // performed by the runtime and should not be bypassed (to extend this to | 1980 // performed by the runtime and should not be bypassed (to extend this to |
| 1995 // inlined allocations, use the Heap::DisableInlineAllocation() support). | 1981 // inlined allocations, use the Heap::DisableInlineAllocation() support). |
| 1996 MUST_USE_RESULT inline MaybeObject* AllocateRaw(int size_in_bytes, | 1982 MUST_USE_RESULT inline MaybeObject* AllocateRaw(int size_in_bytes, |
| 1997 AllocationSpace space, | 1983 AllocationSpace space, |
| 1998 AllocationSpace retry_space); | 1984 AllocationSpace retry_space); |
| 1999 | 1985 |
| 2000 // Allocate an uninitialized fixed array. | 1986 // Allocate an uninitialized fixed array. |
| 2001 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray( | 1987 MUST_USE_RESULT MaybeObject* AllocateRawFixedArray( |
| 2002 int length, PretenureFlag pretenure); | 1988 int length, PretenureFlag pretenure); |
| 2003 | 1989 |
| 2004 // Allocate an uninitialized fixed double array. | 1990 // Allocate an uninitialized fixed double array. |
| 2005 MUST_USE_RESULT MaybeObject* AllocateRawFixedDoubleArray( | 1991 MUST_USE_RESULT MaybeObject* AllocateRawFixedDoubleArray( |
| 2006 int length, PretenureFlag pretenure); | 1992 int length, PretenureFlag pretenure); |
| 2007 | 1993 |
| 2008 // Allocate an initialized fixed array with the given filler value. | 1994 // Allocate an initialized fixed array with the given filler value. |
| 2009 MUST_USE_RESULT MaybeObject* AllocateFixedArrayWithFiller( | 1995 MUST_USE_RESULT MaybeObject* AllocateFixedArrayWithFiller( |
| 2010 int length, PretenureFlag pretenure, Object* filler); | 1996 int length, PretenureFlag pretenure, Object* filler); |
| 2011 | 1997 |
| 1998 // Allocate and partially initializes a String. There are two String |
| 1999 // encodings: ASCII and two byte. These functions allocate a string of the |
| 2000 // given length and set its map and length fields. The characters of the |
| 2001 // string are uninitialized. |
| 2002 MUST_USE_RESULT MaybeObject* AllocateRawOneByteString( |
| 2003 int length, PretenureFlag pretenure); |
| 2004 MUST_USE_RESULT MaybeObject* AllocateRawTwoByteString( |
| 2005 int length, PretenureFlag pretenure); |
| 2006 |
| 2012 // Initializes a JSObject based on its map. | 2007 // Initializes a JSObject based on its map. |
| 2013 void InitializeJSObjectFromMap(JSObject* obj, | 2008 void InitializeJSObjectFromMap(JSObject* obj, |
| 2014 FixedArray* properties, | 2009 FixedArray* properties, |
| 2015 Map* map); | 2010 Map* map); |
| 2016 void InitializeAllocationMemento(AllocationMemento* memento, | 2011 void InitializeAllocationMemento(AllocationMemento* memento, |
| 2017 AllocationSite* allocation_site); | 2012 AllocationSite* allocation_site); |
| 2018 | 2013 |
| 2019 bool CreateInitialMaps(); | 2014 bool CreateInitialMaps(); |
| 2020 bool CreateInitialObjects(); | 2015 bool CreateInitialObjects(); |
| 2021 | 2016 |
| (...skipping 900 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2922 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2917 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 2923 | 2918 |
| 2924 private: | 2919 private: |
| 2925 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2920 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2926 }; | 2921 }; |
| 2927 #endif // DEBUG | 2922 #endif // DEBUG |
| 2928 | 2923 |
| 2929 } } // namespace v8::internal | 2924 } } // namespace v8::internal |
| 2930 | 2925 |
| 2931 #endif // V8_HEAP_H_ | 2926 #endif // V8_HEAP_H_ |
| OLD | NEW |