• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef ECMASCRIPT_MEM_FULL_GC_H
17 #define ECMASCRIPT_MEM_FULL_GC_H
18 
19 #include "ecmascript/mem/parallel_work_helper.h"
20 #include "ecmascript/mem/stw_young_gc_for_testing.h"
21 
22 namespace panda {
23 namespace ecmascript {
24 class Heap;
25 class JSHClass;
26 
27 class FullGC : public GarbageCollector {
28 public:
29     explicit FullGC(Heap *heap);
30     ~FullGC() override = default;
31 
32     NO_COPY_SEMANTIC(FullGC);
33     NO_MOVE_SEMANTIC(FullGC);
34 
35     void RunPhases();
36 
37 private:
38     void InitializePhase();
39     void MarkingPhase();
40     void SweepPhases();
41     void FinishPhase();
42 
43     Heap *heap_;
44     size_t youngAndOldAliveSize_ = 0;
45     size_t nonMoveSpaceFreeSize_ = 0;
46     size_t youngSpaceCommitSize_ = 0;
47     size_t oldSpaceCommitSize_ = 0;
48     size_t nonMoveSpaceCommitSize_ = 0;
49 
50     // obtain from heap
51     WorkerHelper *workList_ {nullptr};
52 
53     friend class WorkerHelper;
54     friend class Heap;
55 };
56 }  // namespace ecmascript
57 }  // namespace panda
58 
59 #endif  // ECMASCRIPT_MEM_FULL_GC_H