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

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

Issue 1177083003: Reland "Keep track of array buffers in new space separately" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix 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 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 // trigger the event. In order to track ALL allocations one must turn off 1560 // trigger the event. In order to track ALL allocations one must turn off
1561 // FLAG_inline_new and FLAG_use_allocation_folding. 1561 // FLAG_inline_new and FLAG_use_allocation_folding.
1562 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); 1562 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes);
1563 1563
1564 // This event is triggered after object is moved to a new place. 1564 // This event is triggered after object is moved to a new place.
1565 inline void OnMoveEvent(HeapObject* target, HeapObject* source, 1565 inline void OnMoveEvent(HeapObject* target, HeapObject* source,
1566 int size_in_bytes); 1566 int size_in_bytes);
1567 1567
1568 bool deserialization_complete() const { return deserialization_complete_; } 1568 bool deserialization_complete() const { return deserialization_complete_; }
1569 1569
1570 void RegisterNewArrayBuffer(void* data, size_t length); 1570 // The following methods are used to track raw C++ pointers to externally
1571 void UnregisterArrayBuffer(void* data); 1571 // allocated memory used as backing store in live array buffers.
1572 void RegisterLiveArrayBuffer(void* data); 1572
1573 void FreeDeadArrayBuffers(); 1573 // A new ArrayBuffer was created with |data| as backing store.
1574 void RegisterNewArrayBuffer(bool in_new_space, void* data, size_t length);
1575
1576 // The backing store |data| is no longer owned by V8.
1577 void UnregisterArrayBuffer(bool in_new_space, void* data);
1578
1579 // A live ArrayBuffer was discovered during marking/scavenge.
1580 void RegisterLiveArrayBuffer(bool in_new_space, void* data);
1581
1582 // Frees all backing store pointers that weren't discovered in the previous
1583 // marking or scavenge phase.
1584 void FreeDeadArrayBuffers(bool in_new_space);
1585
1586 // Prepare for a new scavenge phase. A new marking phase is implicitly
1587 // prepared by finishing the previous one.
1588 void PrepareArrayBufferDiscoveryInNewSpace();
1589
1590 // An ArrayBuffer moved from new space to old space.
1591 void PromoteArrayBuffer(Object* buffer);
1574 1592
1575 protected: 1593 protected:
1576 // Methods made available to tests. 1594 // Methods made available to tests.
1577 1595
1578 // Allocates a JS Map in the heap. 1596 // Allocates a JS Map in the heap.
1579 MUST_USE_RESULT AllocationResult 1597 MUST_USE_RESULT AllocationResult
1580 AllocateMap(InstanceType instance_type, int instance_size, 1598 AllocateMap(InstanceType instance_type, int instance_size,
1581 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); 1599 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
1582 1600
1583 // Allocates and initializes a new JavaScript object based on a 1601 // Allocates and initializes a new JavaScript object based on a
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
2067 2085
2068 // Deopts all code that contains allocation instruction which are tenured or 2086 // Deopts all code that contains allocation instruction which are tenured or
2069 // not tenured. Moreover it clears the pretenuring allocation site statistics. 2087 // not tenured. Moreover it clears the pretenuring allocation site statistics.
2070 void ResetAllAllocationSitesDependentCode(PretenureFlag flag); 2088 void ResetAllAllocationSitesDependentCode(PretenureFlag flag);
2071 2089
2072 // Evaluates local pretenuring for the old space and calls 2090 // Evaluates local pretenuring for the old space and calls
2073 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in 2091 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in
2074 // the old space. 2092 // the old space.
2075 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc); 2093 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc);
2076 2094
2077 // Called on heap tear-down. 2095 // Called on heap tear-down. Frees all remaining ArrayBuffer backing stores.
2078 void TearDownArrayBuffers(); 2096 void TearDownArrayBuffers();
2079 2097
2098 // These correspond to the non-Helper versions.
2099 void RegisterNewArrayBufferHelper(std::map<void*, size_t>& live_buffers,
2100 void* data, size_t length);
2101 void UnregisterArrayBufferHelper(
2102 std::map<void*, size_t>& live_buffers,
2103 std::map<void*, size_t>& not_yet_discovered_buffers, void* data);
2104 void RegisterLiveArrayBufferHelper(
2105 std::map<void*, size_t>& not_yet_discovered_buffers, void* data);
2106 size_t FreeDeadArrayBuffersHelper(
2107 Isolate* isolate, std::map<void*, size_t>& live_buffers,
2108 std::map<void*, size_t>& not_yet_discovered_buffers);
2109 void TearDownArrayBuffersHelper(
2110 Isolate* isolate, std::map<void*, size_t>& live_buffers,
2111 std::map<void*, size_t>& not_yet_discovered_buffers);
2112
2080 // Record statistics before and after garbage collection. 2113 // Record statistics before and after garbage collection.
2081 void ReportStatisticsBeforeGC(); 2114 void ReportStatisticsBeforeGC();
2082 void ReportStatisticsAfterGC(); 2115 void ReportStatisticsAfterGC();
2083 2116
2084 // Slow part of scavenge object. 2117 // Slow part of scavenge object.
2085 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object); 2118 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object);
2086 2119
2087 // Total RegExp code ever generated 2120 // Total RegExp code ever generated
2088 double total_regexp_code_generated_; 2121 double total_regexp_code_generated_;
2089 2122
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2312 2345
2313 base::Mutex relocation_mutex_; 2346 base::Mutex relocation_mutex_;
2314 2347
2315 int gc_callbacks_depth_; 2348 int gc_callbacks_depth_;
2316 2349
2317 bool deserialization_complete_; 2350 bool deserialization_complete_;
2318 2351
2319 bool concurrent_sweeping_enabled_; 2352 bool concurrent_sweeping_enabled_;
2320 2353
2321 std::map<void*, size_t> live_array_buffers_; 2354 std::map<void*, size_t> live_array_buffers_;
2355 std::map<void*, size_t> live_new_array_buffers_;
2322 std::map<void*, size_t> not_yet_discovered_array_buffers_; 2356 std::map<void*, size_t> not_yet_discovered_array_buffers_;
2357 std::map<void*, size_t> not_yet_discovered_new_array_buffers_;
2323 2358
2324 struct StrongRootsList; 2359 struct StrongRootsList;
2325 StrongRootsList* strong_roots_list_; 2360 StrongRootsList* strong_roots_list_;
2326 2361
2327 friend class AlwaysAllocateScope; 2362 friend class AlwaysAllocateScope;
2328 friend class Deserializer; 2363 friend class Deserializer;
2329 friend class Factory; 2364 friend class Factory;
2330 friend class GCCallbacksScope; 2365 friend class GCCallbacksScope;
2331 friend class GCTracer; 2366 friend class GCTracer;
2332 friend class HeapIterator; 2367 friend class HeapIterator;
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
2780 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2815 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2781 2816
2782 private: 2817 private:
2783 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2818 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2784 }; 2819 };
2785 #endif // DEBUG 2820 #endif // DEBUG
2786 } 2821 }
2787 } // namespace v8::internal 2822 } // namespace v8::internal
2788 2823
2789 #endif // V8_HEAP_HEAP_H_ 2824 #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