| 1 | /* Copyright JS Foundation and other contributors, http://js.foundation |
| 2 | * |
| 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 JERRYSCRIPT_CONFIG_H |
| 17 | #define JERRYSCRIPT_CONFIG_H |
| 18 | |
| 19 | // @JERRY_BUILD_CFG@ |
| 20 | |
| 21 | /** |
| 22 | * Built-in configurations |
| 23 | * |
| 24 | * Allowed values for built-in defines: |
| 25 | * 0: Disable the given built-in. |
| 26 | * 1: Enable the given built-in. |
| 27 | */ |
| 28 | /* |
| 29 | * By default all built-ins are enabled if they are not defined. |
| 30 | */ |
| 31 | #ifndef JERRY_BUILTINS |
| 32 | # define JERRY_BUILTINS 1 |
| 33 | #endif /* !defined (JERRY_BUILTINS) */ |
| 34 | |
| 35 | #ifndef JERRY_BUILTIN_ANNEXB |
| 36 | # define JERRY_BUILTIN_ANNEXB JERRY_BUILTINS |
| 37 | #endif /* !defined (JERRY_BUILTIN_ANNEXB) */ |
| 38 | |
| 39 | #ifndef JERRY_BUILTIN_ARRAY |
| 40 | # define JERRY_BUILTIN_ARRAY JERRY_BUILTINS |
| 41 | #endif /* !defined (JERRY_BUILTIN_ARRAY) */ |
| 42 | |
| 43 | #ifndef JERRY_BUILTIN_BOOLEAN |
| 44 | # define JERRY_BUILTIN_BOOLEAN JERRY_BUILTINS |
| 45 | #endif /* !defined (JERRY_BUILTIN_BOOLEAN) */ |
| 46 | |
| 47 | #ifndef JERRY_BUILTIN_DATE |
| 48 | # define JERRY_BUILTIN_DATE JERRY_BUILTINS |
| 49 | #endif /* !defined (JERRY_BUILTIN_DATE) */ |
| 50 | |
| 51 | #ifndef JERRY_BUILTIN_ERRORS |
| 52 | # define JERRY_BUILTIN_ERRORS JERRY_BUILTINS |
| 53 | #endif /* !defined (JERRY_BUILTIN_ERRORS) */ |
| 54 | |
| 55 | #ifndef JERRY_BUILTIN_JSON |
| 56 | # define JERRY_BUILTIN_JSON JERRY_BUILTINS |
| 57 | #endif /* !defined (JERRY_BUILTIN_JSON) */ |
| 58 | |
| 59 | #ifndef JERRY_BUILTIN_MATH |
| 60 | # define JERRY_BUILTIN_MATH JERRY_BUILTINS |
| 61 | #endif /* !defined (JERRY_BUILTIN_MATH) */ |
| 62 | |
| 63 | #ifndef JERRY_BUILTIN_NUMBER |
| 64 | # define JERRY_BUILTIN_NUMBER JERRY_BUILTINS |
| 65 | #endif /* !defined (JERRY_BUILTIN_NUMBER) */ |
| 66 | |
| 67 | #ifndef JERRY_BUILTIN_REGEXP |
| 68 | # define JERRY_BUILTIN_REGEXP JERRY_BUILTINS |
| 69 | #endif /* !defined (JERRY_BUILTIN_REGEXP) */ |
| 70 | |
| 71 | #ifndef JERRY_BUILTIN_STRING |
| 72 | # define JERRY_BUILTIN_STRING JERRY_BUILTINS |
| 73 | #endif /* !defined (JERRY_BUILTIN_STRING) */ |
| 74 | |
| 75 | /** |
| 76 | * ES2015+ related features, by default all of them are enabled. |
| 77 | */ |
| 78 | #ifndef JERRY_ESNEXT |
| 79 | # define JERRY_ESNEXT 1 |
| 80 | #endif /* !defined (JERRY_ESNEXT) */ |
| 81 | |
| 82 | #ifndef JERRY_BUILTIN_BIGINT |
| 83 | # define JERRY_BUILTIN_BIGINT JERRY_ESNEXT |
| 84 | #endif /* !defined (JERRY_BUILTIN_BIGINT) */ |
| 85 | |
| 86 | #ifndef JERRY_BUILTIN_DATAVIEW |
| 87 | # define JERRY_BUILTIN_DATAVIEW JERRY_ESNEXT |
| 88 | #endif /* !defined (JERRY_BUILTIN_DATAVIEW) */ |
| 89 | |
| 90 | #ifndef JERRY_BUILTIN_MAP |
| 91 | # define JERRY_BUILTIN_MAP JERRY_ESNEXT |
| 92 | #endif /* !defined (JERRY_BUILTIN_MAP) */ |
| 93 | |
| 94 | #ifndef JERRY_BUILTIN_PROMISE |
| 95 | # define JERRY_BUILTIN_PROMISE JERRY_ESNEXT |
| 96 | #endif /* !defined (JERRY_BUILTIN_PROMISE) */ |
| 97 | |
| 98 | #ifndef JERRY_BUILTIN_PROXY |
| 99 | # define JERRY_BUILTIN_PROXY JERRY_ESNEXT |
| 100 | #endif /* !defined (JERRY_BUILTIN_PROXY) */ |
| 101 | |
| 102 | #ifndef JERRY_BUILTIN_REALMS |
| 103 | # define JERRY_BUILTIN_REALMS JERRY_ESNEXT |
| 104 | #endif /* !defined (JERRY_BUILTIN_REALMS) */ |
| 105 | |
| 106 | #ifndef JERRY_BUILTIN_REFLECT |
| 107 | # define JERRY_BUILTIN_REFLECT JERRY_ESNEXT |
| 108 | #endif /* !defined (JERRY_BUILTIN_REFLECT) */ |
| 109 | |
| 110 | #ifndef JERRY_BUILTIN_SET |
| 111 | # define JERRY_BUILTIN_SET JERRY_ESNEXT |
| 112 | #endif /* !defined (JERRY_BUILTIN_SET) */ |
| 113 | |
| 114 | #ifndef JERRY_BUILTIN_TYPEDARRAY |
| 115 | # define JERRY_BUILTIN_TYPEDARRAY JERRY_ESNEXT |
| 116 | #endif /* !defined (JERRY_BUILTIN_TYPEDARRAY) */ |
| 117 | |
| 118 | #ifndef JERRY_BUILTIN_WEAKMAP |
| 119 | # define JERRY_BUILTIN_WEAKMAP JERRY_ESNEXT |
| 120 | #endif /* !defined (JERRY_BUILTIN_WEAKMAP) */ |
| 121 | |
| 122 | #ifndef JERRY_BUILTIN_WEAKSET |
| 123 | # define JERRY_BUILTIN_WEAKSET JERRY_ESNEXT |
| 124 | #endif /* !defined (JERRY_BUILTIN_WEAKSET) */ |
| 125 | |
| 126 | #ifndef JERRY_MODULE_SYSTEM |
| 127 | # define JERRY_MODULE_SYSTEM JERRY_ESNEXT |
| 128 | #endif /* !defined (JERRY_MODULE_SYSTEM) */ |
| 129 | |
| 130 | /** |
| 131 | * Engine internal and misc configurations. |
| 132 | */ |
| 133 | |
| 134 | /** |
| 135 | * Specifies the compressed pointer representation |
| 136 | * |
| 137 | * Allowed values: |
| 138 | * 0: use 16 bit representation |
| 139 | * 1: use 32 bit representation |
| 140 | * |
| 141 | * Default value: 0 |
| 142 | * For more details see: jmem/jmem.h |
| 143 | */ |
| 144 | #ifndef JERRY_CPOINTER_32_BIT |
| 145 | # define JERRY_CPOINTER_32_BIT 0 |
| 146 | #endif /* !defined (JERRY_CPOINTER_32_BIT) */ |
| 147 | |
| 148 | /** |
| 149 | * Enable/Disable the engine's JavaScript debugger interface |
| 150 | * |
| 151 | * Allowed values: |
| 152 | * 0: Disable the debugger parts. |
| 153 | * 1: Enable the debugger. |
| 154 | */ |
| 155 | #ifndef JERRY_DEBUGGER |
| 156 | # define JERRY_DEBUGGER 0 |
| 157 | #endif /* !defined (JERRY_DEBUGGER) */ |
| 158 | |
| 159 | /** |
| 160 | * Enable/Disable built-in error messages for error objects. |
| 161 | * |
| 162 | * Allowed values: |
| 163 | * 0: Disable error messages. |
| 164 | * 1: Enable error message. |
| 165 | * |
| 166 | * Default value: 0 |
| 167 | */ |
| 168 | #ifndef JERRY_ERROR_MESSAGES |
| 169 | # define JERRY_ERROR_MESSAGES 0 |
| 170 | #endif /* !defined (JERRY_ERROR_MESSAGES) */ |
| 171 | |
| 172 | /** |
| 173 | * Enable/Disable external context. |
| 174 | * |
| 175 | * Allowed values: |
| 176 | * 0: Disable external context. |
| 177 | * 1: Enable external context support. |
| 178 | * |
| 179 | * Default value: 0 |
| 180 | */ |
| 181 | #ifndef JERRY_EXTERNAL_CONTEXT |
| 182 | # define JERRY_EXTERNAL_CONTEXT 0 |
| 183 | #endif /* !defined (JERRY_EXTERNAL_CONTEXT) */ |
| 184 | |
| 185 | /** |
| 186 | * Maximum size of heap in kilobytes |
| 187 | * |
| 188 | * Default value: 512 KiB |
| 189 | */ |
| 190 | #ifndef JERRY_GLOBAL_HEAP_SIZE |
| 191 | # define JERRY_GLOBAL_HEAP_SIZE (512) |
| 192 | #endif /* !defined (JERRY_GLOBAL_HEAP_SIZE) */ |
| 193 | |
| 194 | /** |
| 195 | * The allowed heap usage limit until next garbage collection, in bytes. |
| 196 | * |
| 197 | * If value is 0, the default is 1/32 of JERRY_HEAP_SIZE |
| 198 | */ |
| 199 | #ifndef JERRY_GC_LIMIT |
| 200 | # define JERRY_GC_LIMIT 0 |
| 201 | #endif /* !defined (JERRY_GC_LIMIT) */ |
| 202 | |
| 203 | /** |
| 204 | * Maximum stack usage size in kilobytes |
| 205 | * |
| 206 | * Note: This feature cannot be used when 'detect_stack_use_after_return=1' ASAN option is enabled. |
| 207 | * For more detailed description: |
| 208 | * - https://github.com/google/sanitizers/wiki/AddressSanitizerUseAfterReturn#compatibility |
| 209 | * |
| 210 | * Default value: 0, unlimited |
| 211 | */ |
| 212 | #ifndef JERRY_STACK_LIMIT |
| 213 | # define JERRY_STACK_LIMIT (0) |
| 214 | #endif /* !defined (JERRY_STACK_LIMIT) */ |
| 215 | |
| 216 | /** |
| 217 | * Maximum depth of recursion during GC mark phase |
| 218 | * |
| 219 | * Default value: 8 |
| 220 | */ |
| 221 | #ifndef JERRY_GC_MARK_LIMIT |
| 222 | # define JERRY_GC_MARK_LIMIT (8) |
| 223 | #endif /* !defined (JERRY_GC_MARK_LIMIT) */ |
| 224 | |
| 225 | /** |
| 226 | * Enable/Disable property lookup cache. |
| 227 | * |
| 228 | * Allowed values: |
| 229 | * 0: Disable lookup cache. |
| 230 | * 1: Enable lookup cache. |
| 231 | * |
| 232 | * Default value: 1 |
| 233 | */ |
| 234 | #ifndef JERRY_LCACHE |
| 235 | # define JERRY_LCACHE 1 |
| 236 | #endif /* !defined (JERRY_LCACHE) */ |
| 237 | |
| 238 | /** |
| 239 | * Enable/Disable line-info management inside the engine. |
| 240 | * |
| 241 | * Allowed values: |
| 242 | * 0: Disable line-info in the engine. |
| 243 | * 1: Enable line-info management. |
| 244 | * |
| 245 | * Default value: 0 |
| 246 | */ |
| 247 | #ifndef JERRY_LINE_INFO |
| 248 | # define JERRY_LINE_INFO 0 |
| 249 | #endif /* !defined (JERRY_LINE_INFO) */ |
| 250 | |
| 251 | /** |
| 252 | * Enable/Disable logging inside the engine. |
| 253 | * |
| 254 | * Allowed values: |
| 255 | * 0: Disable internal logging. |
| 256 | * 1: Enable internal logging. |
| 257 | * |
| 258 | * Default value: 0 |
| 259 | */ |
| 260 | #ifndef JERRY_LOGGING |
| 261 | # define JERRY_LOGGING 0 |
| 262 | #endif /* !defined (JERRY_LOGGING) */ |
| 263 | |
| 264 | /** |
| 265 | * Enable/Disable gc call before every allocation. |
| 266 | * |
| 267 | * Allowed values: |
| 268 | * 0: Disable gc call before each allocation. |
| 269 | * 1: Enable and force gc call before each allocation. |
| 270 | * |
| 271 | * Default value: 0 |
| 272 | * Warning!: This is an advanced option and will slow down the engine! |
| 273 | * Only enable it for debugging purposes. |
| 274 | */ |
| 275 | #ifndef JERRY_MEM_GC_BEFORE_EACH_ALLOC |
| 276 | # define JERRY_MEM_GC_BEFORE_EACH_ALLOC 0 |
| 277 | #endif /* !defined (JERRY_MEM_GC_BEFORE_EACH_ALLOC) */ |
| 278 | |
| 279 | /** |
| 280 | * Enable/Disable the collection if run-time memory statistics. |
| 281 | * |
| 282 | * Allowed values: |
| 283 | * 0: Disable run-time memory information collection. |
| 284 | * 1: Enable run-time memory statistics collection. |
| 285 | * |
| 286 | * Default value: 0 |
| 287 | */ |
| 288 | #ifndef JERRY_MEM_STATS |
| 289 | # define JERRY_MEM_STATS 0 |
| 290 | #endif /* !defined (JERRY_MEM_STATS) */ |
| 291 | |
| 292 | /** |
| 293 | * Use 32-bit/64-bit float for ecma-numbers |
| 294 | * This option is for expert use only! |
| 295 | * |
| 296 | * Allowed values: |
| 297 | * 1: use 64-bit floating point number mode |
| 298 | * 0: use 32-bit floating point number mode |
| 299 | * |
| 300 | * Default value: 1 |
| 301 | */ |
| 302 | #ifndef JERRY_NUMBER_TYPE_FLOAT64 |
| 303 | # define JERRY_NUMBER_TYPE_FLOAT64 1 |
| 304 | #endif /* !defined (JERRY_NUMBER_TYPE_FLOAT64 */ |
| 305 | |
| 306 | /** |
| 307 | * Enable/Disable the JavaScript parser. |
| 308 | * |
| 309 | * Allowed values: |
| 310 | * 0: Disable the JavaScript parser and all related functionallity. |
| 311 | * 1: Enable the JavaScript parser. |
| 312 | * |
| 313 | * Default value: 1 |
| 314 | */ |
| 315 | #ifndef JERRY_PARSER |
| 316 | # define JERRY_PARSER 1 |
| 317 | #endif /* !defined (JERRY_PARSER) */ |
| 318 | |
| 319 | /** |
| 320 | * Enable/Disable JerryScript byte code dump functions during parsing. |
| 321 | * To dump the JerryScript byte code the engine must be initialized with opcodes |
| 322 | * display flag. This option does not influence RegExp byte code dumps. |
| 323 | * |
| 324 | * Allowed values: |
| 325 | * 0: Disable all bytecode dump functions. |
| 326 | * 1: Enable bytecode dump functions. |
| 327 | * |
| 328 | * Default value: 0 |
| 329 | */ |
| 330 | #ifndef JERRY_PARSER_DUMP_BYTE_CODE |
| 331 | # define JERRY_PARSER_DUMP_BYTE_CODE 0 |
| 332 | #endif /* defined (JERRY_PARSER_DUMP_BYTE_CODE) */ |
| 333 | |
| 334 | /** |
| 335 | * Enable/Disable ECMA property hashmap. |
| 336 | * |
| 337 | * Allowed values: |
| 338 | * 0: Disable property hasmap. |
| 339 | * 1: Enable property hashmap. |
| 340 | * |
| 341 | * Default value: 1 |
| 342 | */ |
| 343 | #ifndef JERRY_PROPRETY_HASHMAP |
| 344 | # define JERRY_PROPRETY_HASHMAP 1 |
| 345 | #endif /* !defined (JERRY_PROPRETY_HASHMAP) */ |
| 346 | |
| 347 | /** |
| 348 | * Enable/Disable byte code dump functions for RegExp objects. |
| 349 | * To dump the RegExp byte code the engine must be initialized with |
| 350 | * regexp opcodes display flag. This option does not influence the |
| 351 | * JerryScript byte code dumps. |
| 352 | * |
| 353 | * Allowed values: |
| 354 | * 0: Disable all bytecode dump functions. |
| 355 | * 1: Enable bytecode dump functions. |
| 356 | * |
| 357 | * Default value: 0 |
| 358 | */ |
| 359 | #ifndef JERRY_REGEXP_DUMP_BYTE_CODE |
| 360 | # define JERRY_REGEXP_DUMP_BYTE_CODE 0 |
| 361 | #endif /* !defined (JERRY_REGEXP_DUMP_BYTE_CODE) */ |
| 362 | |
| 363 | /** |
| 364 | * Enables/disables the RegExp strict mode |
| 365 | * |
| 366 | * Default value: 0 |
| 367 | */ |
| 368 | #ifndef JERRY_REGEXP_STRICT_MODE |
| 369 | # define JERRY_REGEXP_STRICT_MODE 0 |
| 370 | #endif /* !defined (JERRY_REGEXP_STRICT_MODE) */ |
| 371 | |
| 372 | /** |
| 373 | * Enable/Disable the snapshot execution functions. |
| 374 | * |
| 375 | * Allowed values: |
| 376 | * 0: Disable snapshot execution. |
| 377 | * 1: Enable snapshot execution. |
| 378 | * |
| 379 | * Default value: 0 |
| 380 | */ |
| 381 | #ifndef JERRY_SNAPSHOT_EXEC |
| 382 | # define JERRY_SNAPSHOT_EXEC 0 |
| 383 | #endif /* !defined (JERRY_SNAPSHOT_EXEC) */ |
| 384 | |
| 385 | /** |
| 386 | * Enable/Disable the snapshot save functions. |
| 387 | * |
| 388 | * Allowed values: |
| 389 | * 0: Disable snapshot save functions. |
| 390 | * 1: Enable snapshot save functions. |
| 391 | */ |
| 392 | #ifndef JERRY_SNAPSHOT_SAVE |
| 393 | # define JERRY_SNAPSHOT_SAVE 0 |
| 394 | #endif /* !defined (JERRY_SNAPSHOT_SAVE) */ |
| 395 | |
| 396 | /** |
| 397 | * Enable/Disable usage of system allocator. |
| 398 | * |
| 399 | * Allowed values: |
| 400 | * 0: Disable usage of system allocator. |
| 401 | * 1: Enable usage of system allocator. |
| 402 | * |
| 403 | * Default value: 0 |
| 404 | */ |
| 405 | #ifndef JERRY_SYSTEM_ALLOCATOR |
| 406 | # define JERRY_SYSTEM_ALLOCATOR 0 |
| 407 | #endif /* !defined (JERRY_SYSTEM_ALLOCATOR) */ |
| 408 | |
| 409 | /** |
| 410 | * Enables/disables the unicode case conversion in the engine. |
| 411 | * By default Unicode case conversion is enabled. |
| 412 | */ |
| 413 | #ifndef JERRY_UNICODE_CASE_CONVERSION |
| 414 | # define JERRY_UNICODE_CASE_CONVERSION 1 |
| 415 | #endif /* !defined (JERRY_UNICODE_CASE_CONVERSION) */ |
| 416 | |
| 417 | /** |
| 418 | * Configures if the internal memory allocations are exposed to Valgrind or not. |
| 419 | * |
| 420 | * Allowed values: |
| 421 | * 0: Disable the Valgrind specific memory allocation notifications. |
| 422 | * 1: Enable the Valgrind specific allocation notifications. |
| 423 | */ |
| 424 | #ifndef JERRY_VALGRIND |
| 425 | # define JERRY_VALGRIND 0 |
| 426 | #endif /* !defined (JERRY_VALGRIND) */ |
| 427 | |
| 428 | /** |
| 429 | * Enable/Disable the vm execution stop callback function. |
| 430 | * |
| 431 | * Allowed values: |
| 432 | * 0: Disable vm exec stop callbacks. |
| 433 | * 1: Enable vm exec stop callback functionality. |
| 434 | */ |
| 435 | #ifndef JERRY_VM_EXEC_STOP |
| 436 | # define JERRY_VM_EXEC_STOP 0 |
| 437 | #endif /* !defined (JERRY_VM_EXEC_STOP) */ |
| 438 | |
| 439 | /** |
| 440 | * Advanced section configurations. |
| 441 | */ |
| 442 | |
| 443 | /** |
| 444 | * Allow configuring attributes on a few constant data inside the engine. |
| 445 | * |
| 446 | * One of the main usages: |
| 447 | * Normally compilers store const(ant)s in ROM. Thus saving RAM. |
| 448 | * But if your compiler does not support it then the directive below can force it. |
| 449 | * |
| 450 | * For the moment it is mainly meant for the following targets: |
| 451 | * - ESP8266 |
| 452 | * |
| 453 | * Example configuration for moving (some) constatns into a given section: |
| 454 | * # define JERRY_ATTR_CONST_DATA __attribute__((section(".rodata.const"))) |
| 455 | */ |
| 456 | #ifndef JERRY_ATTR_CONST_DATA |
| 457 | # define JERRY_ATTR_CONST_DATA |
| 458 | #endif /* !defined (JERRY_ATTR_CONST_DATA) */ |
| 459 | |
| 460 | /** |
| 461 | * The JERRY_ATTR_GLOBAL_HEAP allows adding extra attributes for the Jerry global heap. |
| 462 | * |
| 463 | * Example on how to move the global heap into it's own section: |
| 464 | * #define JERRY_ATTR_GLOBAL_HEAP __attribute__((section(".text.globalheap"))) |
| 465 | */ |
| 466 | #ifndef JERRY_ATTR_GLOBAL_HEAP |
| 467 | # define JERRY_ATTR_GLOBAL_HEAP |
| 468 | #endif /* !defined (JERRY_ATTR_GLOBAL_HEAP) */ |
| 469 | |
| 470 | /** |
| 471 | * Sanity check for macros to see if the values are 0 or 1 |
| 472 | * |
| 473 | * If a new feature is added this should be updated. |
| 474 | */ |
| 475 | /** |
| 476 | * Check base builtins. |
| 477 | */ |
| 478 | #if !defined (JERRY_BUILTIN_ANNEXB) \ |
| 479 | || ((JERRY_BUILTIN_ANNEXB != 0) && (JERRY_BUILTIN_ANNEXB != 1)) |
| 480 | # error "Invalid value for JERRY_BUILTIN_ANNEXB macro." |
| 481 | #endif |
| 482 | #if !defined (JERRY_BUILTIN_ARRAY) \ |
| 483 | || ((JERRY_BUILTIN_ARRAY != 0) && (JERRY_BUILTIN_ARRAY != 1)) |
| 484 | # error "Invalid value for JERRY_BUILTIN_ARRAY macro." |
| 485 | #endif |
| 486 | #if !defined (JERRY_BUILTIN_BOOLEAN) \ |
| 487 | || ((JERRY_BUILTIN_BOOLEAN != 0) && (JERRY_BUILTIN_BOOLEAN != 1)) |
| 488 | # error "Invalid value for JERRY_BUILTIN_BOOLEAN macro." |
| 489 | #endif |
| 490 | #if !defined (JERRY_BUILTIN_DATE) \ |
| 491 | || ((JERRY_BUILTIN_DATE != 0) && (JERRY_BUILTIN_DATE != 1)) |
| 492 | # error "Invalid value for JERRY_BUILTIN_DATE macro." |
| 493 | #endif |
| 494 | #if !defined (JERRY_BUILTIN_ERRORS) \ |
| 495 | || ((JERRY_BUILTIN_ERRORS != 0) && (JERRY_BUILTIN_ERRORS != 1)) |
| 496 | # error "Invalid value for JERRY_BUILTIN_ERRORS macro." |
| 497 | #endif |
| 498 | #if !defined (JERRY_BUILTIN_JSON) \ |
| 499 | || ((JERRY_BUILTIN_JSON != 0) && (JERRY_BUILTIN_JSON != 1)) |
| 500 | # error "Invalid value for JERRY_BUILTIN_JSON macro." |
| 501 | #endif |
| 502 | #if !defined (JERRY_BUILTIN_MATH) \ |
| 503 | || ((JERRY_BUILTIN_MATH != 0) && (JERRY_BUILTIN_MATH != 1)) |
| 504 | # error "Invalid value for JERRY_BUILTIN_MATH macro." |
| 505 | #endif |
| 506 | #if !defined (JERRY_BUILTIN_NUMBER) \ |
| 507 | || ((JERRY_BUILTIN_NUMBER != 0) && (JERRY_BUILTIN_NUMBER != 1)) |
| 508 | # error "Invalid value for JERRY_BUILTIN_NUMBER macro." |
| 509 | #endif |
| 510 | #if !defined (JERRY_BUILTIN_REGEXP) \ |
| 511 | || ((JERRY_BUILTIN_REGEXP != 0) && (JERRY_BUILTIN_REGEXP != 1)) |
| 512 | # error "Invalid value for JERRY_BUILTIN_REGEXP macro." |
| 513 | #endif |
| 514 | #if !defined (JERRY_BUILTIN_STRING) \ |
| 515 | || ((JERRY_BUILTIN_STRING != 0) && (JERRY_BUILTIN_STRING != 1)) |
| 516 | # error "Invalid value for JERRY_BUILTIN_STRING macro." |
| 517 | #endif |
| 518 | #if !defined (JERRY_BUILTINS) \ |
| 519 | || ((JERRY_BUILTINS != 0) && (JERRY_BUILTINS != 1)) |
| 520 | # error "Invalid value for JERRY_BUILTINS macro." |
| 521 | #endif |
| 522 | |
| 523 | /** |
| 524 | * Check ES2015+ features |
| 525 | */ |
| 526 | #if !defined (JERRY_ESNEXT) \ |
| 527 | || ((JERRY_ESNEXT != 0) && (JERRY_ESNEXT != 1)) |
| 528 | # error "Invalid value for JERRY_ESNEXT macro." |
| 529 | #endif |
| 530 | #if !defined (JERRY_BUILTIN_REALMS) \ |
| 531 | || ((JERRY_BUILTIN_REALMS != 0) && (JERRY_BUILTIN_REALMS != 1)) |
| 532 | # error "Invalid value for JERRY_BUILTIN_REALMS macro." |
| 533 | #endif |
| 534 | #if !defined (JERRY_BUILTIN_DATAVIEW) \ |
| 535 | || ((JERRY_BUILTIN_DATAVIEW != 0) && (JERRY_BUILTIN_DATAVIEW != 1)) |
| 536 | # error "Invalid value for JERRY_BUILTIN_DATAVIEW macro." |
| 537 | #endif |
| 538 | #if !defined (JERRY_BUILTIN_MAP) \ |
| 539 | || ((JERRY_BUILTIN_MAP != 0) && (JERRY_BUILTIN_MAP != 1)) |
| 540 | # error "Invalid value for JERRY_BUILTIN_MAP macro." |
| 541 | #endif |
| 542 | #if !defined (JERRY_BUILTIN_REFLECT) \ |
| 543 | || ((JERRY_BUILTIN_REFLECT != 0) && (JERRY_BUILTIN_REFLECT != 1)) |
| 544 | # error "Invalid value for JERRY_BUILTIN_REFLECT macro." |
| 545 | #endif |
| 546 | #if !defined (JERRY_BUILTIN_SET) \ |
| 547 | || ((JERRY_BUILTIN_SET != 0) && (JERRY_BUILTIN_SET != 1)) |
| 548 | # error "Invalid value for JERRY_BUILTIN_SET macro." |
| 549 | #endif |
| 550 | #if !defined (JERRY_BUILTIN_WEAKMAP) \ |
| 551 | || ((JERRY_BUILTIN_WEAKMAP != 0) && (JERRY_BUILTIN_WEAKMAP != 1)) |
| 552 | # error "Invalid value for JERRY_BUILTIN_WEAKMAP macro." |
| 553 | #endif |
| 554 | #if !defined (JERRY_BUILTIN_WEAKSET) \ |
| 555 | || ((JERRY_BUILTIN_WEAKSET != 0) && (JERRY_BUILTIN_WEAKSET != 1)) |
| 556 | # error "Invalid value for JERRY_BUILTIN_WEAKSET macro." |
| 557 | #endif |
| 558 | #if !defined (JERRY_BUILTIN_PROMISE) \ |
| 559 | || ((JERRY_BUILTIN_PROMISE != 0) && (JERRY_BUILTIN_PROMISE != 1)) |
| 560 | # error "Invalid value for JERRY_BUILTIN_PROMISE macro." |
| 561 | #endif |
| 562 | #if !defined (JERRY_BUILTIN_PROXY) \ |
| 563 | || ((JERRY_BUILTIN_PROXY != 0) && (JERRY_BUILTIN_PROXY != 1)) |
| 564 | # error "Invalid value for JERRY_BUILTIN_PROXY macro." |
| 565 | #endif |
| 566 | #if !defined (JERRY_BUILTIN_TYPEDARRAY) \ |
| 567 | || ((JERRY_BUILTIN_TYPEDARRAY != 0) && (JERRY_BUILTIN_TYPEDARRAY != 1)) |
| 568 | # error "Invalid value for JERRY_BUILTIN_TYPEDARRAY macro." |
| 569 | #endif |
| 570 | #if !defined (JERRY_BUILTIN_BIGINT) \ |
| 571 | || ((JERRY_BUILTIN_BIGINT != 0) && (JERRY_BUILTIN_BIGINT != 1)) |
| 572 | # error "Invalid value for JERRY_BUILTIN_BIGINT macro." |
| 573 | #endif |
| 574 | #if !defined (JERRY_MODULE_SYSTEM) \ |
| 575 | || ((JERRY_MODULE_SYSTEM != 0) && (JERRY_MODULE_SYSTEM != 1)) |
| 576 | # error "Invalid value for JERRY_MODULE_SYSTEM macro." |
| 577 | #endif |
| 578 | #if (JERRY_ESNEXT == 0) \ |
| 579 | && ((JERRY_BUILTIN_DATAVIEW == 1) \ |
| 580 | || (JERRY_BUILTIN_MAP == 1) \ |
| 581 | || (JERRY_BUILTIN_SET == 1) \ |
| 582 | || (JERRY_BUILTIN_WEAKMAP == 1) \ |
| 583 | || (JERRY_BUILTIN_WEAKSET == 1) \ |
| 584 | || (JERRY_BUILTIN_PROMISE == 1) \ |
| 585 | || (JERRY_BUILTIN_PROXY == 1) \ |
| 586 | || (JERRY_BUILTIN_REFLECT == 1) \ |
| 587 | || (JERRY_BUILTIN_TYPEDARRAY == 1)) |
| 588 | # error "JERRY_ESNEXT should be enabled too to enable JERRY_BUILTIN_xxxxx macro." |
| 589 | #endif |
| 590 | #if (JERRY_ESNEXT == 0) && (JERRY_MODULE_SYSTEM == 1) |
| 591 | # error "JERRY_ESNEXT should be enabled too to enable JERRY_MODULE_SYSTEM macro." |
| 592 | #endif |
| 593 | |
| 594 | /** |
| 595 | * Internal options. |
| 596 | */ |
| 597 | #if !defined (JERRY_CPOINTER_32_BIT) \ |
| 598 | || ((JERRY_CPOINTER_32_BIT != 0) && (JERRY_CPOINTER_32_BIT != 1)) |
| 599 | # error "Invalid value for 'JERRY_CPOINTER_32_BIT' macro." |
| 600 | #endif |
| 601 | #if !defined (JERRY_DEBUGGER) \ |
| 602 | || ((JERRY_DEBUGGER != 0) && (JERRY_DEBUGGER != 1)) |
| 603 | # error "Invalid value for 'JERRY_DEBUGGER' macro." |
| 604 | #endif |
| 605 | #if !defined (JERRY_ERROR_MESSAGES) \ |
| 606 | || ((JERRY_ERROR_MESSAGES != 0) && (JERRY_ERROR_MESSAGES != 1)) |
| 607 | # error "Invalid value for 'JERRY_ERROR_MESSAGES' macro." |
| 608 | #endif |
| 609 | #if !defined (JERRY_EXTERNAL_CONTEXT) \ |
| 610 | || ((JERRY_EXTERNAL_CONTEXT != 0) && (JERRY_EXTERNAL_CONTEXT != 1)) |
| 611 | # error "Invalid value for 'JERRY_EXTERNAL_CONTEXT' macro." |
| 612 | #endif |
| 613 | #if !defined (JERRY_GLOBAL_HEAP_SIZE) || (JERRY_GLOBAL_HEAP_SIZE <= 0) |
| 614 | # error "Invalid value for 'JERRY_GLOBAL_HEAP_SIZE' macro." |
| 615 | #endif |
| 616 | #if !defined (JERRY_GC_LIMIT) || (JERRY_GC_LIMIT < 0) |
| 617 | # error "Invalid value for 'JERRY_GC_LIMIT' macro." |
| 618 | #endif |
| 619 | #if !defined (JERRY_STACK_LIMIT) || (JERRY_STACK_LIMIT < 0) |
| 620 | # error "Invalid value for 'JERRY_STACK_LIMIT' macro." |
| 621 | #endif |
| 622 | #if !defined (JERRY_GC_MARK_LIMIT) || (JERRY_GC_MARK_LIMIT < 0) |
| 623 | # error "Invalid value for 'JERRY_GC_MARK_LIMIT' macro." |
| 624 | #endif |
| 625 | #if !defined (JERRY_LCACHE) \ |
| 626 | || ((JERRY_LCACHE != 0) && (JERRY_LCACHE != 1)) |
| 627 | # error "Invalid value for 'JERRY_LCACHE' macro." |
| 628 | #endif |
| 629 | #if !defined (JERRY_LINE_INFO) \ |
| 630 | || ((JERRY_LINE_INFO != 0) && (JERRY_LINE_INFO != 1)) |
| 631 | # error "Invalid value for 'JERRY_LINE_INFO' macro." |
| 632 | #endif |
| 633 | #if !defined (JERRY_LOGGING) \ |
| 634 | || ((JERRY_LOGGING != 0) && (JERRY_LOGGING != 1)) |
| 635 | # error "Invalid value for 'JERRY_LOGGING' macro." |
| 636 | #endif |
| 637 | #if !defined (JERRY_MEM_GC_BEFORE_EACH_ALLOC) \ |
| 638 | || ((JERRY_MEM_GC_BEFORE_EACH_ALLOC != 0) && (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 1)) |
| 639 | # error "Invalid value for 'JERRY_MEM_GC_BEFORE_EACH_ALLOC' macro." |
| 640 | #endif |
| 641 | #if !defined (JERRY_MEM_STATS) \ |
| 642 | || ((JERRY_MEM_STATS != 0) && (JERRY_MEM_STATS != 1)) |
| 643 | # error "Invalid value for 'JERRY_MEM_STATS' macro." |
| 644 | #endif |
| 645 | #if !defined (JERRY_NUMBER_TYPE_FLOAT64) \ |
| 646 | || ((JERRY_NUMBER_TYPE_FLOAT64 != 0) && (JERRY_NUMBER_TYPE_FLOAT64 != 1)) |
| 647 | # error "Invalid value for 'JERRY_NUMBER_TYPE_FLOAT64' macro." |
| 648 | #endif |
| 649 | #if !defined (JERRY_PARSER) \ |
| 650 | || ((JERRY_PARSER != 0) && (JERRY_PARSER != 1)) |
| 651 | # error "Invalid value for 'JERRY_PARSER' macro." |
| 652 | #endif |
| 653 | #if !defined (JERRY_PARSER_DUMP_BYTE_CODE) \ |
| 654 | || ((JERRY_PARSER_DUMP_BYTE_CODE != 0) && (JERRY_PARSER_DUMP_BYTE_CODE != 1)) |
| 655 | # error "Invalid value for 'JERRY_PARSER_DUMP_BYTE_CODE' macro." |
| 656 | #endif |
| 657 | #if !defined (JERRY_PROPRETY_HASHMAP) \ |
| 658 | || ((JERRY_PROPRETY_HASHMAP != 0) && (JERRY_PROPRETY_HASHMAP != 1)) |
| 659 | # error "Invalid value for 'JERRY_PROPRETY_HASHMAP' macro." |
| 660 | #endif |
| 661 | #if !defined (JERRY_REGEXP_DUMP_BYTE_CODE) \ |
| 662 | || ((JERRY_REGEXP_DUMP_BYTE_CODE != 0) && (JERRY_REGEXP_DUMP_BYTE_CODE != 1)) |
| 663 | # error "Invalid value for 'JERRY_REGEXP_DUMP_BYTE_CODE' macro." |
| 664 | #endif |
| 665 | #if !defined (JERRY_REGEXP_STRICT_MODE) \ |
| 666 | || ((JERRY_REGEXP_STRICT_MODE != 0) && (JERRY_REGEXP_STRICT_MODE != 1)) |
| 667 | # error "Invalid value for 'JERRY_REGEXP_STRICT_MODE' macro." |
| 668 | #endif |
| 669 | #if !defined (JERRY_SNAPSHOT_EXEC) \ |
| 670 | || ((JERRY_SNAPSHOT_EXEC != 0) && (JERRY_SNAPSHOT_EXEC != 1)) |
| 671 | # error "Invalid value for 'JERRY_SNAPSHOT_EXEC' macro." |
| 672 | #endif |
| 673 | #if !defined (JERRY_SNAPSHOT_SAVE) \ |
| 674 | || ((JERRY_SNAPSHOT_SAVE != 0) && (JERRY_SNAPSHOT_SAVE != 1)) |
| 675 | # error "Invalid value for 'JERRY_SNAPSHOT_SAVE' macro." |
| 676 | #endif |
| 677 | #if !defined (JERRY_SYSTEM_ALLOCATOR) \ |
| 678 | || ((JERRY_SYSTEM_ALLOCATOR != 0) && (JERRY_SYSTEM_ALLOCATOR != 1)) |
| 679 | # error "Invalid value for 'JERRY_SYSTEM_ALLOCATOR' macro." |
| 680 | #endif |
| 681 | #if !defined (JERRY_UNICODE_CASE_CONVERSION) \ |
| 682 | || ((JERRY_UNICODE_CASE_CONVERSION != 0) && (JERRY_UNICODE_CASE_CONVERSION != 1)) |
| 683 | # error "Invalid value for 'JERRY_UNICODE_CASE_CONVERSION' macro." |
| 684 | #endif |
| 685 | #if !defined (JERRY_VALGRIND) \ |
| 686 | || ((JERRY_VALGRIND != 0) && (JERRY_VALGRIND != 1)) |
| 687 | # error "Invalid value for 'JERRY_VALGRIND' macro." |
| 688 | #endif |
| 689 | #if !defined (JERRY_VM_EXEC_STOP) \ |
| 690 | || ((JERRY_VM_EXEC_STOP != 0) && (JERRY_VM_EXEC_STOP != 1)) |
| 691 | # error "Invalid value for 'JERRY_VM_EXEC_STOP' macro." |
| 692 | #endif |
| 693 | |
| 694 | #define ENABLED(FEATURE) ((FEATURE) == 1) |
| 695 | #define DISABLED(FEATURE) ((FEATURE) != 1) |
| 696 | |
| 697 | /** |
| 698 | * Cross component requirements check. |
| 699 | */ |
| 700 | /** |
| 701 | * The date module can only use the float 64 number types. |
| 702 | * Do a check for this. |
| 703 | */ |
| 704 | #if ENABLED (JERRY_BUILTIN_DATE) && !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) |
| 705 | # error "Date does not support float32" |
| 706 | #endif |
| 707 | |
| 708 | /** |
| 709 | * Wrap container types into a single guard |
| 710 | */ |
| 711 | #if ENABLED (JERRY_BUILTIN_MAP) || ENABLED (JERRY_BUILTIN_SET) \ |
| 712 | || ENABLED (JERRY_BUILTIN_WEAKMAP) || ENABLED (JERRY_BUILTIN_WEAKSET) |
| 713 | # define JERRY_BUILTIN_CONTAINER 1 |
| 714 | #else |
| 715 | # define JERRY_BUILTIN_CONTAINER 0 |
| 716 | #endif |
| 717 | |
| 718 | /** |
| 719 | * Resource name related types into a single guard |
| 720 | */ |
| 721 | #if ENABLED (JERRY_LINE_INFO) || ENABLED (JERRY_ERROR_MESSAGES) || ENABLED (JERRY_MODULE_SYSTEM) |
| 722 | # define JERRY_RESOURCE_NAME 1 |
| 723 | #else |
| 724 | # define JERRY_RESOURCE_NAME 0 |
| 725 | #endif |
| 726 | |
| 727 | #endif /* !JERRYSCRIPT_CONFIG_H */ |
| 728 | |