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

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

Issue 1178403003: Revert of Keep track of array buffers in new space separately (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
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 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 // The following methods are used to track raw C++ pointers to externally 1570 void RegisterNewArrayBuffer(void* data, size_t length);
1571 // allocated memory used as backing store in live array buffers. 1571 void UnregisterArrayBuffer(void* data);
1572 1572 void RegisterLiveArrayBuffer(void* data);
1573 // A new ArrayBuffer was created with |data| as backing store. 1573 void FreeDeadArrayBuffers();
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);
1592 1574
1593 protected: 1575 protected:
1594 // Methods made available to tests. 1576 // Methods made available to tests.
1595 1577
1596 // Allocates a JS Map in the heap. 1578 // Allocates a JS Map in the heap.
1597 MUST_USE_RESULT AllocationResult 1579 MUST_USE_RESULT AllocationResult
1598 AllocateMap(InstanceType instance_type, int instance_size, 1580 AllocateMap(InstanceType instance_type, int instance_size,
1599 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); 1581 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
1600 1582
1601 // Allocates and initializes a new JavaScript object based on a 1583 // Allocates and initializes a new JavaScript object based on a
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 2067
2086 // Deopts all code that contains allocation instruction which are tenured or 2068 // Deopts all code that contains allocation instruction which are tenured or
2087 // not tenured. Moreover it clears the pretenuring allocation site statistics. 2069 // not tenured. Moreover it clears the pretenuring allocation site statistics.
2088 void ResetAllAllocationSitesDependentCode(PretenureFlag flag); 2070 void ResetAllAllocationSitesDependentCode(PretenureFlag flag);
2089 2071
2090 // Evaluates local pretenuring for the old space and calls 2072 // Evaluates local pretenuring for the old space and calls
2091 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in 2073 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in
2092 // the old space. 2074 // the old space.
2093 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc); 2075 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc);
2094 2076
2095 // Called on heap tear-down. Frees all remaining ArrayBuffer backing stores. 2077 // Called on heap tear-down.
2096 void TearDownArrayBuffers(); 2078 void TearDownArrayBuffers();
2097 2079
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
2113 // Record statistics before and after garbage collection. 2080 // Record statistics before and after garbage collection.
2114 void ReportStatisticsBeforeGC(); 2081 void ReportStatisticsBeforeGC();
2115 void ReportStatisticsAfterGC(); 2082 void ReportStatisticsAfterGC();
2116 2083
2117 // Slow part of scavenge object. 2084 // Slow part of scavenge object.
2118 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object); 2085 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object);
2119 2086
2120 // Total RegExp code ever generated 2087 // Total RegExp code ever generated
2121 double total_regexp_code_generated_; 2088 double total_regexp_code_generated_;
2122 2089
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
2345 2312
2346 base::Mutex relocation_mutex_; 2313 base::Mutex relocation_mutex_;
2347 2314
2348 int gc_callbacks_depth_; 2315 int gc_callbacks_depth_;
2349 2316
2350 bool deserialization_complete_; 2317 bool deserialization_complete_;
2351 2318
2352 bool concurrent_sweeping_enabled_; 2319 bool concurrent_sweeping_enabled_;
2353 2320
2354 std::map<void*, size_t> live_array_buffers_; 2321 std::map<void*, size_t> live_array_buffers_;
2355 std::map<void*, size_t> live_new_array_buffers_;
2356 std::map<void*, size_t> not_yet_discovered_array_buffers_; 2322 std::map<void*, size_t> not_yet_discovered_array_buffers_;
2357 std::map<void*, size_t> not_yet_discovered_new_array_buffers_;
2358 2323
2359 struct StrongRootsList; 2324 struct StrongRootsList;
2360 StrongRootsList* strong_roots_list_; 2325 StrongRootsList* strong_roots_list_;
2361 2326
2362 friend class AlwaysAllocateScope; 2327 friend class AlwaysAllocateScope;
2363 friend class Deserializer; 2328 friend class Deserializer;
2364 friend class Factory; 2329 friend class Factory;
2365 friend class GCCallbacksScope; 2330 friend class GCCallbacksScope;
2366 friend class GCTracer; 2331 friend class GCTracer;
2367 friend class HeapIterator; 2332 friend class HeapIterator;
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
2815 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2780 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2816 2781
2817 private: 2782 private:
2818 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2783 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2819 }; 2784 };
2820 #endif // DEBUG 2785 #endif // DEBUG
2821 } 2786 }
2822 } // namespace v8::internal 2787 } // namespace v8::internal
2823 2788
2824 #endif // V8_HEAP_HEAP_H_ 2789 #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