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_COMMON_ENUM_H
17#define ECMASCRIPT_COMMON_ENUM_H
18
19namespace panda {
20namespace ecmascript {
21enum BarrierMode { SKIP_BARRIER, WRITE_BARRIER, READ_BARRIER };
22
23enum CheckIdleGCType {
24    VSYNC,
25    LOOPER
26};
27
28/*
29 * TriggerGCType is categorized according to the scope the GC expects to cover.
30 * Different GC algorithms may be applied to different GC types.
31 * For example, SemiSpace GC for young generation GC, Mark-Sweep-Compact for full GC, etc.
32 */
33enum TriggerGCType {
34    EDEN_GC,
35    // GC is expected to cover young space only;
36    YOUNG_GC,
37    // GC is expected to cover young space and necessary old spaces;
38    OLD_GC,
39    // GC is expected to cover all valid heap spaces;
40    FULL_GC,
41    // GC is expected to compress objects into appspawn space;
42    APPSPAWN_FULL_GC,
43    SHARED_GC,
44    SHARED_FULL_GC,
45    APPSPAWN_SHARED_FULL_GC,
46    GC_TYPE_LAST
47};
48
49enum class GCReason : uint8_t {
50    ALLOCATION_LIMIT,
51    ALLOCATION_FAILED,
52    IDLE,
53    SWITCH_BACKGROUND,
54    EXTERNAL_TRIGGER,
55    WORKER_DESTRUCTION,
56    TRIGGER_BY_JS,
57    TRIGGER_BY_ARKUI,
58    TRIGGER_BY_ABILITY,
59    TRIGGER_BY_MEM_TOOLS,
60    TRIGGER_BY_TASKPOOL,
61    HINT_GC,
62    OTHER
63};
64
65enum class RequestAotMode : uint8_t {
66    RE_COMPILE_ON_IDLE = 0
67};
68}  // namespace ecmascript
69}  // namespace panda
70
71#endif  // ECMASCRIPT_COMMON_ENUM_H
72