• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (c) 2025 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 #ifndef ECMASCRIPT_CROSS_VM_HEAP_HYBRID_H
16 #define ECMASCRIPT_CROSS_VM_HEAP_HYBRID_H
17 
18 #define BASEHEAP_PUBLIC_HYBRID_EXTENSION()                                                                        \
19     void SetGCType(TriggerGCType gcType)                                                                          \
20     {                                                                                                             \
21         gcType_ = gcType;                                                                                         \
22     }                                                                                                             \
23     uint32_t GetRunningTaskCount()
24 
25 #define SHAREDHEAP_PUBLIC_HYBRID_EXTENSION()                                                                      \
26     UnifiedGC *GetUnifiedGC() const                                                                               \
27     {                                                                                                             \
28         return unifiedGC_;                                                                                        \
29     }                                                                                                             \
30     template<TriggerGCType gcType, GCReason gcReason>                                                             \
31     bool TriggerUnifiedGCMark(JSThread *thread) const;                                                            \
32     void StartUnifiedGCMark(TriggerGCType gcType, GCReason gcReason);                                             \
33     void CreateUnifiedGC()
34 
35 
36 #define SHAREDHEAP_PRIVATE_HYBRID_EXTENSION()                                                                  \
37     UnifiedGC *unifiedGC_ {nullptr}
38 
39 
40 #define HEAP_PUBLIC_HYBRID_EXTENSION()                                                                          \
41     void UnifiedGCPrepare();                                                                                  \
42     UnifiedGCMarker *GetUnifiedGCMarker() const                                                               \
43     {                                                                                                         \
44         return unifiedGCMarker_;                                                                              \
45     }                                                                                                         \
46     bool IsUnifiedGC() const                                                                                  \
47     {                                                                                                         \
48         return gcType_ == TriggerGCType::UNIFIED_GC;                                                          \
49     }                                                                                                         \
50     void CreateUnifiedGCMarker()
51 
52 #define HEAP_PRIVATE_HYBRID_EXTENSION()                                                                        \
53     UnifiedGCMarker *unifiedGCMarker_ {nullptr}
54 
55 #endif  // ECMASCRIPT_CROSS_VM_HEAP_HYBRID_H
56