config.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. #ifndef CONFIG_H
  16. #define CONFIG_H
  17. #include "rtconfig.h"
  18. /**
  19. * Group of builtin-related features that can be disabled together.
  20. */
  21. #ifdef CONFIG_DISABLE_BUILTINS
  22. # define CONFIG_DISABLE_ANNEXB_BUILTIN
  23. # define CONFIG_DISABLE_ARRAY_BUILTIN
  24. # define CONFIG_DISABLE_BOOLEAN_BUILTIN
  25. # define CONFIG_DISABLE_DATE_BUILTIN
  26. # define CONFIG_DISABLE_ERROR_BUILTINS
  27. # define CONFIG_DISABLE_JSON_BUILTIN
  28. # define CONFIG_DISABLE_MATH_BUILTIN
  29. # define CONFIG_DISABLE_NUMBER_BUILTIN
  30. # define CONFIG_DISABLE_REGEXP_BUILTIN
  31. # define CONFIG_DISABLE_STRING_BUILTIN
  32. #endif /* CONFIG_DISABLE_BUILTINS */
  33. /**
  34. * Group of ES2015-related features that can be disabled together.
  35. */
  36. #ifdef CONFIG_DISABLE_ES2015
  37. # define CONFIG_DISABLE_ES2015_ARROW_FUNCTION
  38. # define CONFIG_DISABLE_ES2015_BUILTIN
  39. # define CONFIG_DISABLE_ES2015_CLASS
  40. # define CONFIG_DISABLE_ES2015_MAP_BUILTIN
  41. # define CONFIG_DISABLE_ES2015_OBJECT_INITIALIZER
  42. # define CONFIG_DISABLE_ES2015_PROMISE_BUILTIN
  43. # define CONFIG_DISABLE_ES2015_TEMPLATE_STRINGS
  44. # define CONFIG_DISABLE_ES2015_TYPEDARRAY_BUILTIN
  45. #endif /* CONFIG_DISABLE_ES2015 */
  46. /**
  47. * Size of heap
  48. */
  49. #ifndef CONFIG_MEM_HEAP_AREA_SIZE
  50. # define CONFIG_MEM_HEAP_AREA_SIZE PKG_JMEM_HEAP_SIZE
  51. //# define CONFIG_MEM_HEAP_AREA_SIZE (512 * 1024)
  52. #endif /* !CONFIG_MEM_HEAP_AREA_SIZE */
  53. /**
  54. * Max heap usage limit
  55. */
  56. #define CONFIG_MEM_HEAP_MAX_LIMIT 8192
  57. /**
  58. * Desired limit of heap usage
  59. */
  60. #define CONFIG_MEM_HEAP_DESIRED_LIMIT (JERRY_MIN (CONFIG_MEM_HEAP_AREA_SIZE / 32, CONFIG_MEM_HEAP_MAX_LIMIT))
  61. /**
  62. * Use 32-bit/64-bit float for ecma-numbers
  63. */
  64. #define CONFIG_ECMA_NUMBER_FLOAT32 (1u) /* 32-bit float */
  65. #define CONFIG_ECMA_NUMBER_FLOAT64 (2u) /* 64-bit float */
  66. #ifndef CONFIG_ECMA_NUMBER_TYPE
  67. # define CONFIG_ECMA_NUMBER_TYPE CONFIG_ECMA_NUMBER_FLOAT64
  68. #else /* CONFIG_ECMA_NUMBER_TYPE */
  69. # if (CONFIG_ECMA_NUMBER_TYPE != CONFIG_ECMA_NUMBER_FLOAT32 \
  70. && CONFIG_ECMA_NUMBER_TYPE != CONFIG_ECMA_NUMBER_FLOAT64)
  71. # error "ECMA-number storage is configured incorrectly"
  72. # endif /* CONFIG_ECMA_NUMBER_TYPE != CONFIG_ECMA_NUMBER_FLOAT32
  73. && CONFIG_ECMA_NUMBER_TYPE != CONFIG_ECMA_NUMBER_FLOAT64 */
  74. #endif /* !CONFIG_ECMA_NUMBER_TYPE */
  75. #if (!defined (CONFIG_DISABLE_DATE_BUILTIN) && (CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT32))
  76. # error "Date does not support float32"
  77. #endif
  78. /**
  79. * Disable ECMA lookup cache
  80. */
  81. // #define CONFIG_ECMA_LCACHE_DISABLE
  82. /**
  83. * Disable ECMA property hashmap
  84. */
  85. // #define CONFIG_ECMA_PROPERTY_HASHMAP_DISABLE
  86. /**
  87. * Share of newly allocated since last GC objects among all currently allocated objects,
  88. * after achieving which, GC is started upon low severity try-give-memory-back requests.
  89. *
  90. * Share is calculated as the following:
  91. * 1.0 / CONFIG_ECMA_GC_NEW_OBJECTS_SHARE_TO_START_GC
  92. */
  93. #define CONFIG_ECMA_GC_NEW_OBJECTS_SHARE_TO_START_GC (16)
  94. #endif /* !CONFIG_H */