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

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

Issue 1115853004: Reland "Remove the weak list of array buffers" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: ignore empty array buffers Created 5 years, 7 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
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 10
10 #include "src/allocation.h" 11 #include "src/allocation.h"
11 #include "src/assert-scope.h" 12 #include "src/assert-scope.h"
12 #include "src/counters.h" 13 #include "src/counters.h"
13 #include "src/globals.h" 14 #include "src/globals.h"
14 #include "src/heap/gc-idle-time-handler.h" 15 #include "src/heap/gc-idle-time-handler.h"
15 #include "src/heap/gc-tracer.h" 16 #include "src/heap/gc-tracer.h"
16 #include "src/heap/incremental-marking.h" 17 #include "src/heap/incremental-marking.h"
17 #include "src/heap/mark-compact.h" 18 #include "src/heap/mark-compact.h"
18 #include "src/heap/objects-visiting.h" 19 #include "src/heap/objects-visiting.h"
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 868
868 // The hidden_string is special because it is the empty string, but does 869 // The hidden_string is special because it is the empty string, but does
869 // not match the empty string. 870 // not match the empty string.
870 String* hidden_string() { return hidden_string_; } 871 String* hidden_string() { return hidden_string_; }
871 872
872 void set_native_contexts_list(Object* object) { 873 void set_native_contexts_list(Object* object) {
873 native_contexts_list_ = object; 874 native_contexts_list_ = object;
874 } 875 }
875 Object* native_contexts_list() const { return native_contexts_list_; } 876 Object* native_contexts_list() const { return native_contexts_list_; }
876 877
877 void set_array_buffers_list(Object* object) { array_buffers_list_ = object; }
878 Object* array_buffers_list() const { return array_buffers_list_; }
879
880 void set_last_array_buffer_in_list(Object* object) {
881 last_array_buffer_in_list_ = object;
882 }
883 Object* last_array_buffer_in_list() const {
884 return last_array_buffer_in_list_;
885 }
886
887 void set_allocation_sites_list(Object* object) { 878 void set_allocation_sites_list(Object* object) {
888 allocation_sites_list_ = object; 879 allocation_sites_list_ = object;
889 } 880 }
890 Object* allocation_sites_list() { return allocation_sites_list_; } 881 Object* allocation_sites_list() { return allocation_sites_list_; }
891 882
892 // Used in CreateAllocationSiteStub and the (de)serializer. 883 // Used in CreateAllocationSiteStub and the (de)serializer.
893 Object** allocation_sites_list_address() { return &allocation_sites_list_; } 884 Object** allocation_sites_list_address() { return &allocation_sites_list_; }
894 885
895 void set_encountered_weak_collections(Object* weak_collection) { 886 void set_encountered_weak_collections(Object* weak_collection) {
896 encountered_weak_collections_ = weak_collection; 887 encountered_weak_collections_ = weak_collection;
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
1483 // trigger the event. In order to track ALL allocations one must turn off 1474 // trigger the event. In order to track ALL allocations one must turn off
1484 // FLAG_inline_new and FLAG_use_allocation_folding. 1475 // FLAG_inline_new and FLAG_use_allocation_folding.
1485 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes); 1476 inline void OnAllocationEvent(HeapObject* object, int size_in_bytes);
1486 1477
1487 // This event is triggered after object is moved to a new place. 1478 // This event is triggered after object is moved to a new place.
1488 inline void OnMoveEvent(HeapObject* target, HeapObject* source, 1479 inline void OnMoveEvent(HeapObject* target, HeapObject* source,
1489 int size_in_bytes); 1480 int size_in_bytes);
1490 1481
1491 bool deserialization_complete() const { return deserialization_complete_; } 1482 bool deserialization_complete() const { return deserialization_complete_; }
1492 1483
1484 void RegisterNewArrayBuffer(void* data, size_t length);
1485 void UnregisterArrayBuffer(void* data);
1486 void RegisterLiveArrayBuffer(void* data);
1487 void FreeDeadArrayBuffers();
1488
1493 protected: 1489 protected:
1494 // Methods made available to tests. 1490 // Methods made available to tests.
1495 1491
1496 // Allocates a JS Map in the heap. 1492 // Allocates a JS Map in the heap.
1497 MUST_USE_RESULT AllocationResult 1493 MUST_USE_RESULT AllocationResult
1498 AllocateMap(InstanceType instance_type, int instance_size, 1494 AllocateMap(InstanceType instance_type, int instance_size,
1499 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND); 1495 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
1500 1496
1501 // Allocates and initializes a new JavaScript object based on a 1497 // Allocates and initializes a new JavaScript object based on a
1502 // constructor. 1498 // constructor.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1653 // last GC. 1649 // last GC.
1654 bool old_gen_exhausted_; 1650 bool old_gen_exhausted_;
1655 1651
1656 // Indicates that inline bump-pointer allocation has been globally disabled 1652 // Indicates that inline bump-pointer allocation has been globally disabled
1657 // for all spaces. This is used to disable allocations in generated code. 1653 // for all spaces. This is used to disable allocations in generated code.
1658 bool inline_allocation_disabled_; 1654 bool inline_allocation_disabled_;
1659 1655
1660 // Weak list heads, threaded through the objects. 1656 // Weak list heads, threaded through the objects.
1661 // List heads are initialized lazily and contain the undefined_value at start. 1657 // List heads are initialized lazily and contain the undefined_value at start.
1662 Object* native_contexts_list_; 1658 Object* native_contexts_list_;
1663 Object* array_buffers_list_;
1664 Object* last_array_buffer_in_list_;
1665 Object* allocation_sites_list_; 1659 Object* allocation_sites_list_;
1666 1660
1667 // List of encountered weak collections (JSWeakMap and JSWeakSet) during 1661 // List of encountered weak collections (JSWeakMap and JSWeakSet) during
1668 // marking. It is initialized during marking, destroyed after marking and 1662 // marking. It is initialized during marking, destroyed after marking and
1669 // contains Smi(0) while marking is not active. 1663 // contains Smi(0) while marking is not active.
1670 Object* encountered_weak_collections_; 1664 Object* encountered_weak_collections_;
1671 1665
1672 Object* encountered_weak_cells_; 1666 Object* encountered_weak_cells_;
1673 1667
1674 StoreBufferRebuilder store_buffer_rebuilder_; 1668 StoreBufferRebuilder store_buffer_rebuilder_;
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1988 StoreBufferEvent event); 1982 StoreBufferEvent event);
1989 1983
1990 // Performs a major collection in the whole heap. 1984 // Performs a major collection in the whole heap.
1991 void MarkCompact(); 1985 void MarkCompact();
1992 1986
1993 // Code to be run before and after mark-compact. 1987 // Code to be run before and after mark-compact.
1994 void MarkCompactPrologue(); 1988 void MarkCompactPrologue();
1995 void MarkCompactEpilogue(); 1989 void MarkCompactEpilogue();
1996 1990
1997 void ProcessNativeContexts(WeakObjectRetainer* retainer); 1991 void ProcessNativeContexts(WeakObjectRetainer* retainer);
1998 void ProcessArrayBuffers(WeakObjectRetainer* retainer, bool stop_after_young);
1999 void ProcessAllocationSites(WeakObjectRetainer* retainer); 1992 void ProcessAllocationSites(WeakObjectRetainer* retainer);
2000 1993
2001 // Deopts all code that contains allocation instruction which are tenured or 1994 // Deopts all code that contains allocation instruction which are tenured or
2002 // not tenured. Moreover it clears the pretenuring allocation site statistics. 1995 // not tenured. Moreover it clears the pretenuring allocation site statistics.
2003 void ResetAllAllocationSitesDependentCode(PretenureFlag flag); 1996 void ResetAllAllocationSitesDependentCode(PretenureFlag flag);
2004 1997
2005 // Evaluates local pretenuring for the old space and calls 1998 // Evaluates local pretenuring for the old space and calls
2006 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in 1999 // ResetAllTenuredAllocationSitesDependentCode if too many objects died in
2007 // the old space. 2000 // the old space.
2008 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc); 2001 void EvaluateOldSpaceLocalPretenuring(uint64_t size_of_objects_before_gc);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
2149 MemoryChunk* chunks_queued_for_free_; 2142 MemoryChunk* chunks_queued_for_free_;
2150 2143
2151 base::Mutex relocation_mutex_; 2144 base::Mutex relocation_mutex_;
2152 2145
2153 int gc_callbacks_depth_; 2146 int gc_callbacks_depth_;
2154 2147
2155 bool deserialization_complete_; 2148 bool deserialization_complete_;
2156 2149
2157 bool concurrent_sweeping_enabled_; 2150 bool concurrent_sweeping_enabled_;
2158 2151
2152 std::map<void*, size_t> live_array_buffers_;
2153 std::map<void*, size_t> not_yet_discovered_array_buffers_;
2154
2159 friend class AlwaysAllocateScope; 2155 friend class AlwaysAllocateScope;
2160 friend class Deserializer; 2156 friend class Deserializer;
2161 friend class Factory; 2157 friend class Factory;
2162 friend class GCCallbacksScope; 2158 friend class GCCallbacksScope;
2163 friend class GCTracer; 2159 friend class GCTracer;
2164 friend class HeapIterator; 2160 friend class HeapIterator;
2165 friend class Isolate; 2161 friend class Isolate;
2166 friend class MarkCompactCollector; 2162 friend class MarkCompactCollector;
2167 friend class MarkCompactMarkingVisitor; 2163 friend class MarkCompactMarkingVisitor;
2168 friend class MapCompact; 2164 friend class MapCompact;
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
2610 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 2606 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2611 2607
2612 private: 2608 private:
2613 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 2609 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2614 }; 2610 };
2615 #endif // DEBUG 2611 #endif // DEBUG
2616 } 2612 }
2617 } // namespace v8::internal 2613 } // namespace v8::internal
2618 2614
2619 #endif // V8_HEAP_HEAP_H_ 2615 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « src/heap-snapshot-generator.cc ('k') | src/heap/heap.cc » ('j') | src/heap/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698