PageRenderTime 15ms CodeModel.GetById 11ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 40#ifndef js_cpucfg___
 41#define js_cpucfg___
 42
 43#define JS_HAVE_LONG_LONG
 44
 45#if defined(_WIN64)
 46
 47# if defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)
 48#  define IS_LITTLE_ENDIAN 1
 49#  undef  IS_BIG_ENDIAN
 50#  define JS_BYTES_PER_DOUBLE 8
 51#  define JS_BYTES_PER_WORD   8
 52#  define JS_BITS_PER_WORD_LOG2   6
 53#  define JS_ALIGN_OF_POINTER 8
 54# else  /* !(defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)) */
 55#  error "CPU type is unknown"
 56# endif /* !(defined(_M_X64) || defined(_M_AMD64) || defined(_AMD64_)) */
 57
 58#elif defined(_WIN32) || defined(XP_OS2)
 59
 60# ifdef __WATCOMC__
 61#  define HAVE_VA_LIST_AS_ARRAY 1
 62# endif
 63
 64# define IS_LITTLE_ENDIAN 1
 65# undef  IS_BIG_ENDIAN
 66# define JS_BYTES_PER_DOUBLE 8
 67# define JS_BYTES_PER_WORD   4
 68# define JS_BITS_PER_WORD_LOG2   5
 69# define JS_ALIGN_OF_POINTER 4
 70
 71#elif defined(__APPLE__)
 72# if __LITTLE_ENDIAN__
 73#  define IS_LITTLE_ENDIAN 1
 74#  undef  IS_BIG_ENDIAN
 75# elif __BIG_ENDIAN__
 76#  undef  IS_LITTLE_ENDIAN
 77#  define IS_BIG_ENDIAN 1
 78# endif
 79
 80#elif defined(JS_HAVE_ENDIAN_H)
 81# include <endian.h>
 82
 83# if defined(__BYTE_ORDER)
 84#  if __BYTE_ORDER == __LITTLE_ENDIAN
 85#   define IS_LITTLE_ENDIAN 1
 86#   undef  IS_BIG_ENDIAN
 87#  elif __BYTE_ORDER == __BIG_ENDIAN
 88#   undef  IS_LITTLE_ENDIAN
 89#   define IS_BIG_ENDIAN 1
 90#  endif
 91# else /* !defined(__BYTE_ORDER) */
 92#  error "endian.h does not define __BYTE_ORDER. Cannot determine endianness."
 93# endif
 94
 95/* BSDs */
 96#elif defined(JS_HAVE_MACHINE_ENDIAN_H)
 97# include <sys/types.h>
 98# include <machine/endian.h>
 99
100# if defined(_BYTE_ORDER)
101#  if _BYTE_ORDER == _LITTLE_ENDIAN
102#   define IS_LITTLE_ENDIAN 1
103#   undef  IS_BIG_ENDIAN
104#  elif _BYTE_ORDER == _BIG_ENDIAN
105#   undef  IS_LITTLE_ENDIAN
106#   define IS_BIG_ENDIAN 1
107#  endif
108# else /* !defined(_BYTE_ORDER) */
109#  error "machine/endian.h does not define _BYTE_ORDER. Cannot determine endianness."
110# endif
111
112#elif defined(JS_HAVE_SYS_ISA_DEFS_H)
113# include <sys/isa_defs.h>
114
115# if defined(_BIG_ENDIAN)
116#  undef IS_LITTLE_ENDIAN
117#  define IS_BIG_ENDIAN 1
118# elif defined(_LITTLE_ENDIAN)
119#  define IS_LITTLE_ENDIAN 1
120#  undef IS_BIG_ENDIAN
121# else /* !defined(_LITTLE_ENDIAN) */
122#  error "sys/isa_defs.h does not define _BIG_ENDIAN or _LITTLE_ENDIAN. Cannot determine endianness."
123# endif
124# if !defined(JS_STACK_GROWTH_DIRECTION)
125#  if defined(_STACK_GROWS_UPWARD)
126#   define JS_STACK_GROWTH_DIRECTION (1)
127#  elif defined(_STACK_GROWS_DOWNWARD)
128#   define JS_STACK_GROWTH_DIRECTION (-1)
129#  endif
130# endif
131
132#elif defined(__sparc) || defined(__sparc__) || \
133      defined(_POWER) || defined(__powerpc__) || \
134      defined(__ppc__) || defined(__hppa) || \
135      defined(_MIPSEB) || defined(_BIG_ENDIAN)
136/* IA64 running HP-UX will have _BIG_ENDIAN defined.
137 * IA64 running Linux will have endian.h and be handled above.
138 */
139# undef IS_LITTLE_ENDIAN
140# define IS_BIG_ENDIAN 1
141
142#else /* !defined(__sparc) && !defined(__sparc__) && ... */
143# error "Cannot determine endianness of your platform. Please add support to jscpucfg.h."
144#endif
145
146#ifndef JS_STACK_GROWTH_DIRECTION
147# ifdef __hppa
148#  define JS_STACK_GROWTH_DIRECTION (1)
149# else
150#  define JS_STACK_GROWTH_DIRECTION (-1)
151# endif
152#endif
153
154#endif /* js_cpucfg___ */