| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 // Returns whether there is a chance that another major GC could | 896 // Returns whether there is a chance that another major GC could |
| 897 // collect more garbage. | 897 // collect more garbage. |
| 898 bool CollectGarbage(AllocationSpace space, GarbageCollector collector); | 898 bool CollectGarbage(AllocationSpace space, GarbageCollector collector); |
| 899 | 899 |
| 900 // Performs garbage collection operation. | 900 // Performs garbage collection operation. |
| 901 // Returns whether there is a chance that another major GC could | 901 // Returns whether there is a chance that another major GC could |
| 902 // collect more garbage. | 902 // collect more garbage. |
| 903 inline bool CollectGarbage(AllocationSpace space); | 903 inline bool CollectGarbage(AllocationSpace space); |
| 904 | 904 |
| 905 static const int kNoGCFlags = 0; | 905 static const int kNoGCFlags = 0; |
| 906 // TODO(gc) we are ignoring this flag | |
| 907 static const int kForceCompactionMask = 1; | 906 static const int kForceCompactionMask = 1; |
| 908 static const int kMakeHeapIterableMask = 2; | 907 static const int kMakeHeapIterableMask = 2; |
| 909 | 908 |
| 910 // Performs a full garbage collection. If (flags & kForceCompactionMask) is | 909 // Performs a full garbage collection. If (flags & kForceCompactionMask) is |
| 911 // non-zero then force compaction. If (flags & kMakeHeapIterableMask) is non- | 910 // non-zero then force compaction. If (flags & kMakeHeapIterableMask) is non- |
| 912 // zero, then the slower precise sweeper is used, which leaves the heap in a | 911 // zero, then the slower precise sweeper is used, which leaves the heap in a |
| 913 // state where we can iterate over the heap visiting all objects. | 912 // state where we can iterate over the heap visiting all objects. |
| 914 void CollectAllGarbage(int flags); | 913 void CollectAllGarbage(int flags); |
| 915 | 914 |
| 916 // Ensure that we have swept all spaces in such a way that we can iterate | 915 // Ensure that we have swept all spaces in such a way that we can iterate |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 ASSERT((callback == NULL) ^ (global_gc_prologue_callback_ == NULL)); | 959 ASSERT((callback == NULL) ^ (global_gc_prologue_callback_ == NULL)); |
| 961 global_gc_prologue_callback_ = callback; | 960 global_gc_prologue_callback_ = callback; |
| 962 } | 961 } |
| 963 void SetGlobalGCEpilogueCallback(GCCallback callback) { | 962 void SetGlobalGCEpilogueCallback(GCCallback callback) { |
| 964 ASSERT((callback == NULL) ^ (global_gc_epilogue_callback_ == NULL)); | 963 ASSERT((callback == NULL) ^ (global_gc_epilogue_callback_ == NULL)); |
| 965 global_gc_epilogue_callback_ = callback; | 964 global_gc_epilogue_callback_ = callback; |
| 966 } | 965 } |
| 967 | 966 |
| 968 // Heap root getters. We have versions with and without type::cast() here. | 967 // Heap root getters. We have versions with and without type::cast() here. |
| 969 // You can't use type::cast during GC because the assert fails. | 968 // You can't use type::cast during GC because the assert fails. |
| 970 // TODO(gc): Try removing the unchecked accessors, now that GC marking does | 969 // TODO(1490): Try removing the unchecked accessors, now that GC marking does |
| 971 // not corrupt the stack. | 970 // not corrupt the stack. |
| 972 #define ROOT_ACCESSOR(type, name, camel_name) \ | 971 #define ROOT_ACCESSOR(type, name, camel_name) \ |
| 973 type* name() { \ | 972 type* name() { \ |
| 974 return type::cast(roots_[k##camel_name##RootIndex]); \ | 973 return type::cast(roots_[k##camel_name##RootIndex]); \ |
| 975 } \ | 974 } \ |
| 976 type* raw_unchecked_##name() { \ | 975 type* raw_unchecked_##name() { \ |
| 977 return reinterpret_cast<type*>(roots_[k##camel_name##RootIndex]); \ | 976 return reinterpret_cast<type*>(roots_[k##camel_name##RootIndex]); \ |
| 978 } | 977 } |
| 979 ROOT_LIST(ROOT_ACCESSOR) | 978 ROOT_LIST(ROOT_ACCESSOR) |
| 980 #undef ROOT_ACCESSOR | 979 #undef ROOT_ACCESSOR |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1355 } | 1354 } |
| 1356 | 1355 |
| 1357 StoreBuffer* store_buffer() { | 1356 StoreBuffer* store_buffer() { |
| 1358 return &store_buffer_; | 1357 return &store_buffer_; |
| 1359 } | 1358 } |
| 1360 | 1359 |
| 1361 Marking* marking() { | 1360 Marking* marking() { |
| 1362 return &marking_; | 1361 return &marking_; |
| 1363 } | 1362 } |
| 1364 | 1363 |
| 1365 // TODO(gc) Rename to IncrementalMarker after merge. | |
| 1366 IncrementalMarking* incremental_marking() { | 1364 IncrementalMarking* incremental_marking() { |
| 1367 return &incremental_marking_; | 1365 return &incremental_marking_; |
| 1368 } | 1366 } |
| 1369 | 1367 |
| 1370 ExternalStringTable* external_string_table() { | 1368 ExternalStringTable* external_string_table() { |
| 1371 return &external_string_table_; | 1369 return &external_string_table_; |
| 1372 } | 1370 } |
| 1373 | 1371 |
| 1374 // Returns the current sweep generation. | 1372 // Returns the current sweep generation. |
| 1375 int sweep_generation() { | 1373 int sweep_generation() { |
| (...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2423 | 2421 |
| 2424 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2422 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 2425 }; | 2423 }; |
| 2426 #endif // DEBUG || LIVE_OBJECT_LIST | 2424 #endif // DEBUG || LIVE_OBJECT_LIST |
| 2427 | 2425 |
| 2428 } } // namespace v8::internal | 2426 } } // namespace v8::internal |
| 2429 | 2427 |
| 2430 #undef HEAP | 2428 #undef HEAP |
| 2431 | 2429 |
| 2432 #endif // V8_HEAP_H_ | 2430 #endif // V8_HEAP_H_ |
| OLD | NEW |