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