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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
878 // A cache is used for ASCII codes. | 878 // A cache is used for ASCII codes. |
879 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 879 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
880 // failed. Please note this does not perform a garbage collection. | 880 // failed. Please note this does not perform a garbage collection. |
881 MUST_USE_RESULT MaybeObject* LookupSingleCharacterStringFromCode( | 881 MUST_USE_RESULT MaybeObject* LookupSingleCharacterStringFromCode( |
882 uint16_t code); | 882 uint16_t code); |
883 | 883 |
884 // Allocate a byte array of the specified length | 884 // Allocate a byte array of the specified length |
885 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 885 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
886 // failed. | 886 // failed. |
887 // Please note this does not perform a garbage collection. | 887 // Please note this does not perform a garbage collection. |
888 MUST_USE_RESULT MaybeObject* AllocateByteArray(int length, | 888 MUST_USE_RESULT MaybeObject* AllocateByteArray( |
889 PretenureFlag pretenure); | 889 int length, |
890 | 890 PretenureFlag pretenure = NOT_TENURED); |
891 // Allocate a non-tenured byte array of the specified length | |
892 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | |
893 // failed. | |
894 // Please note this does not perform a garbage collection. | |
895 MUST_USE_RESULT MaybeObject* AllocateByteArray(int length); | |
896 | 891 |
897 // Allocates an external array of the specified length and type. | 892 // Allocates an external array of the specified length and type. |
898 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 893 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
899 // failed. | 894 // failed. |
900 // Please note this does not perform a garbage collection. | 895 // Please note this does not perform a garbage collection. |
901 MUST_USE_RESULT MaybeObject* AllocateExternalArray( | 896 MUST_USE_RESULT MaybeObject* AllocateExternalArray( |
902 int length, | 897 int length, |
903 ExternalArrayType array_type, | 898 ExternalArrayType array_type, |
904 void* external_pointer, | 899 void* external_pointer, |
905 PretenureFlag pretenure); | 900 PretenureFlag pretenure); |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2078 const char** reason); | 2073 const char** reason); |
2079 | 2074 |
2080 // Performs garbage collection | 2075 // Performs garbage collection |
2081 // Returns whether there is a chance another major GC could | 2076 // Returns whether there is a chance another major GC could |
2082 // collect more garbage. | 2077 // collect more garbage. |
2083 bool PerformGarbageCollection(GarbageCollector collector, | 2078 bool PerformGarbageCollection(GarbageCollector collector, |
2084 GCTracer* tracer); | 2079 GCTracer* tracer); |
2085 | 2080 |
2086 inline void UpdateOldSpaceLimits(); | 2081 inline void UpdateOldSpaceLimits(); |
2087 | 2082 |
2083 // Selects the proper allocation space depending on the given object | |
2084 // size and the given pretenuring decision. | |
Hannes Payer (out of office)
2013/08/20 09:49:19
... and the given preferred old space if old data
Michael Starzinger
2013/09/23 11:35:05
Done.
| |
2085 static AllocationSpace SelectSpace(int object_size, | |
2086 AllocationSpace preferred_old_space, | |
2087 PretenureFlag pretenure) { | |
2088 ASSERT(preferred_old_space == OLD_POINTER_SPACE || | |
2089 preferred_old_space == OLD_DATA_SPACE); | |
2090 if (object_size > Page::kMaxNonCodeHeapObjectSize) return LO_SPACE; | |
2091 return (pretenure == TENURED) ? preferred_old_space : NEW_SPACE; | |
2092 } | |
2093 | |
2088 // Allocate an uninitialized object in map space. The behavior is identical | 2094 // Allocate an uninitialized object in map space. The behavior is identical |
2089 // to Heap::AllocateRaw(size_in_bytes, MAP_SPACE), except that (a) it doesn't | 2095 // to Heap::AllocateRaw(size_in_bytes, MAP_SPACE), except that (a) it doesn't |
2090 // have to test the allocation space argument and (b) can reduce code size | 2096 // have to test the allocation space argument and (b) can reduce code size |
2091 // (since both AllocateRaw and AllocateRawMap are inlined). | 2097 // (since both AllocateRaw and AllocateRawMap are inlined). |
2092 MUST_USE_RESULT inline MaybeObject* AllocateRawMap(); | 2098 MUST_USE_RESULT inline MaybeObject* AllocateRawMap(); |
2093 | 2099 |
2094 // Allocate an uninitialized object in the simple cell space. | 2100 // Allocate an uninitialized object in the simple cell space. |
2095 MUST_USE_RESULT inline MaybeObject* AllocateRawCell(); | 2101 MUST_USE_RESULT inline MaybeObject* AllocateRawCell(); |
2096 | 2102 |
2097 // Allocate an uninitialized object in the global property cell space. | 2103 // Allocate an uninitialized object in the global property cell space. |
(...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3044 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 3050 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
3045 | 3051 |
3046 private: | 3052 private: |
3047 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 3053 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
3048 }; | 3054 }; |
3049 #endif // DEBUG | 3055 #endif // DEBUG |
3050 | 3056 |
3051 } } // namespace v8::internal | 3057 } } // namespace v8::internal |
3052 | 3058 |
3053 #endif // V8_HEAP_H_ | 3059 #endif // V8_HEAP_H_ |
OLD | NEW |