OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HEAP_HEAP_H_ | 5 #ifndef V8_HEAP_HEAP_H_ |
6 #define V8_HEAP_HEAP_H_ | 6 #define V8_HEAP_HEAP_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 | 876 |
877 inline void decrement_scan_on_scavenge_pages() { | 877 inline void decrement_scan_on_scavenge_pages() { |
878 scan_on_scavenge_pages_--; | 878 scan_on_scavenge_pages_--; |
879 if (FLAG_gc_verbose) { | 879 if (FLAG_gc_verbose) { |
880 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_); | 880 PrintF("Scan-on-scavenge pages: %d\n", scan_on_scavenge_pages_); |
881 } | 881 } |
882 } | 882 } |
883 | 883 |
884 PromotionQueue* promotion_queue() { return &promotion_queue_; } | 884 PromotionQueue* promotion_queue() { return &promotion_queue_; } |
885 | 885 |
886 void AddGCPrologueCallback(v8::Isolate::GCPrologueCallback callback, | 886 void AddGCPrologueCallback(v8::Isolate::GCCallback callback, |
887 GCType gc_type_filter, bool pass_isolate = true); | 887 GCType gc_type_filter, bool pass_isolate = true); |
888 void RemoveGCPrologueCallback(v8::Isolate::GCPrologueCallback callback); | 888 void RemoveGCPrologueCallback(v8::Isolate::GCCallback callback); |
889 | 889 |
890 void AddGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback, | 890 void AddGCEpilogueCallback(v8::Isolate::GCCallback callback, |
891 GCType gc_type_filter, bool pass_isolate = true); | 891 GCType gc_type_filter, bool pass_isolate = true); |
892 void RemoveGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback); | 892 void RemoveGCEpilogueCallback(v8::Isolate::GCCallback callback); |
893 | 893 |
894 // Heap root getters. We have versions with and without type::cast() here. | 894 // Heap root getters. We have versions with and without type::cast() here. |
895 // You can't use type::cast during GC because the assert fails. | 895 // You can't use type::cast during GC because the assert fails. |
896 // TODO(1490): Try removing the unchecked accessors, now that GC marking does | 896 // TODO(1490): Try removing the unchecked accessors, now that GC marking does |
897 // not corrupt the map. | 897 // not corrupt the map. |
898 #define ROOT_ACCESSOR(type, name, camel_name) \ | 898 #define ROOT_ACCESSOR(type, name, camel_name) \ |
899 type* name() { return type::cast(roots_[k##camel_name##RootIndex]); } \ | 899 type* name() { return type::cast(roots_[k##camel_name##RootIndex]); } \ |
900 type* raw_unchecked_##name() { \ | 900 type* raw_unchecked_##name() { \ |
901 return reinterpret_cast<type*>(roots_[k##camel_name##RootIndex]); \ | 901 return reinterpret_cast<type*>(roots_[k##camel_name##RootIndex]); \ |
902 } | 902 } |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1851 static const StringTypeTable string_type_table[]; | 1851 static const StringTypeTable string_type_table[]; |
1852 static const ConstantStringTable constant_string_table[]; | 1852 static const ConstantStringTable constant_string_table[]; |
1853 static const StructTable struct_table[]; | 1853 static const StructTable struct_table[]; |
1854 | 1854 |
1855 // The special hidden string which is an empty string, but does not match | 1855 // The special hidden string which is an empty string, but does not match |
1856 // any string when looked up in properties. | 1856 // any string when looked up in properties. |
1857 String* hidden_string_; | 1857 String* hidden_string_; |
1858 | 1858 |
1859 void AddPrivateGlobalSymbols(Handle<Object> private_intern_table); | 1859 void AddPrivateGlobalSymbols(Handle<Object> private_intern_table); |
1860 | 1860 |
1861 // GC callback function, called before and after mark-compact GC. | 1861 struct GCCallbackPair { |
1862 // Allocations in the callback function are disallowed. | 1862 GCCallbackPair(v8::Isolate::GCCallback callback, GCType gc_type, |
1863 struct GCPrologueCallbackPair { | 1863 bool pass_isolate) |
1864 GCPrologueCallbackPair(v8::Isolate::GCPrologueCallback callback, | 1864 : callback(callback), gc_type(gc_type), pass_isolate(pass_isolate) {} |
1865 GCType gc_type, bool pass_isolate) | 1865 |
1866 : callback(callback), gc_type(gc_type), pass_isolate_(pass_isolate) {} | 1866 bool operator==(const GCCallbackPair& other) const { |
1867 bool operator==(const GCPrologueCallbackPair& pair) const { | 1867 return other.callback == callback; |
1868 return pair.callback == callback; | |
1869 } | 1868 } |
1870 v8::Isolate::GCPrologueCallback callback; | 1869 |
| 1870 v8::Isolate::GCCallback callback; |
1871 GCType gc_type; | 1871 GCType gc_type; |
1872 // TODO(dcarney): remove variable | 1872 bool pass_isolate; |
1873 bool pass_isolate_; | |
1874 }; | 1873 }; |
1875 List<GCPrologueCallbackPair> gc_prologue_callbacks_; | |
1876 | 1874 |
1877 struct GCEpilogueCallbackPair { | 1875 List<GCCallbackPair> gc_epilogue_callbacks_; |
1878 GCEpilogueCallbackPair(v8::Isolate::GCPrologueCallback callback, | 1876 List<GCCallbackPair> gc_prologue_callbacks_; |
1879 GCType gc_type, bool pass_isolate) | |
1880 : callback(callback), gc_type(gc_type), pass_isolate_(pass_isolate) {} | |
1881 bool operator==(const GCEpilogueCallbackPair& pair) const { | |
1882 return pair.callback == callback; | |
1883 } | |
1884 v8::Isolate::GCPrologueCallback callback; | |
1885 GCType gc_type; | |
1886 // TODO(dcarney): remove variable | |
1887 bool pass_isolate_; | |
1888 }; | |
1889 List<GCEpilogueCallbackPair> gc_epilogue_callbacks_; | |
1890 | 1877 |
1891 // Code that should be run before and after each GC. Includes some | 1878 // Code that should be run before and after each GC. Includes some |
1892 // reporting/verification activities when compiled with DEBUG set. | 1879 // reporting/verification activities when compiled with DEBUG set. |
1893 void GarbageCollectionPrologue(); | 1880 void GarbageCollectionPrologue(); |
1894 void GarbageCollectionEpilogue(); | 1881 void GarbageCollectionEpilogue(); |
1895 | 1882 |
1896 void PreprocessStackTraces(); | 1883 void PreprocessStackTraces(); |
1897 | 1884 |
1898 // Pretenuring decisions are made based on feedback collected during new | 1885 // Pretenuring decisions are made based on feedback collected during new |
1899 // space evacuation. Note that between feedback collection and calling this | 1886 // space evacuation. Note that between feedback collection and calling this |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2763 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2750 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2764 | 2751 |
2765 private: | 2752 private: |
2766 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2753 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2767 }; | 2754 }; |
2768 #endif // DEBUG | 2755 #endif // DEBUG |
2769 } | 2756 } |
2770 } // namespace v8::internal | 2757 } // namespace v8::internal |
2771 | 2758 |
2772 #endif // V8_HEAP_HEAP_H_ | 2759 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |