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

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

Issue 2005173003: Immediatelly promote marked objects (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Really should concentrate more Created 4 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/heap/mark-compact.cc ('k') | src/heap/scavenger.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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_SCAVENGER_H_ 5 #ifndef V8_HEAP_SCAVENGER_H_
6 #define V8_HEAP_SCAVENGER_H_ 6 #define V8_HEAP_SCAVENGER_H_
7 7
8 #include "src/heap/objects-visiting.h" 8 #include "src/heap/objects-visiting.h"
9 #include "src/heap/slot-set.h" 9 #include "src/heap/slot-set.h"
10 10
11 namespace v8 { 11 namespace v8 {
12 namespace internal { 12 namespace internal {
13 13
14 typedef void (*ScavengingCallback)(Map* map, HeapObject** slot, 14 typedef void (*ScavengingCallback)(Map* map, HeapObject** slot,
15 HeapObject* object, 15 HeapObject* object);
16 PromotionMode promotion_mode);
17 16
18 class Scavenger { 17 class Scavenger {
19 public: 18 public:
20 explicit Scavenger(Heap* heap) : heap_(heap) {} 19 explicit Scavenger(Heap* heap) : heap_(heap) {}
21 20
22 // Initializes static visitor dispatch tables. 21 // Initializes static visitor dispatch tables.
23 static void Initialize(); 22 static void Initialize();
24 23
25 // Callback function passed to Heap::Iterate etc. Copies an object if 24 // Callback function passed to Heap::Iterate etc. Copies an object if
26 // necessary, the object might be promoted to an old space. The caller must 25 // necessary, the object might be promoted to an old space. The caller must
27 // ensure the precondition that the object is (a) a heap object and (b) in 26 // ensure the precondition that the object is (a) a heap object and (b) in
28 // the heap's from space. 27 // the heap's from space.
29 static inline void ScavengeObject( 28 static inline void ScavengeObject(HeapObject** p, HeapObject* object);
30 HeapObject** p, HeapObject* object, 29 static inline SlotCallbackResult CheckAndScavengeObject(Heap* heap,
31 PromotionMode promotion_mode = DEFAULT_PROMOTION); 30 Address slot_address);
32 static inline SlotCallbackResult CheckAndScavengeObject(
33 Heap* heap, Address slot_address, PromotionMode promotion_mode);
34 31
35 // Slow part of {ScavengeObject} above. 32 // Slow part of {ScavengeObject} above.
36 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object, 33 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object);
37 PromotionMode promotion_mode);
38 34
39 // Chooses an appropriate static visitor table depending on the current state 35 // Chooses an appropriate static visitor table depending on the current state
40 // of the heap (i.e. incremental marking, logging and profiling). 36 // of the heap (i.e. incremental marking, logging and profiling).
41 void SelectScavengingVisitorsTable(); 37 void SelectScavengingVisitorsTable();
42 38
43 Isolate* isolate(); 39 Isolate* isolate();
44 Heap* heap() { return heap_; } 40 Heap* heap() { return heap_; }
45 41
46 private: 42 private:
47 Heap* heap_; 43 Heap* heap_;
(...skipping 12 matching lines...) Expand all
60 56
61 private: 57 private:
62 inline void ScavengePointer(Object** p); 58 inline void ScavengePointer(Object** p);
63 59
64 Heap* heap_; 60 Heap* heap_;
65 }; 61 };
66 62
67 63
68 // Helper class for turning the scavenger into an object visitor that is also 64 // Helper class for turning the scavenger into an object visitor that is also
69 // filtering out non-HeapObjects and objects which do not reside in new space. 65 // filtering out non-HeapObjects and objects which do not reside in new space.
66 template <PromotionMode promotion_mode>
70 class StaticScavengeVisitor 67 class StaticScavengeVisitor
71 : public StaticNewSpaceVisitor<StaticScavengeVisitor> { 68 : public StaticNewSpaceVisitor<StaticScavengeVisitor<promotion_mode>> {
72 public: 69 public:
73 static inline void VisitPointer(Heap* heap, HeapObject* object, Object** p); 70 static inline void VisitPointer(Heap* heap, HeapObject* object, Object** p);
74 }; 71 };
75 72
76 } // namespace internal 73 } // namespace internal
77 } // namespace v8 74 } // namespace v8
78 75
79 #endif // V8_HEAP_SCAVENGER_H_ 76 #endif // V8_HEAP_SCAVENGER_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698