• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 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_BASE_CONFIG_H
17 #define ECMASCRIPT_BASE_CONFIG_H
18 
19 namespace panda::ecmascript {
20 #define ARK_INLINE __attribute__((always_inline))
21 #define ARK_NOINLINE __attribute__((noinline))
22 
23 #define ECMASCRIPT_ENABLE_DEBUG_MODE 0
24 #define ECMASCRIPT_ENABLE_ARK_CONTAINER 1
25 #define ECMASCRIPT_ENABLE_VERBOSE_LEVEL_LOG 0
26 
27 #define ECMASCRIPT_ENABLE_BUILTIN_LOG 0
28 #define ECMASCRIPT_ENABLE_ASM_FILE_LOAD_LOG 0
29 
30 #define ECMASCRIPT_ENABLE_SNAPSHOT 0
31 #define ECMASCRIPT_ENABLE_HEAP_DETAIL_STATISTICS 0
32 #define ECMASCRIPT_ENABLE_OPT_CODE_PROFILER 0
33 #define ECMASCRIPT_ENABLE_FUNCTION_CALL_TIMER 0
34 
35 #ifndef NDEBUG
36 #define ECMASCRIPT_ENABLE_INTERPRETER_LOG 1
37 #define ECMASCRIPT_ENABLE_RUNTIME_STAT 1
38 #define ECMASCRIPT_ENABLE_INTERPRETER_RUNTIME_STAT 1
39 #define ECMASCRIPT_ENABLE_BUILTINS_RUNTIME_STAT 1
40 #define ECMASCRIPT_ENABLE_ALLOCATE_AND_GC_RUNTIME_STAT 1
41 #else
42 #define ECMASCRIPT_ENABLE_INTERPRETER_LOG 0
43 #define ECMASCRIPT_ENABLE_RUNTIME_STAT 0
44 #define ECMASCRIPT_ENABLE_INTERPRETER_RUNTIME_STAT 0
45 #define ECMASCRIPT_ENABLE_BUILTINS_RUNTIME_STAT 0
46 #define ECMASCRIPT_ENABLE_ALLOCATE_AND_GC_RUNTIME_STAT 0
47 #endif
48 /*
49  * 1. close ic
50  * 2. close parallel gc
51  * 3. enable gc logs
52  * 4. enable handle-scope zap, zap reclaimed regions
53  * 5. switch gc mode to full gc
54  * 6. enable Cast() check
55  * 7. enable verify heap
56  * 9. enable Proactively interrogating and collecting information in the call stack
57  */
58 #if ECMASCRIPT_ENABLE_DEBUG_MODE
59     #define ECMASCRIPT_ENABLE_IC 0
60     #define ECMASCRIPT_ENABLE_ZAP_MEM 1
61     #define ECMASCRIPT_SWITCH_GC_MODE_TO_FULL_GC 1
62     #define ECMASCRIPT_ENABLE_CAST_CHECK 1
63     #define ECMASCRIPT_ENABLE_NEW_HANDLE_CHECK 1
64     #define ECMASCRIPT_ENABLE_HEAP_VERIFY 1
65     #define ECMASCRIPT_ENABLE_BARRIER_CHECK 1
66     #define ECMASCRIPT_ENABLE_NAPI_SPECIAL_CHECK 1
67 #elif defined(ECMASCRIPT_ENABLE_DFX_CONFIG)
68     #define ECMASCRIPT_ENABLE_IC 1
69     #define ECMASCRIPT_ENABLE_ZAP_MEM 0
70     #define ECMASCRIPT_SWITCH_GC_MODE_TO_FULL_GC 0
71     #define ECMASCRIPT_ENABLE_CAST_CHECK 0
72     #define ECMASCRIPT_ENABLE_NEW_HANDLE_CHECK 0
73     #define ECMASCRIPT_ENABLE_HEAP_VERIFY 1
74     #define ECMASCRIPT_ENABLE_BARRIER_CHECK 0
75     #define ECMASCRIPT_ENABLE_NAPI_SPECIAL_CHECK 1
76 #else
77     #define ECMASCRIPT_ENABLE_IC 1
78     #define ECMASCRIPT_ENABLE_ZAP_MEM 0
79     #define ECMASCRIPT_SWITCH_GC_MODE_TO_FULL_GC 0
80     #define ECMASCRIPT_ENABLE_CAST_CHECK 0
81     #define ECMASCRIPT_ENABLE_NEW_HANDLE_CHECK 0
82     #define ECMASCRIPT_ENABLE_HEAP_VERIFY 0
83     #define ECMASCRIPT_ENABLE_BARRIER_CHECK 0
84     #define ECMASCRIPT_ENABLE_NAPI_SPECIAL_CHECK 0
85 #endif
86 
87 #if ECMASCRIPT_ENABLE_ZAP_MEM
88     constexpr int INVALID_VALUE = 0x7;
89 #endif
90 
91 #if defined(PANDA_TARGET_32)
92     #define ECMASCRIPT_DISABLE_CONCURRENT_MARKING 1
93 #else
94     #define ECMASCRIPT_DISABLE_CONCURRENT_MARKING 0
95 #endif
96 }  // namespace panda::ecmascript
97 
98 #endif  // ECMASCRIPT_BASE_CONFIG_H
99