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

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

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

Powered by Google App Engine
This is Rietveld 408576698