| 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 1398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 return FLAG_verify_heap; | 1409 return FLAG_verify_heap; |
| 1410 #else | 1410 #else |
| 1411 return false; | 1411 return false; |
| 1412 #endif | 1412 #endif |
| 1413 #endif | 1413 #endif |
| 1414 } | 1414 } |
| 1415 | 1415 |
| 1416 // Print short heap statistics. | 1416 // Print short heap statistics. |
| 1417 void PrintShortHeapStatistics(); | 1417 void PrintShortHeapStatistics(); |
| 1418 | 1418 |
| 1419 // Makes a new internalized string object | |
| 1420 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | |
| 1421 // failed. | |
| 1422 // Please note this function does not perform a garbage collection. | |
| 1423 MUST_USE_RESULT MaybeObject* CreateInternalizedString( | |
| 1424 const char* str, int length, int hash); | |
| 1425 MUST_USE_RESULT MaybeObject* CreateInternalizedString(String* str); | |
| 1426 | |
| 1427 // Write barrier support for address[offset] = o. | 1419 // Write barrier support for address[offset] = o. |
| 1428 INLINE(void RecordWrite(Address address, int offset)); | 1420 INLINE(void RecordWrite(Address address, int offset)); |
| 1429 | 1421 |
| 1430 // Write barrier support for address[start : start + len[ = o. | 1422 // Write barrier support for address[start : start + len[ = o. |
| 1431 INLINE(void RecordWrites(Address address, int start, int len)); | 1423 INLINE(void RecordWrites(Address address, int start, int len)); |
| 1432 | 1424 |
| 1433 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT }; | 1425 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT }; |
| 1434 inline HeapState gc_state() { return gc_state_; } | 1426 inline HeapState gc_state() { return gc_state_; } |
| 1435 | 1427 |
| 1436 inline bool IsInGCPostProcessing() { return gc_post_processing_depth_ > 0; } | 1428 inline bool IsInGCPostProcessing() { return gc_post_processing_depth_ > 0; } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1449 void TracePathToGlobal(); | 1441 void TracePathToGlobal(); |
| 1450 #endif | 1442 #endif |
| 1451 | 1443 |
| 1452 // Callback function passed to Heap::Iterate etc. Copies an object if | 1444 // Callback function passed to Heap::Iterate etc. Copies an object if |
| 1453 // necessary, the object might be promoted to an old space. The caller must | 1445 // necessary, the object might be promoted to an old space. The caller must |
| 1454 // ensure the precondition that the object is (a) a heap object and (b) in | 1446 // ensure the precondition that the object is (a) a heap object and (b) in |
| 1455 // the heap's from space. | 1447 // the heap's from space. |
| 1456 static inline void ScavengePointer(HeapObject** p); | 1448 static inline void ScavengePointer(HeapObject** p); |
| 1457 static inline void ScavengeObject(HeapObject** p, HeapObject* object); | 1449 static inline void ScavengeObject(HeapObject** p, HeapObject* object); |
| 1458 | 1450 |
| 1451 // An object may have an AllocationSite associated with it through a trailing |
| 1452 // AllocationMemento. Its feedback should be updated when objects are found |
| 1453 // in the heap. |
| 1454 static inline void UpdateAllocationSiteFeedback(HeapObject* object); |
| 1455 |
| 1459 // Support for partial snapshots. After calling this we have a linear | 1456 // Support for partial snapshots. After calling this we have a linear |
| 1460 // space to write objects in each space. | 1457 // space to write objects in each space. |
| 1461 void ReserveSpace(int *sizes, Address* addresses); | 1458 void ReserveSpace(int *sizes, Address* addresses); |
| 1462 | 1459 |
| 1463 // | 1460 // |
| 1464 // Support for the API. | 1461 // Support for the API. |
| 1465 // | 1462 // |
| 1466 | 1463 |
| 1467 bool CreateApiObjects(); | 1464 bool CreateApiObjects(); |
| 1468 | 1465 |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1885 int always_allocate_scope_depth_; | 1882 int always_allocate_scope_depth_; |
| 1886 int linear_allocation_scope_depth_; | 1883 int linear_allocation_scope_depth_; |
| 1887 | 1884 |
| 1888 // For keeping track of context disposals. | 1885 // For keeping track of context disposals. |
| 1889 int contexts_disposed_; | 1886 int contexts_disposed_; |
| 1890 | 1887 |
| 1891 int global_ic_age_; | 1888 int global_ic_age_; |
| 1892 | 1889 |
| 1893 bool flush_monomorphic_ics_; | 1890 bool flush_monomorphic_ics_; |
| 1894 | 1891 |
| 1895 // AllocationMementos found in new space. | |
| 1896 int allocation_mementos_found_; | |
| 1897 | |
| 1898 int scan_on_scavenge_pages_; | 1892 int scan_on_scavenge_pages_; |
| 1899 | 1893 |
| 1900 NewSpace new_space_; | 1894 NewSpace new_space_; |
| 1901 OldSpace* old_pointer_space_; | 1895 OldSpace* old_pointer_space_; |
| 1902 OldSpace* old_data_space_; | 1896 OldSpace* old_data_space_; |
| 1903 OldSpace* code_space_; | 1897 OldSpace* code_space_; |
| 1904 MapSpace* map_space_; | 1898 MapSpace* map_space_; |
| 1905 CellSpace* cell_space_; | 1899 CellSpace* cell_space_; |
| 1906 PropertyCellSpace* property_cell_space_; | 1900 PropertyCellSpace* property_cell_space_; |
| 1907 LargeObjectSpace* lo_space_; | 1901 LargeObjectSpace* lo_space_; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2103 int length, PretenureFlag pretenure); | 2097 int length, PretenureFlag pretenure); |
| 2104 | 2098 |
| 2105 // Allocate an initialized fixed array with the given filler value. | 2099 // Allocate an initialized fixed array with the given filler value. |
| 2106 MUST_USE_RESULT MaybeObject* AllocateFixedArrayWithFiller( | 2100 MUST_USE_RESULT MaybeObject* AllocateFixedArrayWithFiller( |
| 2107 int length, PretenureFlag pretenure, Object* filler); | 2101 int length, PretenureFlag pretenure, Object* filler); |
| 2108 | 2102 |
| 2109 // Initializes a JSObject based on its map. | 2103 // Initializes a JSObject based on its map. |
| 2110 void InitializeJSObjectFromMap(JSObject* obj, | 2104 void InitializeJSObjectFromMap(JSObject* obj, |
| 2111 FixedArray* properties, | 2105 FixedArray* properties, |
| 2112 Map* map); | 2106 Map* map); |
| 2107 void InitializeAllocationMemento(AllocationMemento* memento, |
| 2108 AllocationSite* allocation_site); |
| 2113 | 2109 |
| 2114 bool CreateInitialMaps(); | 2110 bool CreateInitialMaps(); |
| 2115 bool CreateInitialObjects(); | 2111 bool CreateInitialObjects(); |
| 2116 | 2112 |
| 2117 // These five Create*EntryStub functions are here and forced to not be inlined | 2113 // These five Create*EntryStub functions are here and forced to not be inlined |
| 2118 // because of a gcc-4.4 bug that assigns wrong vtable entries. | 2114 // because of a gcc-4.4 bug that assigns wrong vtable entries. |
| 2119 NO_INLINE(void CreateJSEntryStub()); | 2115 NO_INLINE(void CreateJSEntryStub()); |
| 2120 NO_INLINE(void CreateJSConstructEntryStub()); | 2116 NO_INLINE(void CreateJSConstructEntryStub()); |
| 2121 | 2117 |
| 2122 void CreateFixedStubs(); | 2118 void CreateFixedStubs(); |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2893 private: | 2889 private: |
| 2894 static const int kArrayEntriesPerCacheEntry = 4; | 2890 static const int kArrayEntriesPerCacheEntry = 4; |
| 2895 static const int kStringOffset = 0; | 2891 static const int kStringOffset = 0; |
| 2896 static const int kPatternOffset = 1; | 2892 static const int kPatternOffset = 1; |
| 2897 static const int kArrayOffset = 2; | 2893 static const int kArrayOffset = 2; |
| 2898 }; | 2894 }; |
| 2899 | 2895 |
| 2900 | 2896 |
| 2901 class TranscendentalCache { | 2897 class TranscendentalCache { |
| 2902 public: | 2898 public: |
| 2903 enum Type {ACOS, ASIN, ATAN, COS, EXP, LOG, SIN, TAN, kNumberOfCaches}; | 2899 enum Type { LOG, kNumberOfCaches}; |
| 2904 static const int kTranscendentalTypeBits = 3; | 2900 static const int kTranscendentalTypeBits = 3; |
| 2905 STATIC_ASSERT((1 << kTranscendentalTypeBits) >= kNumberOfCaches); | 2901 STATIC_ASSERT((1 << kTranscendentalTypeBits) >= kNumberOfCaches); |
| 2906 | 2902 |
| 2907 // Returns a heap number with f(input), where f is a math function specified | 2903 // Returns a heap number with f(input), where f is a math function specified |
| 2908 // by the 'type' argument. | 2904 // by the 'type' argument. |
| 2909 MUST_USE_RESULT inline MaybeObject* Get(Type type, double input); | 2905 MUST_USE_RESULT inline MaybeObject* Get(Type type, double input); |
| 2910 | 2906 |
| 2911 // The cache contains raw Object pointers. This method disposes of | 2907 // The cache contains raw Object pointers. This method disposes of |
| 2912 // them before a garbage collection. | 2908 // them before a garbage collection. |
| 2913 void Clear(); | 2909 void Clear(); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3084 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 3080 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
| 3085 | 3081 |
| 3086 private: | 3082 private: |
| 3087 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 3083 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
| 3088 }; | 3084 }; |
| 3089 #endif // DEBUG | 3085 #endif // DEBUG |
| 3090 | 3086 |
| 3091 } } // namespace v8::internal | 3087 } } // namespace v8::internal |
| 3092 | 3088 |
| 3093 #endif // V8_HEAP_H_ | 3089 #endif // V8_HEAP_H_ |
| OLD | NEW |