OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 } | 724 } |
725 | 725 |
726 // Sets the non_monomorphic_cache_ (only used when expanding the dictionary). | 726 // Sets the non_monomorphic_cache_ (only used when expanding the dictionary). |
727 static void public_set_non_monomorphic_cache(NumberDictionary* value) { | 727 static void public_set_non_monomorphic_cache(NumberDictionary* value) { |
728 roots_[kNonMonomorphicCacheRootIndex] = value; | 728 roots_[kNonMonomorphicCacheRootIndex] = value; |
729 } | 729 } |
730 | 730 |
731 // Update the next script id. | 731 // Update the next script id. |
732 static inline void SetLastScriptId(Object* last_script_id); | 732 static inline void SetLastScriptId(Object* last_script_id); |
733 | 733 |
734 // Generated code can embed this address to get access to the roots. | |
735 static Object** roots_address() { return roots_; } | |
736 | |
737 #ifdef DEBUG | 734 #ifdef DEBUG |
738 static void Print(); | 735 static void Print(); |
739 static void PrintHandles(); | 736 static void PrintHandles(); |
740 | 737 |
741 // Verify the heap is in its normal state before or after a GC. | 738 // Verify the heap is in its normal state before or after a GC. |
742 static void Verify(); | 739 static void Verify(); |
743 | 740 |
744 // Report heap statistics. | 741 // Report heap statistics. |
745 static void ReportHeapStatistics(const char* title); | 742 static void ReportHeapStatistics(const char* title); |
746 static void ReportCodeStatistics(const char* title); | 743 static void ReportCodeStatistics(const char* title); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 > old_gen_promotion_limit_; | 830 > old_gen_promotion_limit_; |
834 } | 831 } |
835 | 832 |
836 // True if we have reached the allocation limit in the old generation that | 833 // True if we have reached the allocation limit in the old generation that |
837 // should artificially cause a GC right now. | 834 // should artificially cause a GC right now. |
838 static bool OldGenerationAllocationLimitReached() { | 835 static bool OldGenerationAllocationLimitReached() { |
839 return (PromotedSpaceSize() + PromotedExternalMemorySize()) | 836 return (PromotedSpaceSize() + PromotedExternalMemorySize()) |
840 > old_gen_allocation_limit_; | 837 > old_gen_allocation_limit_; |
841 } | 838 } |
842 | 839 |
843 // Declare all the root indices. | |
844 enum RootListIndex { | |
845 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, | |
846 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) | |
847 #undef ROOT_INDEX_DECLARATION | |
848 | |
849 // Utility type maps | |
850 #define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex, | |
851 STRUCT_LIST(DECLARE_STRUCT_MAP) | |
852 #undef DECLARE_STRUCT_MAP | |
853 | |
854 #define SYMBOL_INDEX_DECLARATION(name, str) k##name##RootIndex, | |
855 SYMBOL_LIST(SYMBOL_INDEX_DECLARATION) | |
856 #undef SYMBOL_DECLARATION | |
857 | |
858 kSymbolTableRootIndex, | |
859 kStrongRootListLength = kSymbolTableRootIndex, | |
860 kRootListLength | |
861 }; | |
862 | |
863 private: | 840 private: |
864 static int semispace_size_; | 841 static int semispace_size_; |
865 static int initial_semispace_size_; | 842 static int initial_semispace_size_; |
866 static int young_generation_size_; | 843 static int young_generation_size_; |
867 static int old_generation_size_; | 844 static int old_generation_size_; |
868 | 845 |
869 // For keeping track of how much data has survived | 846 // For keeping track of how much data has survived |
870 // scavenge since last new space expansion. | 847 // scavenge since last new space expansion. |
871 static int survived_since_last_expansion_; | 848 static int survived_since_last_expansion_; |
872 | 849 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
933 // by global handles | 910 // by global handles |
934 static int amount_of_external_allocated_memory_; | 911 static int amount_of_external_allocated_memory_; |
935 | 912 |
936 // Caches the amount of external memory registered at the last global gc. | 913 // Caches the amount of external memory registered at the last global gc. |
937 static int amount_of_external_allocated_memory_at_last_global_gc_; | 914 static int amount_of_external_allocated_memory_at_last_global_gc_; |
938 | 915 |
939 // Indicates that an allocation has failed in the old generation since the | 916 // Indicates that an allocation has failed in the old generation since the |
940 // last GC. | 917 // last GC. |
941 static int old_gen_exhausted_; | 918 static int old_gen_exhausted_; |
942 | 919 |
| 920 // Declare all the root indices. |
| 921 enum RootListIndex { |
| 922 #define ROOT_INDEX_DECLARATION(type, name, camel_name) k##camel_name##RootIndex, |
| 923 STRONG_ROOT_LIST(ROOT_INDEX_DECLARATION) |
| 924 #undef ROOT_INDEX_DECLARATION |
| 925 |
| 926 // Utility type maps |
| 927 #define DECLARE_STRUCT_MAP(NAME, Name, name) k##Name##MapRootIndex, |
| 928 STRUCT_LIST(DECLARE_STRUCT_MAP) |
| 929 #undef DECLARE_STRUCT_MAP |
| 930 |
| 931 #define SYMBOL_INDEX_DECLARATION(name, str) k##name##RootIndex, |
| 932 SYMBOL_LIST(SYMBOL_INDEX_DECLARATION) |
| 933 #undef SYMBOL_DECLARATION |
| 934 |
| 935 kSymbolTableRootIndex, |
| 936 kStrongRootListLength = kSymbolTableRootIndex, |
| 937 kRootListLength |
| 938 }; |
| 939 |
943 static Object* roots_[kRootListLength]; | 940 static Object* roots_[kRootListLength]; |
944 | 941 |
945 struct StringTypeTable { | 942 struct StringTypeTable { |
946 InstanceType type; | 943 InstanceType type; |
947 int size; | 944 int size; |
948 RootListIndex index; | 945 RootListIndex index; |
949 }; | 946 }; |
950 | 947 |
951 struct ConstantSymbolTable { | 948 struct ConstantSymbolTable { |
952 const char* contents; | 949 const char* contents; |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1470 int marked_count_; | 1467 int marked_count_; |
1471 | 1468 |
1472 // The count from the end of the previous full GC. Will be zero if there | 1469 // The count from the end of the previous full GC. Will be zero if there |
1473 // was no previous full GC. | 1470 // was no previous full GC. |
1474 int previous_marked_count_; | 1471 int previous_marked_count_; |
1475 }; | 1472 }; |
1476 | 1473 |
1477 } } // namespace v8::internal | 1474 } } // namespace v8::internal |
1478 | 1475 |
1479 #endif // V8_HEAP_H_ | 1476 #endif // V8_HEAP_H_ |
OLD | NEW |