| 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 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1046 JSFunction* function); | 1046 JSFunction* function); |
| 1047 | 1047 |
| 1048 // Allocate a catch context. | 1048 // Allocate a catch context. |
| 1049 MUST_USE_RESULT MaybeObject* AllocateCatchContext(JSFunction* function, | 1049 MUST_USE_RESULT MaybeObject* AllocateCatchContext(JSFunction* function, |
| 1050 Context* previous, | 1050 Context* previous, |
| 1051 String* name, | 1051 String* name, |
| 1052 Object* thrown_object); | 1052 Object* thrown_object); |
| 1053 // Allocate a 'with' context. | 1053 // Allocate a 'with' context. |
| 1054 MUST_USE_RESULT MaybeObject* AllocateWithContext(JSFunction* function, | 1054 MUST_USE_RESULT MaybeObject* AllocateWithContext(JSFunction* function, |
| 1055 Context* previous, | 1055 Context* previous, |
| 1056 JSObject* extension); | 1056 JSReceiver* extension); |
| 1057 | 1057 |
| 1058 // Allocate a block context. | 1058 // Allocate a block context. |
| 1059 MUST_USE_RESULT MaybeObject* AllocateBlockContext(JSFunction* function, | 1059 MUST_USE_RESULT MaybeObject* AllocateBlockContext(JSFunction* function, |
| 1060 Context* previous, | 1060 Context* previous, |
| 1061 ScopeInfo* info); | 1061 ScopeInfo* info); |
| 1062 | 1062 |
| 1063 // Allocates a new utility object in the old generation. | 1063 // Allocates a new utility object in the old generation. |
| 1064 MUST_USE_RESULT MaybeObject* AllocateStruct(InstanceType type); | 1064 MUST_USE_RESULT MaybeObject* AllocateStruct(InstanceType type); |
| 1065 | 1065 |
| 1066 // Allocates a function initialized with a shared part. | 1066 // Allocates a function initialized with a shared part. |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 void set_native_contexts_list(Object* object) { | 1369 void set_native_contexts_list(Object* object) { |
| 1370 native_contexts_list_ = object; | 1370 native_contexts_list_ = object; |
| 1371 } | 1371 } |
| 1372 Object* native_contexts_list() { return native_contexts_list_; } | 1372 Object* native_contexts_list() { return native_contexts_list_; } |
| 1373 | 1373 |
| 1374 void set_array_buffers_list(Object* object) { | 1374 void set_array_buffers_list(Object* object) { |
| 1375 array_buffers_list_ = object; | 1375 array_buffers_list_ = object; |
| 1376 } | 1376 } |
| 1377 Object* array_buffers_list() { return array_buffers_list_; } | 1377 Object* array_buffers_list() { return array_buffers_list_; } |
| 1378 | 1378 |
| 1379 void set_allocation_sites_list(Object* object) { |
| 1380 allocation_sites_list_ = object; |
| 1381 } |
| 1382 Object* allocation_sites_list() { return allocation_sites_list_; } |
| 1383 Object** allocation_sites_list_address() { return &allocation_sites_list_; } |
| 1379 | 1384 |
| 1380 // Number of mark-sweeps. | 1385 // Number of mark-sweeps. |
| 1381 unsigned int ms_count() { return ms_count_; } | 1386 unsigned int ms_count() { return ms_count_; } |
| 1382 | 1387 |
| 1383 // Iterates over all roots in the heap. | 1388 // Iterates over all roots in the heap. |
| 1384 void IterateRoots(ObjectVisitor* v, VisitMode mode); | 1389 void IterateRoots(ObjectVisitor* v, VisitMode mode); |
| 1385 // Iterates over all strong roots in the heap. | 1390 // Iterates over all strong roots in the heap. |
| 1386 void IterateStrongRoots(ObjectVisitor* v, VisitMode mode); | 1391 void IterateStrongRoots(ObjectVisitor* v, VisitMode mode); |
| 1387 // Iterates over all the other roots in the heap. | 1392 // Iterates over all the other roots in the heap. |
| 1388 void IterateWeakRoots(ObjectVisitor* v, VisitMode mode); | 1393 void IterateWeakRoots(ObjectVisitor* v, VisitMode mode); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1508 MUST_USE_RESULT MaybeObject* CreateInternalizedString( | 1513 MUST_USE_RESULT MaybeObject* CreateInternalizedString( |
| 1509 const char* str, int length, int hash); | 1514 const char* str, int length, int hash); |
| 1510 MUST_USE_RESULT MaybeObject* CreateInternalizedString(String* str); | 1515 MUST_USE_RESULT MaybeObject* CreateInternalizedString(String* str); |
| 1511 | 1516 |
| 1512 // Write barrier support for address[offset] = o. | 1517 // Write barrier support for address[offset] = o. |
| 1513 INLINE(void RecordWrite(Address address, int offset)); | 1518 INLINE(void RecordWrite(Address address, int offset)); |
| 1514 | 1519 |
| 1515 // Write barrier support for address[start : start + len[ = o. | 1520 // Write barrier support for address[start : start + len[ = o. |
| 1516 INLINE(void RecordWrites(Address address, int start, int len)); | 1521 INLINE(void RecordWrites(Address address, int start, int len)); |
| 1517 | 1522 |
| 1518 // Given an address occupied by a live code object, return that object. | |
| 1519 Object* FindCodeObject(Address a); | |
| 1520 | |
| 1521 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT }; | 1523 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT }; |
| 1522 inline HeapState gc_state() { return gc_state_; } | 1524 inline HeapState gc_state() { return gc_state_; } |
| 1523 | 1525 |
| 1524 inline bool IsInGCPostProcessing() { return gc_post_processing_depth_ > 0; } | 1526 inline bool IsInGCPostProcessing() { return gc_post_processing_depth_ > 0; } |
| 1525 | 1527 |
| 1526 #ifdef DEBUG | 1528 #ifdef DEBUG |
| 1527 bool disallow_allocation_failure() { | 1529 bool disallow_allocation_failure() { |
| 1528 return disallow_allocation_failure_; | 1530 return disallow_allocation_failure_; |
| 1529 } | 1531 } |
| 1530 | 1532 |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2038 // by global handles | 2040 // by global handles |
| 2039 intptr_t amount_of_external_allocated_memory_; | 2041 intptr_t amount_of_external_allocated_memory_; |
| 2040 | 2042 |
| 2041 // Caches the amount of external memory registered at the last global gc. | 2043 // Caches the amount of external memory registered at the last global gc. |
| 2042 intptr_t amount_of_external_allocated_memory_at_last_global_gc_; | 2044 intptr_t amount_of_external_allocated_memory_at_last_global_gc_; |
| 2043 | 2045 |
| 2044 // Indicates that an allocation has failed in the old generation since the | 2046 // Indicates that an allocation has failed in the old generation since the |
| 2045 // last GC. | 2047 // last GC. |
| 2046 bool old_gen_exhausted_; | 2048 bool old_gen_exhausted_; |
| 2047 | 2049 |
| 2050 // Weak list heads, threaded through the objects. |
| 2048 Object* native_contexts_list_; | 2051 Object* native_contexts_list_; |
| 2049 | |
| 2050 Object* array_buffers_list_; | 2052 Object* array_buffers_list_; |
| 2053 Object* allocation_sites_list_; |
| 2051 | 2054 |
| 2052 StoreBufferRebuilder store_buffer_rebuilder_; | 2055 StoreBufferRebuilder store_buffer_rebuilder_; |
| 2053 | 2056 |
| 2054 struct StringTypeTable { | 2057 struct StringTypeTable { |
| 2055 InstanceType type; | 2058 InstanceType type; |
| 2056 int size; | 2059 int size; |
| 2057 RootListIndex index; | 2060 RootListIndex index; |
| 2058 }; | 2061 }; |
| 2059 | 2062 |
| 2060 struct ConstantStringTable { | 2063 struct ConstantStringTable { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2190 StoreBufferEvent event); | 2193 StoreBufferEvent event); |
| 2191 | 2194 |
| 2192 // Performs a major collection in the whole heap. | 2195 // Performs a major collection in the whole heap. |
| 2193 void MarkCompact(GCTracer* tracer); | 2196 void MarkCompact(GCTracer* tracer); |
| 2194 | 2197 |
| 2195 // Code to be run before and after mark-compact. | 2198 // Code to be run before and after mark-compact. |
| 2196 void MarkCompactPrologue(); | 2199 void MarkCompactPrologue(); |
| 2197 | 2200 |
| 2198 void ProcessNativeContexts(WeakObjectRetainer* retainer, bool record_slots); | 2201 void ProcessNativeContexts(WeakObjectRetainer* retainer, bool record_slots); |
| 2199 void ProcessArrayBuffers(WeakObjectRetainer* retainer, bool record_slots); | 2202 void ProcessArrayBuffers(WeakObjectRetainer* retainer, bool record_slots); |
| 2203 void ProcessAllocationSites(WeakObjectRetainer* retainer, bool record_slots); |
| 2200 | 2204 |
| 2201 // Called on heap tear-down. | 2205 // Called on heap tear-down. |
| 2202 void TearDownArrayBuffers(); | 2206 void TearDownArrayBuffers(); |
| 2203 | 2207 |
| 2204 // Record statistics before and after garbage collection. | 2208 // Record statistics before and after garbage collection. |
| 2205 void ReportStatisticsBeforeGC(); | 2209 void ReportStatisticsBeforeGC(); |
| 2206 void ReportStatisticsAfterGC(); | 2210 void ReportStatisticsAfterGC(); |
| 2207 | 2211 |
| 2208 // Slow part of scavenge object. | 2212 // Slow part of scavenge object. |
| 2209 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object); | 2213 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object); |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2747 MC_MARK, | 2751 MC_MARK, |
| 2748 MC_SWEEP, | 2752 MC_SWEEP, |
| 2749 MC_SWEEP_NEWSPACE, | 2753 MC_SWEEP_NEWSPACE, |
| 2750 MC_EVACUATE_PAGES, | 2754 MC_EVACUATE_PAGES, |
| 2751 MC_UPDATE_NEW_TO_NEW_POINTERS, | 2755 MC_UPDATE_NEW_TO_NEW_POINTERS, |
| 2752 MC_UPDATE_ROOT_TO_NEW_POINTERS, | 2756 MC_UPDATE_ROOT_TO_NEW_POINTERS, |
| 2753 MC_UPDATE_OLD_TO_NEW_POINTERS, | 2757 MC_UPDATE_OLD_TO_NEW_POINTERS, |
| 2754 MC_UPDATE_POINTERS_TO_EVACUATED, | 2758 MC_UPDATE_POINTERS_TO_EVACUATED, |
| 2755 MC_UPDATE_POINTERS_BETWEEN_EVACUATED, | 2759 MC_UPDATE_POINTERS_BETWEEN_EVACUATED, |
| 2756 MC_UPDATE_MISC_POINTERS, | 2760 MC_UPDATE_MISC_POINTERS, |
| 2757 MC_WEAKMAP_PROCESS, | 2761 MC_WEAKCOLLECTION_PROCESS, |
| 2758 MC_WEAKMAP_CLEAR, | 2762 MC_WEAKCOLLECTION_CLEAR, |
| 2759 MC_FLUSH_CODE, | 2763 MC_FLUSH_CODE, |
| 2760 kNumberOfScopes | 2764 kNumberOfScopes |
| 2761 }; | 2765 }; |
| 2762 | 2766 |
| 2763 Scope(GCTracer* tracer, ScopeId scope) | 2767 Scope(GCTracer* tracer, ScopeId scope) |
| 2764 : tracer_(tracer), | 2768 : tracer_(tracer), |
| 2765 scope_(scope) { | 2769 scope_(scope) { |
| 2766 start_time_ = OS::TimeCurrentMillis(); | 2770 start_time_ = OS::TimeCurrentMillis(); |
| 2767 } | 2771 } |
| 2768 | 2772 |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3087 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 3091 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 3088 | 3092 |
| 3089 private: | 3093 private: |
| 3090 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 3094 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 3091 }; | 3095 }; |
| 3092 #endif // DEBUG | 3096 #endif // DEBUG |
| 3093 | 3097 |
| 3094 } } // namespace v8::internal | 3098 } } // namespace v8::internal |
| 3095 | 3099 |
| 3096 #endif // V8_HEAP_H_ | 3100 #endif // V8_HEAP_H_ |
| OLD | NEW |