• 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 
34 #ifndef NDEBUG
35 #define ECMASCRIPT_ENABLE_INTERPRETER_LOG 1
36 #define ECMASCRIPT_ENABLE_RUNTIME_STAT 1
37 #define ECMASCRIPT_ENABLE_INTERPRETER_RUNTIME_STAT 1
38 #define ECMASCRIPT_ENABLE_BUILTINS_RUNTIME_STAT 1
39 #define ECMASCRIPT_ENABLE_ALLOCATE_AND_GC_RUNTIME_STAT 1
40 #else
41 #define ECMASCRIPT_ENABLE_INTERPRETER_LOG 0
42 #define ECMASCRIPT_ENABLE_RUNTIME_STAT 0
43 #define ECMASCRIPT_ENABLE_INTERPRETER_RUNTIME_STAT 0
44 #define ECMASCRIPT_ENABLE_BUILTINS_RUNTIME_STAT 0
45 #define ECMASCRIPT_ENABLE_ALLOCATE_AND_GC_RUNTIME_STAT 0
46 #endif
47 /*
48  * 1. close ic
49  * 2. close parallel gc
50  * 3. enable gc logs
51  * 4. enable handle-scope zap, zap reclaimed regions
52  * 5. switch gc mode to full gc
53  * 6. enable Cast() check
54  * 7. enable verify heap
55  * 9. enable Proactively interrogating and collecting information in the call stack
56  */
57 #if ECMASCRIPT_ENABLE_DEBUG_MODE
58     #define ECMASCRIPT_ENABLE_IC 0
59     #define ECMASCRIPT_ENABLE_GC_LOG 1
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 #else
66     #define ECMASCRIPT_ENABLE_IC 1
67     #define ECMASCRIPT_ENABLE_GC_LOG 0
68     #define ECMASCRIPT_ENABLE_ZAP_MEM 0
69     #define ECMASCRIPT_SWITCH_GC_MODE_TO_FULL_GC 0
70     #define ECMASCRIPT_ENABLE_CAST_CHECK 0
71     #define ECMASCRIPT_ENABLE_NEW_HANDLE_CHECK 0
72     #define ECMASCRIPT_ENABLE_HEAP_VERIFY 0
73 #endif
74 
75 #if ECMASCRIPT_ENABLE_ZAP_MEM
76     constexpr int INVALID_VALUE = 0x7;
77 #endif
78 
79 #if defined(PANDA_TARGET_32)
80     #define ECMASCRIPT_DISABLE_CONCURRENT_MARKING 1
81 #else
82     #define ECMASCRIPT_DISABLE_CONCURRENT_MARKING 0
83 #endif
84 }  // namespace panda::ecmascript
85 
86 #endif  // ECMASCRIPT_BASE_CONFIG_H
87