OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 | 1490 |
1491 // Attempt to find the number in a small cache. If we finds it, return | 1491 // Attempt to find the number in a small cache. If we finds it, return |
1492 // the string representation of the number. Otherwise return undefined. | 1492 // the string representation of the number. Otherwise return undefined. |
1493 Object* GetNumberStringCache(Object* number); | 1493 Object* GetNumberStringCache(Object* number); |
1494 | 1494 |
1495 // Update the cache with a new number-string pair. | 1495 // Update the cache with a new number-string pair. |
1496 void SetNumberStringCache(Object* number, String* str); | 1496 void SetNumberStringCache(Object* number, String* str); |
1497 | 1497 |
1498 // Adjusts the amount of registered external memory. | 1498 // Adjusts the amount of registered external memory. |
1499 // Returns the adjusted value. | 1499 // Returns the adjusted value. |
1500 inline intptr_t AdjustAmountOfExternalAllocatedMemory( | 1500 inline int64_t AdjustAmountOfExternalAllocatedMemory( |
1501 intptr_t change_in_bytes); | 1501 int64_t change_in_bytes); |
1502 | 1502 |
1503 // This is only needed for testing high promotion mode. | 1503 // This is only needed for testing high promotion mode. |
1504 void SetNewSpaceHighPromotionModeActive(bool mode) { | 1504 void SetNewSpaceHighPromotionModeActive(bool mode) { |
1505 new_space_high_promotion_mode_active_ = mode; | 1505 new_space_high_promotion_mode_active_ = mode; |
1506 } | 1506 } |
1507 | 1507 |
1508 // Returns the allocation mode (pre-tenuring) based on observed promotion | 1508 // Returns the allocation mode (pre-tenuring) based on observed promotion |
1509 // rates of previous collections. | 1509 // rates of previous collections. |
1510 inline PretenureFlag GetPretenureMode() { | 1510 inline PretenureFlag GetPretenureMode() { |
1511 return FLAG_pretenuring && new_space_high_promotion_mode_active_ | 1511 return FLAG_pretenuring && new_space_high_promotion_mode_active_ |
1512 ? TENURED : NOT_TENURED; | 1512 ? TENURED : NOT_TENURED; |
1513 } | 1513 } |
1514 | 1514 |
1515 inline Address* NewSpaceHighPromotionModeActiveAddress() { | 1515 inline Address* NewSpaceHighPromotionModeActiveAddress() { |
1516 return reinterpret_cast<Address*>(&new_space_high_promotion_mode_active_); | 1516 return reinterpret_cast<Address*>(&new_space_high_promotion_mode_active_); |
1517 } | 1517 } |
1518 | 1518 |
1519 inline intptr_t PromotedTotalSize() { | 1519 inline intptr_t PromotedTotalSize() { |
1520 return PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); | 1520 int64_t total = PromotedSpaceSizeOfObjects() + PromotedExternalMemorySize(); |
| 1521 if (total > kMaxInt) return static_cast<intptr_t>(kMaxInt); |
| 1522 if (total < 0) return 0; |
| 1523 return static_cast<intptr_t>(total); |
1521 } | 1524 } |
1522 | 1525 |
1523 inline intptr_t OldGenerationSpaceAvailable() { | 1526 inline intptr_t OldGenerationSpaceAvailable() { |
1524 return old_generation_allocation_limit_ - PromotedTotalSize(); | 1527 return old_generation_allocation_limit_ - PromotedTotalSize(); |
1525 } | 1528 } |
1526 | 1529 |
1527 inline intptr_t OldGenerationCapacityAvailable() { | 1530 inline intptr_t OldGenerationCapacityAvailable() { |
1528 return max_old_generation_size_ - PromotedTotalSize(); | 1531 return max_old_generation_size_ - PromotedTotalSize(); |
1529 } | 1532 } |
1530 | 1533 |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1923 OldSpace* old_data_space_; | 1926 OldSpace* old_data_space_; |
1924 OldSpace* code_space_; | 1927 OldSpace* code_space_; |
1925 MapSpace* map_space_; | 1928 MapSpace* map_space_; |
1926 CellSpace* cell_space_; | 1929 CellSpace* cell_space_; |
1927 PropertyCellSpace* property_cell_space_; | 1930 PropertyCellSpace* property_cell_space_; |
1928 LargeObjectSpace* lo_space_; | 1931 LargeObjectSpace* lo_space_; |
1929 HeapState gc_state_; | 1932 HeapState gc_state_; |
1930 int gc_post_processing_depth_; | 1933 int gc_post_processing_depth_; |
1931 | 1934 |
1932 // Returns the amount of external memory registered since last global gc. | 1935 // Returns the amount of external memory registered since last global gc. |
1933 intptr_t PromotedExternalMemorySize(); | 1936 int64_t PromotedExternalMemorySize(); |
1934 | 1937 |
1935 unsigned int ms_count_; // how many mark-sweep collections happened | 1938 unsigned int ms_count_; // how many mark-sweep collections happened |
1936 unsigned int gc_count_; // how many gc happened | 1939 unsigned int gc_count_; // how many gc happened |
1937 | 1940 |
1938 // For post mortem debugging. | 1941 // For post mortem debugging. |
1939 static const int kRememberedUnmappedPages = 128; | 1942 static const int kRememberedUnmappedPages = 128; |
1940 int remembered_unmapped_pages_index_; | 1943 int remembered_unmapped_pages_index_; |
1941 Address remembered_unmapped_pages_[kRememberedUnmappedPages]; | 1944 Address remembered_unmapped_pages_[kRememberedUnmappedPages]; |
1942 | 1945 |
1943 // Total length of the strings we failed to flatten since the last GC. | 1946 // Total length of the strings we failed to flatten since the last GC. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1977 | 1980 |
1978 // Used to adjust the limits that control the timing of the next GC. | 1981 // Used to adjust the limits that control the timing of the next GC. |
1979 intptr_t size_of_old_gen_at_last_old_space_gc_; | 1982 intptr_t size_of_old_gen_at_last_old_space_gc_; |
1980 | 1983 |
1981 // Limit on the amount of externally allocated memory allowed | 1984 // Limit on the amount of externally allocated memory allowed |
1982 // between global GCs. If reached a global GC is forced. | 1985 // between global GCs. If reached a global GC is forced. |
1983 intptr_t external_allocation_limit_; | 1986 intptr_t external_allocation_limit_; |
1984 | 1987 |
1985 // The amount of external memory registered through the API kept alive | 1988 // The amount of external memory registered through the API kept alive |
1986 // by global handles | 1989 // by global handles |
1987 intptr_t amount_of_external_allocated_memory_; | 1990 int64_t amount_of_external_allocated_memory_; |
1988 | 1991 |
1989 // Caches the amount of external memory registered at the last global gc. | 1992 // Caches the amount of external memory registered at the last global gc. |
1990 intptr_t amount_of_external_allocated_memory_at_last_global_gc_; | 1993 int64_t amount_of_external_allocated_memory_at_last_global_gc_; |
1991 | 1994 |
1992 // Indicates that an allocation has failed in the old generation since the | 1995 // Indicates that an allocation has failed in the old generation since the |
1993 // last GC. | 1996 // last GC. |
1994 bool old_gen_exhausted_; | 1997 bool old_gen_exhausted_; |
1995 | 1998 |
1996 // Weak list heads, threaded through the objects. | 1999 // Weak list heads, threaded through the objects. |
1997 // List heads are initilized lazily and contain the undefined_value at start. | 2000 // List heads are initilized lazily and contain the undefined_value at start. |
1998 Object* native_contexts_list_; | 2001 Object* native_contexts_list_; |
1999 Object* array_buffers_list_; | 2002 Object* array_buffers_list_; |
2000 Object* allocation_sites_list_; | 2003 Object* allocation_sites_list_; |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3079 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 3082 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
3080 | 3083 |
3081 private: | 3084 private: |
3082 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 3085 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
3083 }; | 3086 }; |
3084 #endif // DEBUG | 3087 #endif // DEBUG |
3085 | 3088 |
3086 } } // namespace v8::internal | 3089 } } // namespace v8::internal |
3087 | 3090 |
3088 #endif // V8_HEAP_H_ | 3091 #endif // V8_HEAP_H_ |
OLD | NEW |