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