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 19 #include <cstdint> 20 21 namespace panda { 22 namespace ecmascript { 23 enum BarrierMode { SKIP_BARRIER, WRITE_BARRIER, READ_BARRIER }; 24 25 enum CheckIdleGCType { 26 VSYNC, 27 LOOPER 28 }; 29 30 enum class MarkType : uint8_t { 31 MARK_YOUNG, 32 MARK_FULL 33 }; 34 35 /* 36 * TriggerGCType is categorized according to the scope the GC expects to cover. 37 * Different GC algorithms may be applied to different GC types. 38 * For example, SemiSpace GC for young generation GC, Mark-Sweep-Compact for full GC, etc. 39 */ 40 enum TriggerGCType { 41 // GC is expected to cover young space only; 42 YOUNG_GC, 43 // GC is expected to cover young space and necessary old spaces; 44 OLD_GC, 45 // GC is expected to cover all valid heap spaces; 46 FULL_GC, 47 // GC is expected to compress objects into appspawn space; 48 APPSPAWN_FULL_GC, 49 SHARED_GC, 50 SHARED_PARTIAL_GC, 51 SHARED_FULL_GC, 52 APPSPAWN_SHARED_FULL_GC, 53 UNIFIED_GC, 54 GC_TYPE_LAST, 55 }; 56 57 enum class GCReason : uint8_t { 58 ALLOCATION_LIMIT, 59 ALLOCATION_FAILED, 60 IDLE, 61 SWITCH_BACKGROUND, 62 EXTERNAL_TRIGGER, 63 WORKER_DESTRUCTION, 64 TRIGGER_BY_JS, 65 HINT_GC, 66 NATIVE_LIMIT, 67 SHARED_LIMIT, 68 IDLE_NATIVE, 69 CROSSREF_CAUSE, 70 HANDLE_MARKING_FINISHED, 71 TRIGGER_BY_ARKUI, 72 TRIGGER_BY_ABILITY, 73 TRIGGER_BY_MEM_TOOLS, 74 TRIGGER_BY_TASKPOOL, 75 OTHER 76 }; 77 78 enum class MarkReason : uint8_t { 79 ALLOCATION_LIMIT, 80 OLD_GC_WITHOUT_FULLMARK, 81 IDLE, 82 EXIT_HIGH_SENSITIVE, 83 EXTERNAL_TRIGGER, 84 WORKER_DESTRUCTION, 85 TRIGGER_BY_JS, 86 HINT_GC, 87 IDLE_NATIVE, 88 CROSSREF_CAUSE, 89 NATIVE_LIMIT, 90 SHARED_LIMIT, 91 EXIT_SERIALIZE, 92 OTHER 93 }; 94 95 enum class RequestAotMode : uint8_t { 96 RE_COMPILE_ON_IDLE = 0 97 }; 98 } // namespace ecmascript 99 } // namespace panda 100 101 #endif // ECMASCRIPT_COMMON_ENUM_H 102