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

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

Issue 1323993004: [heap] Separate scavenger functionality into own file. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 5 years, 3 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/object-stats.h ('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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef V8_HEAP_SCAVENGER_H_
6 #define V8_HEAP_SCAVENGER_H_
7
8 #include "src/heap/objects-visiting.h"
9
10 namespace v8 {
11 namespace internal {
12
13 typedef void (*ScavengingCallback)(Map* map, HeapObject** slot,
14 HeapObject* object);
15
16 class Scavenger {
17 public:
18 explicit Scavenger(Heap* heap) : heap_(heap) {}
19
20 // Initializes static visitor dispatch tables.
21 static void Initialize();
22
23 // Callback function passed to Heap::Iterate etc. Copies an object if
24 // necessary, the object might be promoted to an old space. The caller must
25 // ensure the precondition that the object is (a) a heap object and (b) in
26 // the heap's from space.
27 static inline void ScavengeObject(HeapObject** p, HeapObject* object);
28
29 // Slow part of {ScavengeObject} above.
30 static void ScavengeObjectSlow(HeapObject** p, HeapObject* object);
31
32 // Chooses an appropriate static visitor table depending on the current state
33 // of the heap (i.e. incremental marking, logging and profiling).
34 void SelectScavengingVisitorsTable();
35
36 Isolate* isolate();
37 Heap* heap() { return heap_; }
38
39 private:
40 Heap* heap_;
41 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_;
42 };
43
44
45 // Helper class for turning the scavenger into an object visitor that is also
46 // filtering out non-HeapObjects and objects which do not reside in new space.
47 class ScavengeVisitor : public ObjectVisitor {
48 public:
49 explicit ScavengeVisitor(Heap* heap) : heap_(heap) {}
50
51 void VisitPointer(Object** p);
52 void VisitPointers(Object** start, Object** end);
53
54 private:
55 inline void ScavengePointer(Object** p);
56
57 Heap* heap_;
58 };
59
60
61 // Helper class for turning the scavenger into an object visitor that is also
62 // filtering out non-HeapObjects and objects which do not reside in new space.
63 class StaticScavengeVisitor
64 : public StaticNewSpaceVisitor<StaticScavengeVisitor> {
65 public:
66 static inline void VisitPointer(Heap* heap, Object** p);
67 };
68
69 } // namespace internal
70 } // namespace v8
71
72 #endif // V8_HEAP_SCAVENGER_H_
OLDNEW
« no previous file with comments | « src/heap/object-stats.h ('k') | src/heap/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698