/js/src/jscpucfg.h

http://github.com/zpao/v8monkey · C Header · 154 lines · 94 code · 18 blank · 42 comment · 27 complexity · 9862bd564e225d585de2e3b58770314e MD5 · raw file

  1. /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2. *
  3. * ***** BEGIN LICENSE BLOCK *****
  4. * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5. *
  6. * The contents of this file are subject to the Mozilla Public License Version
  7. * 1.1 (the "License"); you may not use this file except in compliance with
  8. * the License. You may obtain a copy of the License at
  9. * http://www.mozilla.org/MPL/
  10. *
  11. * Software distributed under the License is distributed on an "AS IS" basis,
  12. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13. * for the specific language governing rights and limitations under the
  14. * License.
  15. *
  16. * The Original Code is Mozilla Communicator client code, released
  17. * March 31, 1998.
  18. *
  19. * The Initial Developer of the Original Code is
  20. * Netscape Communications Corporation.
  21. * Portions created by the Initial Developer are Copyright (C) 1998
  22. * the Initial Developer. All Rights Reserved.
  23. *
  24. * Contributor(s):
  25. *
  26. * Alternatively, the contents of this file may be used under the terms of
  27. * either of the GNU General Public License Version 2 or later (the "GPL"),
  28. * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  29. * in which case the provisions of the GPL or the LGPL are applicable instead
  30. * of those above. If you wish to allow use of your version of this file only
  31. * under the terms of either the GPL or the LGPL, and not to allow others to
  32. * use your version of this file under the terms of the MPL, indicate your
  33. * decision by deleting the provisions above and replace them with the notice
  34. * and other provisions required by the GPL or the LGPL. If you do not delete
  35. * the provisions above, a recipient may use your version of this file under
  36. * the terms of any one of the MPL, the GPL or the LGPL.
  37. *
  38. * ***** END LICENSE BLOCK ***** */
  39. #ifndef js_cpucfg___
  40. #define js_cpucfg___
  41. #define JS_HAVE_LONG_LONG
  42. #if defined(_WIN64)
  43. # if defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)
  44. # define IS_LITTLE_ENDIAN 1
  45. # undef IS_BIG_ENDIAN
  46. # define JS_BYTES_PER_DOUBLE 8
  47. # define JS_BYTES_PER_WORD 8
  48. # define JS_BITS_PER_WORD_LOG2 6
  49. # define JS_ALIGN_OF_POINTER 8
  50. # else /* !(defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)) */
  51. # error "CPU type is unknown"
  52. # endif /* !(defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)) */
  53. #elif defined(_WIN32) || defined(XP_OS2)
  54. # ifdef __WATCOMC__
  55. # define HAVE_VA_LIST_AS_ARRAY 1
  56. # endif
  57. # define IS_LITTLE_ENDIAN 1
  58. # undef IS_BIG_ENDIAN
  59. # define JS_BYTES_PER_DOUBLE 8
  60. # define JS_BYTES_PER_WORD 4
  61. # define JS_BITS_PER_WORD_LOG2 5
  62. # define JS_ALIGN_OF_POINTER 4
  63. #elif defined(__APPLE__)
  64. # if __LITTLE_ENDIAN__
  65. # define IS_LITTLE_ENDIAN 1
  66. # undef IS_BIG_ENDIAN
  67. # elif __BIG_ENDIAN__
  68. # undef IS_LITTLE_ENDIAN
  69. # define IS_BIG_ENDIAN 1
  70. # endif
  71. #elif defined(JS_HAVE_ENDIAN_H)
  72. # include <endian.h>
  73. # if defined(__BYTE_ORDER)
  74. # if __BYTE_ORDER == __LITTLE_ENDIAN
  75. # define IS_LITTLE_ENDIAN 1
  76. # undef IS_BIG_ENDIAN
  77. # elif __BYTE_ORDER == __BIG_ENDIAN
  78. # undef IS_LITTLE_ENDIAN
  79. # define IS_BIG_ENDIAN 1
  80. # endif
  81. # else /* !defined(__BYTE_ORDER) */
  82. # error "endian.h does not define __BYTE_ORDER. Cannot determine endianness."
  83. # endif
  84. /* BSDs */
  85. #elif defined(JS_HAVE_MACHINE_ENDIAN_H)
  86. # include <sys/types.h>
  87. # include <machine/endian.h>
  88. # if defined(_BYTE_ORDER)
  89. # if _BYTE_ORDER == _LITTLE_ENDIAN
  90. # define IS_LITTLE_ENDIAN 1
  91. # undef IS_BIG_ENDIAN
  92. # elif _BYTE_ORDER == _BIG_ENDIAN
  93. # undef IS_LITTLE_ENDIAN
  94. # define IS_BIG_ENDIAN 1
  95. # endif
  96. # else /* !defined(_BYTE_ORDER) */
  97. # error "machine/endian.h does not define _BYTE_ORDER. Cannot determine endianness."
  98. # endif
  99. #elif defined(JS_HAVE_SYS_ISA_DEFS_H)
  100. # include <sys/isa_defs.h>
  101. # if defined(_BIG_ENDIAN)
  102. # undef IS_LITTLE_ENDIAN
  103. # define IS_BIG_ENDIAN 1
  104. # elif defined(_LITTLE_ENDIAN)
  105. # define IS_LITTLE_ENDIAN 1
  106. # undef IS_BIG_ENDIAN
  107. # else /* !defined(_LITTLE_ENDIAN) */
  108. # error "sys/isa_defs.h does not define _BIG_ENDIAN or _LITTLE_ENDIAN. Cannot determine endianness."
  109. # endif
  110. # if !defined(JS_STACK_GROWTH_DIRECTION)
  111. # if defined(_STACK_GROWS_UPWARD)
  112. # define JS_STACK_GROWTH_DIRECTION (1)
  113. # elif defined(_STACK_GROWS_DOWNWARD)
  114. # define JS_STACK_GROWTH_DIRECTION (-1)
  115. # endif
  116. # endif
  117. #elif defined(__sparc) || defined(__sparc__) || \
  118. defined(_POWER) || defined(__powerpc__) || \
  119. defined(__ppc__) || defined(__hppa) || \
  120. defined(_MIPSEB) || defined(_BIG_ENDIAN)
  121. /* IA64 running HP-UX will have _BIG_ENDIAN defined.
  122. * IA64 running Linux will have endian.h and be handled above.
  123. */
  124. # undef IS_LITTLE_ENDIAN
  125. # define IS_BIG_ENDIAN 1
  126. #else /* !defined(__sparc) && !defined(__sparc__) && ... */
  127. # error "Cannot determine endianness of your platform. Please add support to jscpucfg.h."
  128. #endif
  129. #ifndef JS_STACK_GROWTH_DIRECTION
  130. # ifdef __hppa
  131. # define JS_STACK_GROWTH_DIRECTION (1)
  132. # else
  133. # define JS_STACK_GROWTH_DIRECTION (-1)
  134. # endif
  135. #endif
  136. #endif /* js_cpucfg___ */