Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: src/heap/heap.h

Issue 1188313006: Version 4.4.63.8 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.4
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/api.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_HEAP_HEAP_H_ 5 #ifndef V8_HEAP_HEAP_H_
6 #define V8_HEAP_HEAP_H_ 6 #define V8_HEAP_HEAP_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 #include <map> 9 #include <map>
10 10
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1505 // trigger the event. In order to track ALL allocations one must turn off 1505 // trigger the event. In order to track ALL allocations one must turn off
1506 // FLAG_inline_new and FLAG_use_allocation_folding. 1506 // FLAG_inline_new and FLAG_use_allocation_folding.
1507 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); 1507 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes);
1508 1508
1509 // This event is triggered after object is moved to a new place. 1509 // This event is triggered after object is moved to a new place.
1510 inline void OnMoveEvent(HeapObject* target, HeapObject* source, 1510 inline void OnMoveEvent(HeapObject* target, HeapObject* source,
1511 int size_in_bytes); 1511 int size_in_bytes);
1512 1512
1513 bool deserialization_complete() const { return deserialization_complete_; } 1513 bool deserialization_complete() const { return deserialization_complete_; }
1514 1514
1515 void RegisterNewArrayBuffer(void* data, size_t length); 1515 // The following methods are used to track raw C++ pointers to externally
1516 void UnregisterArrayBuffer(void* data); 1516 // allocated memory used as backing store in live array buffers.
1517 void RegisterLiveArrayBuffer(void* data); 1517
1518 void FreeDeadArrayBuffers(); 1518 // A new ArrayBuffer was created with |data| as backing store.
1519 void RegisterNewArrayBuffer(bool in_new_space, void* data, size_t length);
1520
1521 // The backing store |data| is no longer owned by V8.
1522 void UnregisterArrayBuffer(bool in_new_space, void* data);
1523
1524 // A live ArrayBuffer was discovered during marking/scavenge.
1525 void RegisterLiveArrayBuffer(bool in_new_space, void* data);
1526
1527 // Frees all backing store pointers that weren't discovered in the previous
1528 // marking or scavenge phase.
1529 void FreeDeadArrayBuffers(bool in_new_space);
1530
1531 // Prepare for a new scavenge phase. A new marking phase is implicitly
1532 // prepared by finishing the previous one.
1533 void PrepareArrayBufferDiscoveryInNewSpace();
1534
1535 // An ArrayBuffer moved from new space to old space.
1536 void PromoteArrayBuffer(Object* buffer);
1519 1537
1520 protected: 1538 protected:
1521 // Methods made available to tests. 1539 // Methods made available to tests.
1522 1540
1523 // Allocates a JS Map in the heap. 1541 // Allocates a JS Map in the heap.
1524 MUST_USE_RESULT AllocationResult 1542 MUST_USE_RESULT AllocationResult
1525 AllocateMap(InstanceType instance_type, int instance_size, 1543 AllocateMap(InstanceType instance_type, int instance_size,
1526 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); 1544 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
1527 1545
1528 // Allocates and initializes a new JavaScript object based on a 1546 // Allocates and initializes a new JavaScript object based on a
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
2027 2045
2028 // Deopts all code that contains allocation instruction which are tenured or 2046 // Deopts all code that contains allocation instruction which are tenured or
2029 // not tenured. Moreover it clears the pretenuring allocation site statistics. 2047 // not tenured. Moreover it clears the pretenuring allocation site statistics.
2030 void ResetAllAllocationSitesDependentCode(PretenureFlag flag); 2048 void ResetAllAllocationSitesDependentCode(PretenureFlag flag);
2031 2049
2032 // Evaluates local pretenuring for the old space and calls 2050 // Evaluates local pretenuring for the old space and calls
2033 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in 2051 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in
2034 // the old space. 2052 // the old space.
2035 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc); 2053 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc);
2036 2054
2037 // Called on heap tear-down. 2055 // Called on heap tear-down. Frees all remaining ArrayBuffer backing stores.
2038 void TearDownArrayBuffers(); 2056 void TearDownArrayBuffers();
2039 2057
2058 // These correspond to the non-Helper versions.
2059 void RegisterNewArrayBufferHelper(std::map<void*, size_t>& live_buffers,
2060 void* data, size_t length);
2061 void UnregisterArrayBufferHelper(
2062 std::map<void*, size_t>& live_buffers,
2063 std::map<void*, size_t>& not_yet_discovered_buffers, void* data);
2064 void RegisterLiveArrayBufferHelper(
2065 std::map<void*, size_t>& not_yet_discovered_buffers, void* data);
2066 size_t FreeDeadArrayBuffersHelper(
2067 Isolate* isolate, std::map<void*, size_t>& live_buffers,
2068 std::map<void*, size_t>& not_yet_discovered_buffers);
2069 void TearDownArrayBuffersHelper(
2070 Isolate* isolate, std::map<void*, size_t>& live_buffers,
2071 std::map<void*, size_t>& not_yet_discovered_buffers);
2072
2040 // Record statistics before and after garbage collection. 2073 // Record statistics before and after garbage collection.
2041 void ReportStatisticsBeforeGC(); 2074 void ReportStatisticsBeforeGC();
2042 void ReportStatisticsAfterGC(); 2075 void ReportStatisticsAfterGC();
2043 2076
2044 // Slow part of scavenge object. 2077 // Slow part of scavenge object.
2045 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object); 2078 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object);
2046 2079
2047 // Total RegExp code ever generated 2080 // Total RegExp code ever generated
2048 double total_regexp_code_generated_; 2081 double total_regexp_code_generated_;
2049 2082
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 2210
2178 base::Mutex relocation_mutex_; 2211 base::Mutex relocation_mutex_;
2179 2212
2180 int gc_callbacks_depth_; 2213 int gc_callbacks_depth_;
2181 2214
2182 bool deserialization_complete_; 2215 bool deserialization_complete_;
2183 2216
2184 bool concurrent_sweeping_enabled_; 2217 bool concurrent_sweeping_enabled_;
2185 2218
2186 std::map<void*, size_t> live_array_buffers_; 2219 std::map<void*, size_t> live_array_buffers_;
2220 std::map<void*, size_t> live_new_array_buffers_;
2187 std::map<void*, size_t> not_yet_discovered_array_buffers_; 2221 std::map<void*, size_t> not_yet_discovered_array_buffers_;
2222 std::map<void*, size_t> not_yet_discovered_new_array_buffers_;
2188 2223
2189 struct StrongRootsList; 2224 struct StrongRootsList;
2190 StrongRootsList* strong_roots_list_; 2225 StrongRootsList* strong_roots_list_;
2191 2226
2192 friend class AlwaysAllocateScope; 2227 friend class AlwaysAllocateScope;
2193 friend class Deserializer; 2228 friend class Deserializer;
2194 friend class Factory; 2229 friend class Factory;
2195 friend class GCCallbacksScope; 2230 friend class GCCallbacksScope;
2196 friend class GCTracer; 2231 friend class GCTracer;
2197 friend class HeapIterator; 2232 friend class HeapIterator;
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
2643 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2678 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2644 2679
2645 private: 2680 private:
2646 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2681 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2647 }; 2682 };
2648 #endif // DEBUG 2683 #endif // DEBUG
2649 } 2684 }
2650 } // namespace v8::internal 2685 } // namespace v8::internal
2651 2686
2652 #endif // V8_HEAP_HEAP_H_ 2687 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/heap/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698