| 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 |
| 734 #ifdef DEBUG | 737 #ifdef DEBUG |
| 735 static void Print(); | 738 static void Print(); |
| 736 static void PrintHandles(); | 739 static void PrintHandles(); |
| 737 | 740 |
| 738 // Verify the heap is in its normal state before or after a GC. | 741 // Verify the heap is in its normal state before or after a GC. |
| 739 static void Verify(); | 742 static void Verify(); |
| 740 | 743 |
| 741 // Report heap statistics. | 744 // Report heap statistics. |
| 742 static void ReportHeapStatistics(const char* title); | 745 static void ReportHeapStatistics(const char* title); |
| 743 static void ReportCodeStatistics(const char* title); | 746 static void ReportCodeStatistics(const char* title); |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 > old_gen_promotion_limit_; | 833 > old_gen_promotion_limit_; |
| 831 } | 834 } |
| 832 | 835 |
| 833 // True if we have reached the allocation limit in the old generation that | 836 // True if we have reached the allocation limit in the old generation that |
| 834 // should artificially cause a GC right now. | 837 // should artificially cause a GC right now. |
| 835 static bool OldGenerationAllocationLimitReached() { | 838 static bool OldGenerationAllocationLimitReached() { |
| 836 return (PromotedSpaceSize() + PromotedExternalMemorySize()) | 839 return (PromotedSpaceSize() + PromotedExternalMemorySize()) |
| 837 > old_gen_allocation_limit_; | 840 > old_gen_allocation_limit_; |
| 838 } | 841 } |
| 839 | 842 |
| 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 |
| 840 private: | 863 private: |
| 841 static int semispace_size_; | 864 static int semispace_size_; |
| 842 static int initial_semispace_size_; | 865 static int initial_semispace_size_; |
| 843 static int young_generation_size_; | 866 static int young_generation_size_; |
| 844 static int old_generation_size_; | 867 static int old_generation_size_; |
| 845 | 868 |
| 846 // For keeping track of how much data has survived | 869 // For keeping track of how much data has survived |
| 847 // scavenge since last new space expansion. | 870 // scavenge since last new space expansion. |
| 848 static int survived_since_last_expansion_; | 871 static int survived_since_last_expansion_; |
| 849 | 872 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 // by global handles | 933 // by global handles |
| 911 static int amount_of_external_allocated_memory_; | 934 static int amount_of_external_allocated_memory_; |
| 912 | 935 |
| 913 // Caches the amount of external memory registered at the last global gc. | 936 // Caches the amount of external memory registered at the last global gc. |
| 914 static int amount_of_external_allocated_memory_at_last_global_gc_; | 937 static int amount_of_external_allocated_memory_at_last_global_gc_; |
| 915 | 938 |
| 916 // Indicates that an allocation has failed in the old generation since the | 939 // Indicates that an allocation has failed in the old generation since the |
| 917 // last GC. | 940 // last GC. |
| 918 static int old_gen_exhausted_; | 941 static int old_gen_exhausted_; |
| 919 | 942 |
| 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 | |
| 940 static Object* roots_[kRootListLength]; | 943 static Object* roots_[kRootListLength]; |
| 941 | 944 |
| 942 struct StringTypeTable { | 945 struct StringTypeTable { |
| 943 InstanceType type; | 946 InstanceType type; |
| 944 int size; | 947 int size; |
| 945 RootListIndex index; | 948 RootListIndex index; |
| 946 }; | 949 }; |
| 947 | 950 |
| 948 struct ConstantSymbolTable { | 951 struct ConstantSymbolTable { |
| 949 const char* contents; | 952 const char* contents; |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1467 int marked_count_; | 1470 int marked_count_; |
| 1468 | 1471 |
| 1469 // The count from the end of the previous full GC. Will be zero if there | 1472 // The count from the end of the previous full GC. Will be zero if there |
| 1470 // was no previous full GC. | 1473 // was no previous full GC. |
| 1471 int previous_marked_count_; | 1474 int previous_marked_count_; |
| 1472 }; | 1475 }; |
| 1473 | 1476 |
| 1474 } } // namespace v8::internal | 1477 } } // namespace v8::internal |
| 1475 | 1478 |
| 1476 #endif // V8_HEAP_H_ | 1479 #endif // V8_HEAP_H_ |
| OLD | NEW |