2
0

CommonDefines.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. #include "TargetVer.h"
  7. #include "Warnings.h"
  8. //----------------------------------------------------------------------------------------------------
  9. // Chakra Core version
  10. //----------------------------------------------------------------------------------------------------
  11. #define CHAKRA_CORE_MAJOR_VERSION 1
  12. #define CHAKRA_CORE_MINOR_VERSION 1
  13. #define CHAKRA_CORE_VERSION_RELEASE 0
  14. #define CHAKRA_CORE_VERSION_PRERELEASE 1
  15. #define CHAKRA_CORE_VERSION_RELEASE_QFE 0
  16. #define CHAKRA_VERSION_RELEASE 0
  17. #define CHAKRA_VERSION_PRERELEASE 1
  18. // NOTE: need to update the GUID in ByteCodeCacheReleaseFileVersion.h as well
  19. //----------------------------------------------------------------------------------------------------
  20. // Default debug/fretest/release flags values
  21. // - Set the default values of debug/fretest/release flags if it is not set by the command line
  22. //----------------------------------------------------------------------------------------------------
  23. #ifndef DBG_DUMP
  24. #define DBG_DUMP 0
  25. #endif
  26. #ifdef _DEBUG
  27. #ifdef DEBUG
  28. #undef DEBUG
  29. #endif
  30. #define DEBUG 1
  31. #endif
  32. // if test hook is enabled, debug config options are enabled too
  33. #ifdef ENABLE_TEST_HOOKS
  34. #ifndef ENABLE_DEBUG_CONFIG_OPTIONS
  35. #define ENABLE_DEBUG_CONFIG_OPTIONS 1
  36. #endif
  37. #endif
  38. // ENABLE_DEBUG_CONFIG_OPTIONS is enabled in debug build when DBG or DBG_DUMP is defined
  39. // It is enabled in fretest build (jscript9test.dll and jc.exe) in the build script
  40. #if DBG || DBG_DUMP
  41. #ifndef ENABLE_DEBUG_CONFIG_OPTIONS
  42. #define ENABLE_DEBUG_CONFIG_OPTIONS 1
  43. #endif
  44. // Flag to control availability of other flags to control regex debugging, tracing, profiling, etc. This is separate from
  45. // ENABLE_DEBUG_CONFIG_OPTIONS because enabling this flag may affect performance significantly, even with default values for
  46. // the regex flags this flag would make available.
  47. #ifndef ENABLE_REGEX_CONFIG_OPTIONS
  48. #define ENABLE_REGEX_CONFIG_OPTIONS 1
  49. #endif
  50. #endif
  51. // TODO: consider removing before RTM: keep for CHK/FRETEST but remove from FRE.
  52. // This will cause terminate process on AV/Assert rather that letting PDM (F12/debugger scenarios) eat exceptions.
  53. // At least for now, enable this even in FRE builds. See ReportError.h.
  54. #define ENABLE_DEBUG_API_WRAPPER 1
  55. //----------------------------------------------------------------------------------------------------
  56. // Define Architectures' aliases for Simplicity
  57. //----------------------------------------------------------------------------------------------------
  58. #if defined(_M_ARM) || defined(_M_ARM64)
  59. #define _M_ARM32_OR_ARM64 1
  60. #endif
  61. #if defined(_M_IX86) || defined(_M_ARM)
  62. #define _M_IX86_OR_ARM32 1
  63. #define TARGET_32 1
  64. #endif
  65. #if defined(_M_X64) || defined(_M_ARM64)
  66. #define _M_X64_OR_ARM64 1
  67. #define TARGET_64 1
  68. #endif
  69. //----------------------------------------------------------------------------------------------------
  70. // Enabled features
  71. //----------------------------------------------------------------------------------------------------
  72. // NOTE: Disabling these might not work and are not fully supported and maintained
  73. // Even if it builds, it may not work properly. Disable at your own risk
  74. // Config options
  75. #ifdef _WIN32
  76. #define CONFIG_CONSOLE_AVAILABLE 1
  77. #define CONFIG_PARSE_CONFIG_FILE 1
  78. #define CONFIG_RICH_TRACE_FORMAT 1
  79. #else
  80. #define CONFIG_CONSOLE_AVAILABLE 0
  81. #define CONFIG_PARSE_CONFIG_FILE 0
  82. #define CONFIG_RICH_TRACE_FORMAT 0
  83. #endif
  84. // ByteCode
  85. #define VARIABLE_INT_ENCODING 1 // Byte code serialization variable size int field encoding
  86. #define BYTECODE_BRANCH_ISLAND // Byte code short branch and branch island
  87. // Language features
  88. // xplat-todo: revisit these features
  89. #ifdef _WIN32
  90. #define ENABLE_INTL_OBJECT // Intl support
  91. #endif
  92. #define ENABLE_ES6_CHAR_CLASSIFIER // ES6 Unicode character classifier support
  93. // Type system features
  94. #define PERSISTENT_INLINE_CACHES // *** TODO: Won't build if disabled currently
  95. #define SUPPORT_FIXED_FIELDS_ON_PATH_TYPES // *** TODO: Won't build if disabled currently
  96. // xplat-todo: revisit these features
  97. #ifdef _WIN32
  98. // dep: TIME_ZONE_INFORMATION, DaylightTimeHelper, Windows.Globalization
  99. #define ENABLE_GLOBALIZATION
  100. // dep: IDebugDocumentContext
  101. #define ENABLE_SCRIPT_DEBUGGING
  102. // dep: IActiveScriptProfilerCallback, IActiveScriptProfilerHeapEnum
  103. #define ENABLE_SCRIPT_PROFILING
  104. // xplat-todo: change DISABLE_SEH to ENABLE_SEH and move here
  105. #endif
  106. // GC features
  107. // Concurrent and Partial GC are disabled on non-Windows builds
  108. // xplat-todo: re-enable this in the future
  109. // These are disabled because these GC features depend on hardware
  110. // write-watch support that the Windows Memory Manager provides.
  111. #ifdef _WIN32
  112. #define SYSINFO_IMAGE_BASE_AVAILABLE 1
  113. #define ENABLE_CONCURRENT_GC 1
  114. #define ENABLE_PARTIAL_GC 1
  115. #define ENABLE_BACKGROUND_PAGE_ZEROING 1
  116. #define ENABLE_BACKGROUND_PAGE_FREEING 1
  117. #define ENABLE_RECYCLER_TYPE_TRACKING 1
  118. #else
  119. #define SYSINFO_IMAGE_BASE_AVAILABLE 0
  120. #define ENABLE_CONCURRENT_GC 0
  121. #define ENABLE_PARTIAL_GC 0
  122. #define ENABLE_BACKGROUND_PAGE_ZEROING 0
  123. #define ENABLE_BACKGROUND_PAGE_FREEING 0
  124. #define ENABLE_RECYCLER_TYPE_TRACKING 0
  125. #endif
  126. #if ENABLE_BACKGROUND_PAGE_ZEROING && !ENABLE_BACKGROUND_PAGE_FREEING
  127. #error "Background page zeroing can't be turned on if freeing pages in the background is disabled"
  128. #endif
  129. #define BUCKETIZE_MEDIUM_ALLOCATIONS 1 // *** TODO: Won't build if disabled currently
  130. #define SMALLBLOCK_MEDIUM_ALLOC 1 // *** TODO: Won't build if disabled currently
  131. #define LARGEHEAPBLOCK_ENCODING 1 // Large heap block metadata encoding
  132. #define RECYCLER_WRITE_BARRIER // Write Barrier support
  133. #define IDLE_DECOMMIT_ENABLED 1 // Idle Decommit
  134. #define RECYCLER_PAGE_HEAP // PageHeap support
  135. // JIT features
  136. #if DISABLE_JIT
  137. #define ENABLE_NATIVE_CODEGEN 0
  138. #define ENABLE_PROFILE_INFO 0
  139. #define ENABLE_BACKGROUND_JOB_PROCESSOR 0
  140. #define ENABLE_BACKGROUND_PARSING 0 // Disable background parsing in this mode
  141. // We need to decouple the Jobs infrastructure out of
  142. // Backend to make background parsing work with JIT disabled
  143. #define DYNAMIC_INTERPRETER_THUNK 0
  144. #define DISABLE_DYNAMIC_PROFILE_DEFER_PARSE
  145. #define ENABLE_COPYONACCESS_ARRAY 0
  146. // Used to temporarily disable ASMjs related code to get nonative compiling
  147. #define TEMP_DISABLE_ASMJS
  148. #else
  149. // By default, enable the JIT
  150. #define ENABLE_NATIVE_CODEGEN 1
  151. #define ENABLE_PROFILE_INFO 1
  152. #define ENABLE_BACKGROUND_JOB_PROCESSOR 1
  153. #define ENABLE_BACKGROUND_PARSING 1
  154. #define ENABLE_COPYONACCESS_ARRAY 1
  155. #ifndef DYNAMIC_INTERPRETER_THUNK
  156. #if defined(_M_IX86_OR_ARM32) || defined(_M_X64_OR_ARM64)
  157. #define DYNAMIC_INTERPRETER_THUNK 1
  158. #else
  159. #define DYNAMIC_INTERPRETER_THUNK 0
  160. #endif
  161. #endif
  162. #endif
  163. // Other features
  164. // #define CHAKRA_CORE_DOWN_COMPAT 1
  165. #if defined(ENABLE_DEBUG_CONFIG_OPTIONS) || defined(CHAKRA_CORE_DOWN_COMPAT)
  166. #define DELAYLOAD_SET_CFG_TARGET 1
  167. #endif
  168. #ifdef NTBUILD
  169. #define ENABLE_PROJECTION
  170. #define ENABLE_FOUNDATION_OBJECT
  171. #define ENABLE_EXPERIMENTAL_FLAGS
  172. #define ENABLE_WININET_PROFILE_DATA_CACHE
  173. #define ENABLE_BASIC_TELEMETRY
  174. #define ENABLE_DOM_FAST_PATH
  175. #define ENABLE_JS_ETW // ETW support
  176. #define EDIT_AND_CONTINUE
  177. #define ENABLE_JIT_CLAMP
  178. #endif
  179. // Telemetry flags
  180. #ifdef ENABLE_BASIC_TELEMETRY
  181. #define ENABLE_DIRECTCALL_TELEMETRY
  182. #endif
  183. // Telemetry features (non-DEBUG related)
  184. #ifdef ENABLE_BASIC_TELEMETRY
  185. // These defines can be "overridden" in other headers (e.g. ESBuiltInsTelemetryProvider.h) in case a specific telemetry provider wants to change an option for performance.
  186. #define TELEMETRY_OPCODE_OFFSET_ENABLED true // If the BytecodeOffset and FunctionId are logged.
  187. #define TELEMETRY_PROPERTY_OPCODE_FILTER(propertyId) true // Any filter to apply on a per propertyId basis in the opcode handler for GetProperty/TypeofProperty/GetMethodProperty/etc.
  188. #define TELEMETRY_OPCODE_GET_PROPERTY_VALUES true // If no telemetry providers need the values of properties then this option skips getting the value in the TypeofProperty opcode handler.
  189. // #define TELEMETRY_PROFILED // If telemetry should capture "Profiled*" operations
  190. // #define TELEMETRY_CACHEHIT // If telemetry should capture data that was gotten with a Cache Hit
  191. // #define TELEMETRY_JSO // If telemetry should capture JavascriptOperators (expensive, as it happens during JITed code too, not just interpreted mode)
  192. #define TELEMETRY_AddToCache // If telemetry should capture property-gets only when the propertyId is added to the cache (generally this means only the first usage of any feature is logged)
  193. // #define TELEMETRY_INTERPRETER // If telemetry should capture more interpreter events compared to just TELEMETRY_AddToCache
  194. #define TELEMETRY_TRACELOGGING // Telemetry output using TraceLogging
  195. // #define TELEMETRY_OUTPUTPRINT // Telemetry output using Output::Print
  196. // Enable/disable specific telemetry providers:
  197. #define TELEMETRY_ESB // Telemetry of ECMAScript Built-Ins usage or detection.
  198. // #define TELEMETRY_ARRAY_USAGE // Telemetry of Array usage statistics
  199. #define TELEMETRY_DateParse // Telemetry of `Date.parse`
  200. #ifdef TELEMETRY_ESB
  201. // Because ESB telemetry is in-production and has major performance implications, this redefines some of the #defines above to disable non-critical functionality to get more performance.
  202. #undef TELEMETRY_OPCODE_OFFSET_ENABLED // Disable the FunctionId+Offset tracker.
  203. #define TELEMETRY_OPCODE_OFFSET_ENABLED false
  204. #undef TELEMETRY_PROPERTY_OPCODE_FILTER // Redefine the Property Opcode filter to ignore non-built-in properties.
  205. #define TELEMETRY_PROPERTY_OPCODE_FILTER(propertyId) (propertyId < Js::PropertyIds::_countJSOnlyProperty)
  206. #undef TELEMETRY_OPCODE_GET_PROPERTY_VALUES
  207. #define TELEMETRY_OPCODE_GET_PROPERTY_VALUES false
  208. //#define TELEMETRY_ESB_STRINGS // Telemetry that uses strings (slow), used for constructor detection for ECMAScript Built-Ins polyfills and Constructor-properties of Chakra-built-ins.
  209. //#define TELEMETRY_ESB_GetConstructorPropertyPolyfillDetection // Whether telemetry will inspect the `.constructor` property of every Object instance to determine if it's a polyfill of a known ES built-in.
  210. #endif
  211. #else
  212. #define TELEMETRY_OPCODE_OFFSET_ENABLED false
  213. #define TELEMETRY_OPCODE_FILTER(propertyId) false
  214. #endif
  215. #if ENABLE_DEBUG_CONFIG_OPTIONS
  216. #define ENABLE_DIRECTCALL_TELEMETRY_STATS
  217. #endif
  218. //----------------------------------------------------------------------------------------------------
  219. // Debug and fretest features
  220. //----------------------------------------------------------------------------------------------------
  221. #ifdef ENABLE_DEBUG_CONFIG_OPTIONS
  222. #define BAILOUT_INJECTION
  223. #if ENABLE_PROFILE_INFO
  224. #define DYNAMIC_PROFILE_STORAGE
  225. #define DYNAMIC_PROFILE_MUTATOR
  226. #endif
  227. #define RUNTIME_DATA_COLLECTION
  228. #define SECURITY_TESTING
  229. // xplat-todo: Temporarily disable profile output on non-Win32 builds
  230. #ifdef _WIN32
  231. #define PROFILE_EXEC
  232. #endif
  233. #define BGJIT_STATS
  234. #define REJIT_STATS
  235. #define PERF_HINT
  236. #define POLY_INLINE_CACHE_SIZE_STATS
  237. #define JS_PROFILE_DATA_INTERFACE 1
  238. #define EXCEPTION_RECOVERY 1
  239. #define RECYCLER_TEST_SUPPORT
  240. #define ARENA_ALLOCATOR_FREE_LIST_SIZE
  241. // TODO (t-doilij) combine IR_VIEWER and ENABLE_IR_VIEWER
  242. #ifdef _M_IX86
  243. #if ENABLE_NATIVE_CODEGEN
  244. #define IR_VIEWER
  245. #define ENABLE_IR_VIEWER
  246. #define ENABLE_IR_VIEWER_DBG_DUMP // TODO (t-doilij) disable this before check-in
  247. #endif
  248. #endif
  249. #ifdef ENABLE_JS_ETW
  250. #define TEST_ETW_EVENTS
  251. // VTUNE profiling requires ETW trace
  252. #if defined(_M_IX86) || defined(_M_X64)
  253. #define VTUNE_PROFILING
  254. #endif
  255. #endif
  256. #ifdef NTBUILD
  257. #define PERF_COUNTERS
  258. #define ENABLE_MUTATION_BREAKPOINT
  259. #endif
  260. #ifdef _CONTROL_FLOW_GUARD
  261. #define CONTROL_FLOW_GUARD_LOGGER
  262. #endif
  263. #ifndef ENABLE_TEST_HOOKS
  264. #define ENABLE_TEST_HOOKS
  265. #endif
  266. #endif // ENABLE_DEBUG_CONFIG_OPTIONS
  267. //----------------------------------------------------------------------------------------------------
  268. // Debug only features
  269. //----------------------------------------------------------------------------------------------------
  270. #ifdef DEBUG
  271. #define BYTECODE_TESTING
  272. // xplat-todo: revive FaultInjection on non-Win32 platforms
  273. // currently depends on io.h
  274. #ifdef _WIN32
  275. #define FAULT_INJECTION
  276. #endif
  277. #define RECYCLER_NO_PAGE_REUSE
  278. #ifdef NTBUILD
  279. #define INTERNAL_MEM_PROTECT_HEAP_ALLOC
  280. #define INTERNAL_MEM_PROTECT_HEAP_CMDLINE
  281. #endif
  282. #endif
  283. #ifdef DBG
  284. #define VALIDATE_ARRAY
  285. // xplat-todo: Do we need dump generation for non-Win32 platforms?
  286. #ifdef _WIN32
  287. #define GENERATE_DUMP
  288. #endif
  289. #endif
  290. #if DBG_DUMP
  291. #undef DBG_EXTRAFIELD // make sure we don't extra fields in free build.
  292. #define TRACK_DISPATCH
  293. #define BGJIT_STATS
  294. #define REJIT_STATS
  295. #define POLY_INLINE_CACHE_SIZE_STATS
  296. #define INLINE_CACHE_STATS
  297. #define FIELD_ACCESS_STATS
  298. #define MISSING_PROPERTY_STATS
  299. #define EXCEPTION_RECOVERY 1
  300. #define EXCEPTION_CHECK // Check exception handling.
  301. #ifdef _WIN32
  302. #define PROFILE_EXEC
  303. #endif
  304. #define PROFILE_MEM
  305. #define PROFILE_TYPES
  306. #define PROFILE_EVALMAP
  307. #define PROFILE_OBJECT_LITERALS
  308. #define PROFILE_BAILOUT_RECORD_MEMORY
  309. #define MEMSPECT_TRACKING
  310. // xplat-todo: Depends on C++ type-info
  311. // enable later on non-VC++ compilers
  312. #ifdef _WIN32
  313. #define PROFILE_RECYCLER_ALLOC
  314. // Needs to compile in debug mode
  315. // Just needs strings converted
  316. #define PROFILE_DICTIONARY 1
  317. #endif
  318. #define PROFILE_STRINGS
  319. #define RECYCLER_SLOW_CHECK_ENABLED // This can be disabled to speed up the debug build's GC
  320. #define RECYCLER_STRESS
  321. #define RECYCLER_STATS
  322. #define RECYCLER_FINALIZE_CHECK
  323. #define RECYCLER_FREE_MEM_FILL
  324. #define RECYCLER_DUMP_OBJECT_GRAPH
  325. #define RECYCLER_MEMORY_VERIFY
  326. #define RECYCLER_ZERO_MEM_CHECK
  327. #define RECYCLER_TRACE
  328. #define RECYCLER_VERIFY_MARK
  329. #ifdef PERF_COUNTERS
  330. #define RECYCLER_PERF_COUNTERS
  331. #define HEAP_PERF_COUNTERS
  332. #endif // PERF_COUNTERS
  333. #define PAGEALLOCATOR_PROTECT_FREEPAGE
  334. #define ARENA_MEMORY_VERIFY
  335. #define SEPARATE_ARENA
  336. // xplat-todo: This depends on C++ type-tracking
  337. // Need to re-enable on non-VC++ compilers
  338. #ifdef _WIN32
  339. #define HEAP_TRACK_ALLOC
  340. #endif
  341. #define CHECK_MEMORY_LEAK
  342. #define LEAK_REPORT
  343. #define PROJECTION_METADATA_TRACE
  344. #define ERROR_TRACE
  345. #define DEBUGGER_TRACE
  346. #define PROPERTY_RECORD_TRACE
  347. #define ARENA_ALLOCATOR_FREE_LIST_SIZE
  348. #ifdef DBG_EXTRAFIELD
  349. #define HEAP_ENUMERATION_VALIDATION
  350. #endif
  351. #endif // DBG_DUMP
  352. //----------------------------------------------------------------------------------------------------
  353. // Special build features
  354. // - features that can be enabled on private builds for debugging
  355. //----------------------------------------------------------------------------------------------------
  356. #ifdef ENABLE_JS_ETW
  357. // #define ETW_MEMORY_TRACKING // ETW events for internal allocations
  358. #endif
  359. // #define OLD_ITRACKER // Switch to the old IE8 ITracker GUID
  360. // #define LOG_BYTECODE_AST_RATIO // log the ratio between AST size and bytecode generated.
  361. // #define DUMP_FRAGMENTATION_STATS // Display HeapBucket fragmentation stats after sweep
  362. // ----- Fretest or free build special build features (already enabled in debug builds) -----
  363. // #define TRACK_DISPATCH
  364. // #define BGJIT_STATS
  365. // Profile defines that can be enabled in release build
  366. // #define PROFILE_EXEC
  367. // #define PROFILE_MEM
  368. // #define PROFILE_STRINGS
  369. // #define PROFILE_TYPES
  370. // #define PROFILE_OBJECT_LITERALS
  371. // #define PROFILE_RECYCLER_ALLOC
  372. // #define MEMSPECT_TRACKING
  373. // #define HEAP_TRACK_ALLOC
  374. // Recycler defines that can be enabled in release build
  375. // #define RECYCLER_STRESS
  376. // #define RECYCLER_STATS
  377. // #define RECYCLER_FINALIZE_CHECK
  378. // #define RECYCLER_FREE_MEM_FILL
  379. // #define RECYCLER_DUMP_OBJECT_GRAPH
  380. // #define RECYCLER_MEMORY_VERIFY
  381. // #define RECYCLER_TRACE
  382. // #define RECYCLER_VERIFY_MARK
  383. // #ifdef PERF_COUNTERS
  384. // #define RECYCLER_PERF_COUNTERS
  385. // #define HEAP_PERF_COUNTERS
  386. // #endif //PERF_COUNTERS
  387. // Other defines that can be enabled in release build
  388. // #define PAGEALLOCATOR_PROTECT_FREEPAGE
  389. // #define ARENA_MEMORY_VERIFY
  390. // #define SEPARATE_ARENA
  391. // #define LEAK_REPORT
  392. // #define CHECK_MEMORY_LEAK
  393. // #define RECYCLER_MARK_TRACK
  394. // #define INTERNAL_MEM_PROTECT_HEAP_ALLOC
  395. //----------------------------------------------------------------------------------------------------
  396. // Disabled features
  397. //----------------------------------------------------------------------------------------------------
  398. //Enable/disable dom properties
  399. #define DOMEnabled 0
  400. //----------------------------------------------------------------------------------------------------
  401. // Platform dependent flags
  402. //----------------------------------------------------------------------------------------------------
  403. #ifndef INT32VAR
  404. #if defined(_M_X64_OR_ARM64)
  405. #define INT32VAR 1
  406. #else
  407. #define INT32VAR 0
  408. #endif
  409. #endif
  410. #ifndef FLOATVAR
  411. #if defined(_M_X64)
  412. #define FLOATVAR 1
  413. #else
  414. #define FLOATVAR 0
  415. #endif
  416. #endif
  417. #if defined(_M_IX86) || defined(_M_X64)
  418. #ifndef TEMP_DISABLE_ASMJS
  419. #define ASMJS_PLAT
  420. #endif
  421. #endif
  422. #if _WIN32 || _WIN64
  423. #if _M_IX86
  424. #define I386_ASM 1
  425. #endif //_M_IX86
  426. #ifndef PDATA_ENABLED
  427. #if defined(_M_ARM32_OR_ARM64) || defined(_M_X64)
  428. #define PDATA_ENABLED 1
  429. #else
  430. #define PDATA_ENABLED 0
  431. #endif
  432. #endif
  433. #endif // _WIN32 || _WIN64
  434. #ifndef _WIN32
  435. #define DISABLE_SEH 1
  436. #endif
  437. //----------------------------------------------------------------------------------------------------
  438. // Dependent flags
  439. // - flags values that are dependent on other flags
  440. //----------------------------------------------------------------------------------------------------
  441. #if !ENABLE_CONCURRENT_GC
  442. #undef IDLE_DECOMMIT_ENABLED // Currently idle decommit can only be enabled if concurrent gc is enabled
  443. #endif
  444. #ifdef BAILOUT_INJECTION
  445. #define ENABLE_PREJIT
  446. #endif
  447. #if defined(ENABLE_DEBUG_CONFIG_OPTIONS)
  448. // Enable Output::Trace
  449. #define ENABLE_TRACE
  450. #endif
  451. // xplat-todo: Capture stack backtrace on non-win32 platforms
  452. #ifdef _WIN32
  453. #if DBG || defined(CHECK_MEMORY_LEAK) || defined(LEAK_REPORT) || defined(TRACK_DISPATCH) || defined(ENABLE_TRACE) || defined(RECYCLER_PAGE_HEAP)
  454. #define STACK_BACK_TRACE
  455. #endif
  456. #endif
  457. #if defined(STACK_BACK_TRACE) || defined(CONTROL_FLOW_GUARD_LOGGER)
  458. #define DBGHELP_SYMBOL_MANAGER
  459. #endif
  460. #if defined(TRACK_DISPATCH) || defined(CHECK_MEMORY_LEAK) || defined(LEAK_REPORT)
  461. #define TRACK_JS_DISPATCH
  462. #endif
  463. // LEAK_REPORT and CHECK_MEMORY_LEAK requires RECYCLER_DUMP_OBJECT_GRAPH
  464. // HEAP_TRACK_ALLOC and RECYCLER_STATS
  465. #if defined(LEAK_REPORT) || defined(CHECK_MEMORY_LEAK)
  466. #define RECYCLER_DUMP_OBJECT_GRAPH
  467. #ifdef _WIN32
  468. #define HEAP_TRACK_ALLOC
  469. #endif
  470. #define RECYCLER_STATS
  471. #endif
  472. // PROFILE_RECYCLER_ALLOC requires PROFILE_MEM
  473. #if defined(PROFILE_RECYCLER_ALLOC) && !defined(PROFILE_MEM)
  474. #define PROFILE_MEM
  475. #endif
  476. // RECYCLER_DUMP_OBJECT_GRAPH is needed when using PROFILE_RECYCLER_ALLOC
  477. #if defined(PROFILE_RECYCLER_ALLOC) && !defined(RECYCLER_DUMP_OBJECT_GRAPH)
  478. #define RECYCLER_DUMP_OBJECT_GRAPH
  479. #endif
  480. #if defined(HEAP_TRACK_ALLOC) || defined(PROFILE_RECYCLER_ALLOC)
  481. #ifndef _WIN32
  482. #error "Not yet supported on non-VC++ compiler"
  483. #endif
  484. #define TRACK_ALLOC
  485. #define TRACE_OBJECT_LIFETIME // track a particular object's lifetime
  486. #endif
  487. #if defined(USED_IN_STATIC_LIB)
  488. #undef FAULT_INJECTION
  489. #undef RECYCLER_DUMP_OBJECT_GRAPH
  490. #undef HEAP_TRACK_ALLOC
  491. #undef RECYCLER_STATS
  492. #undef PERF_COUNTERS
  493. #endif
  494. // Not having the config options enabled trumps all the above logic for these switches
  495. #ifndef ENABLE_DEBUG_CONFIG_OPTIONS
  496. #undef ARENA_MEMORY_VERIFY
  497. #undef RECYCLER_MEMORY_VERIFY
  498. #undef PROFILE_MEM
  499. #undef PROFILE_DICTIONARY
  500. #undef PROFILE_RECYCLER_ALLOC
  501. #undef PROFILE_EXEC
  502. #undef PROFILE_EVALMAP
  503. #undef FAULT_INJECTION
  504. #undef RECYCLER_STRESS
  505. #undef RECYCLER_SLOW_VERIFY
  506. #undef RECYCLER_VERIFY_MARK
  507. #undef RECYCLER_STATS
  508. #undef RECYCLER_FINALIZE_CHECK
  509. #undef RECYCLER_DUMP_OBJECT_GRAPH
  510. #undef DBG_DUMP
  511. #undef BGJIT_STATS
  512. #undef EXCEPTION_RECOVERY
  513. #undef PROFILE_STRINGS
  514. #undef PROFILE_TYPES
  515. #undef PROFILE_OBJECT_LITERALS
  516. #undef SECURITY_TESTING
  517. #undef LEAK_REPORT
  518. #endif
  519. //----------------------------------------------------------------------------------------------------
  520. // Default flags values
  521. // - Set the default values of flags if it is not set by the command line or above
  522. //----------------------------------------------------------------------------------------------------
  523. #ifndef JS_PROFILE_DATA_INTERFACE
  524. #define JS_PROFILE_DATA_INTERFACE 0
  525. #endif
  526. #ifndef PROFILE_DICTIONARY
  527. #define PROFILE_DICTIONARY 0
  528. #endif