Revision: 21546
Author:   [email protected]
Date:     Wed May 28 08:07:18 2014 UTC
Log: Extract build configuration into a separate header and move it to the base lib

With this, change, atomicops, once, and lazy instance are no longer dependant
on v8 core. I'll move them in a follow-up change to the libbase as well.

BUG=none
[email protected]
LOG=n

Review URL: https://codereview.chromium.org/303463005
http://code.google.com/p/v8/source/detail?r=21546

Added:
 /branches/bleeding_edge/src/base/build_config.h
Modified:
 /branches/bleeding_edge/BUILD.gn
 /branches/bleeding_edge/src/atomicops.h
 /branches/bleeding_edge/src/atomicops_internals_x86_msvc.h
 /branches/bleeding_edge/src/base/macros.h
 /branches/bleeding_edge/src/checks.h
 /branches/bleeding_edge/src/flags.h
 /branches/bleeding_edge/src/globals.h
 /branches/bleeding_edge/src/lazy-instance.h
 /branches/bleeding_edge/src/once.cc
 /branches/bleeding_edge/src/platform/mutex.h
 /branches/bleeding_edge/test/cctest/test-api.cc
 /branches/bleeding_edge/tools/gyp/v8.gyp

=======================================
--- /dev/null
+++ /branches/bleeding_edge/src/base/build_config.h Wed May 28 08:07:18 2014 UTC
@@ -0,0 +1,120 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_BASE_BUILD_CONFIG_H_
+#define V8_BASE_BUILD_CONFIG_H_
+
+#include "../../include/v8config.h"
+
+// Processor architecture detection.  For more info on what's defined, see:
+//   http://msdn.microsoft.com/en-us/library/b0084kay.aspx
+//   http://www.agner.org/optimize/calling_conventions.pdf
+//   or with gcc, run: "echo | gcc -E -dM -"
+#if defined(_M_X64) || defined(__x86_64__)
+#if defined(__native_client__)
+// For Native Client builds of V8, use V8_TARGET_ARCH_ARM, so that V8
+// generates ARM machine code, together with a portable ARM simulator
+// compiled for the host architecture in question.
+//
+// Since Native Client is ILP-32 on all architectures we use
+// V8_HOST_ARCH_IA32 on both 32- and 64-bit x86.
+#define V8_HOST_ARCH_IA32 1
+#define V8_HOST_ARCH_32_BIT 1
+#define V8_HOST_CAN_READ_UNALIGNED 1
+#else
+#define V8_HOST_ARCH_X64 1
+#define V8_HOST_ARCH_64_BIT 1
+#define V8_HOST_CAN_READ_UNALIGNED 1
+#endif  // __native_client__
+#elif defined(_M_IX86) || defined(__i386__)
+#define V8_HOST_ARCH_IA32 1
+#define V8_HOST_ARCH_32_BIT 1
+#define V8_HOST_CAN_READ_UNALIGNED 1
+#elif defined(__AARCH64EL__)
+#define V8_HOST_ARCH_ARM64 1
+#define V8_HOST_ARCH_64_BIT 1
+#define V8_HOST_CAN_READ_UNALIGNED 1
+#elif defined(__ARMEL__)
+#define V8_HOST_ARCH_ARM 1
+#define V8_HOST_ARCH_32_BIT 1
+#elif defined(__MIPSEB__) || defined(__MIPSEL__)
+#define V8_HOST_ARCH_MIPS 1
+#define V8_HOST_ARCH_32_BIT 1
+#else
+#error "Host architecture was not detected as supported by v8"
+#endif
+
+#if defined(__ARM_ARCH_7A__) || \
+    defined(__ARM_ARCH_7R__) || \
+    defined(__ARM_ARCH_7__)
+# define CAN_USE_ARMV7_INSTRUCTIONS 1
+# ifndef CAN_USE_VFP3_INSTRUCTIONS
+#  define CAN_USE_VFP3_INSTRUCTIONS
+# endif
+#endif
+
+
+// Target architecture detection. This may be set externally. If not, detect
+// in the same way as the host architecture, that is, target the native
+// environment as presented by the compiler.
+#if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_X87 &&\
+    !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_MIPS
+#if defined(_M_X64) || defined(__x86_64__)
+#define V8_TARGET_ARCH_X64 1
+#elif defined(_M_IX86) || defined(__i386__)
+#define V8_TARGET_ARCH_IA32 1
+#elif defined(__AARCH64EL__)
+#define V8_TARGET_ARCH_ARM64 1
+#elif defined(__ARMEL__)
+#define V8_TARGET_ARCH_ARM 1
+#elif defined(__MIPSEB__) || defined(__MIPSEL__)
+#define V8_TARGET_ARCH_MIPS 1
+#else
+#error Target architecture was not detected as supported by v8
+#endif
+#endif
+
+// Check for supported combinations of host and target architectures.
+#if V8_TARGET_ARCH_IA32 && !V8_HOST_ARCH_IA32
+#error Target architecture ia32 is only supported on ia32 host
+#endif
+#if V8_TARGET_ARCH_X64 && !V8_HOST_ARCH_X64
+#error Target architecture x64 is only supported on x64 host
+#endif
+#if (V8_TARGET_ARCH_ARM && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_ARM))
+#error Target architecture arm is only supported on arm and ia32 host
+#endif
+#if (V8_TARGET_ARCH_ARM64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_ARM64))
+#error Target architecture arm64 is only supported on arm64 and x64 host
+#endif
+#if (V8_TARGET_ARCH_MIPS && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_MIPS))
+#error Target architecture mips is only supported on mips and ia32 host
+#endif
+
+// Determine architecture endianness.
+#if V8_TARGET_ARCH_IA32
+#define V8_TARGET_LITTLE_ENDIAN 1
+#elif V8_TARGET_ARCH_X64
+#define V8_TARGET_LITTLE_ENDIAN 1
+#elif V8_TARGET_ARCH_ARM
+#define V8_TARGET_LITTLE_ENDIAN 1
+#elif V8_TARGET_ARCH_ARM64
+#define V8_TARGET_LITTLE_ENDIAN 1
+#elif V8_TARGET_ARCH_MIPS
+#if defined(__MIPSEB__)
+#define V8_TARGET_BIG_ENDIAN 1
+#else
+#define V8_TARGET_LITTLE_ENDIAN 1
+#endif
+#elif V8_TARGET_ARCH_X87
+#define V8_TARGET_LITTLE_ENDIAN 1
+#else
+#error Unknown target architecture endianness
+#endif
+
+#if V8_OS_MACOSX || defined(__FreeBSD__) || defined(__OpenBSD__)
+#define USING_BSD_ABI
+#endif
+
+#endif  // V8_BASE_BUILD_CONFIG_H_
=======================================
--- /branches/bleeding_edge/BUILD.gn    Mon May 26 11:28:08 2014 UTC
+++ /branches/bleeding_edge/BUILD.gn    Wed May 28 08:07:18 2014 UTC
@@ -893,6 +893,7 @@
   visibility = ":*"  # Only targets in this file can depend on this.

   sources = [
+    "src/base/build_config.h",
     "src/base/macros.h",
   ]

=======================================
--- /branches/bleeding_edge/src/atomicops.h     Tue Apr 29 06:42:26 2014 UTC
+++ /branches/bleeding_edge/src/atomicops.h     Wed May 28 08:07:18 2014 UTC
@@ -26,7 +26,7 @@
 #define V8_ATOMICOPS_H_

 #include "../include/v8.h"
-#include "globals.h"
+#include "base/build_config.h"

 #if defined(_WIN32) && defined(V8_HOST_ARCH_64_BIT)
 // windows.h #defines this (only on x64). This causes problems because the
=======================================
--- /branches/bleeding_edge/src/atomicops_internals_x86_msvc.h Tue Apr 29 06:42:26 2014 UTC +++ /branches/bleeding_edge/src/atomicops_internals_x86_msvc.h Wed May 28 08:07:18 2014 UTC
@@ -7,7 +7,7 @@
 #ifndef V8_ATOMICOPS_INTERNALS_X86_MSVC_H_
 #define V8_ATOMICOPS_INTERNALS_X86_MSVC_H_

-#include "checks.h"
+#include "base/macros.h"
 #include "win32-headers.h"

 #if defined(V8_HOST_ARCH_64_BIT)
=======================================
--- /branches/bleeding_edge/src/base/macros.h   Tue May 20 10:13:46 2014 UTC
+++ /branches/bleeding_edge/src/base/macros.h   Wed May 28 08:07:18 2014 UTC
@@ -74,5 +74,39 @@
 #else
 #define V8_IMMEDIATE_CRASH() ((void(*)())0)()
 #endif
+
+
+// Use C++11 static_assert if possible, which gives error
+// messages that are easier to understand on first sight.
+#if V8_HAS_CXX11_STATIC_ASSERT
+#define STATIC_ASSERT(test) static_assert(test, #test)
+#else
+// This is inspired by the static assertion facility in boost.  This
+// is pretty magical.  If it causes you trouble on a platform you may
+// find a fix in the boost code.
+template <bool> class StaticAssertion;
+template <> class StaticAssertion<true> { };
+// This macro joins two tokens.  If one of the tokens is a macro the
+// helper call causes it to be resolved before joining.
+#define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b)
+#define SEMI_STATIC_JOIN_HELPER(a, b) a##b
+// Causes an error during compilation of the condition is not
+// statically known to be true.  It is formulated as a typedef so that
+// it can be used wherever a typedef can be used.  Beware that this
+// actually causes each use to introduce a new defined type with a
+// name depending on the source line.
+template <int> class StaticAssertionHelper { };
+#define STATIC_ASSERT(test) \ + typedef \ + StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \
+    SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) V8_UNUSED
+
+#endif
+
+
+// The USE(x) template is used to silence C++ compiler warnings
+// issued for (yet) unused variables (typically parameters).
+template <typename T>
+inline void USE(T) { }

 #endif   // V8_BASE_MACROS_H_
=======================================
--- /branches/bleeding_edge/src/checks.h        Tue May 27 13:43:29 2014 UTC
+++ /branches/bleeding_edge/src/checks.h        Wed May 28 08:07:18 2014 UTC
@@ -240,33 +240,6 @@
 #define CHECK_LE(a, b) CHECK((a) <= (b))


-// Use C++11 static_assert if possible, which gives error
-// messages that are easier to understand on first sight.
-#if V8_HAS_CXX11_STATIC_ASSERT
-#define STATIC_ASSERT(test) static_assert(test, #test)
-#else
-// This is inspired by the static assertion facility in boost.  This
-// is pretty magical.  If it causes you trouble on a platform you may
-// find a fix in the boost code.
-template <bool> class StaticAssertion;
-template <> class StaticAssertion<true> { };
-// This macro joins two tokens.  If one of the tokens is a macro the
-// helper call causes it to be resolved before joining.
-#define SEMI_STATIC_JOIN(a, b) SEMI_STATIC_JOIN_HELPER(a, b)
-#define SEMI_STATIC_JOIN_HELPER(a, b) a##b
-// Causes an error during compilation of the condition is not
-// statically known to be true.  It is formulated as a typedef so that
-// it can be used wherever a typedef can be used.  Beware that this
-// actually causes each use to introduce a new defined type with a
-// name depending on the source line.
-template <int> class StaticAssertionHelper { };
-#define STATIC_ASSERT(test) \ - typedef \ - StaticAssertionHelper<sizeof(StaticAssertion<static_cast<bool>((test))>)> \
-    SEMI_STATIC_JOIN(__StaticAssertTypedef__, __LINE__) V8_UNUSED
-#endif
-
-
 #ifdef DEBUG
 #ifndef OPTIMIZED_DEBUG
 #define ENABLE_SLOW_ASSERTS    1
=======================================
--- /branches/bleeding_edge/src/flags.h Fri May 16 15:18:24 2014 UTC
+++ /branches/bleeding_edge/src/flags.h Wed May 28 08:07:18 2014 UTC
@@ -6,6 +6,7 @@
 #define V8_FLAGS_H_

 #include "atomicops.h"
+#include "globals.h"

 namespace v8 {
 namespace internal {
=======================================
--- /branches/bleeding_edge/src/globals.h       Mon May 26 11:28:08 2014 UTC
+++ /branches/bleeding_edge/src/globals.h       Wed May 28 08:07:18 2014 UTC
@@ -7,6 +7,7 @@

 #include "../include/v8stdint.h"

+#include "base/build_config.h"
 #include "base/macros.h"
 #include "checks.h"

@@ -27,91 +28,6 @@
 namespace v8 {
 namespace internal {

-// Processor architecture detection.  For more info on what's defined, see:
-//   http://msdn.microsoft.com/en-us/library/b0084kay.aspx
-//   http://www.agner.org/optimize/calling_conventions.pdf
-//   or with gcc, run: "echo | gcc -E -dM -"
-#if defined(_M_X64) || defined(__x86_64__)
-#if defined(__native_client__)
-// For Native Client builds of V8, use V8_TARGET_ARCH_ARM, so that V8
-// generates ARM machine code, together with a portable ARM simulator
-// compiled for the host architecture in question.
-//
-// Since Native Client is ILP-32 on all architectures we use
-// V8_HOST_ARCH_IA32 on both 32- and 64-bit x86.
-#define V8_HOST_ARCH_IA32 1
-#define V8_HOST_ARCH_32_BIT 1
-#define V8_HOST_CAN_READ_UNALIGNED 1
-#else
-#define V8_HOST_ARCH_X64 1
-#define V8_HOST_ARCH_64_BIT 1
-#define V8_HOST_CAN_READ_UNALIGNED 1
-#endif  // __native_client__
-#elif defined(_M_IX86) || defined(__i386__)
-#define V8_HOST_ARCH_IA32 1
-#define V8_HOST_ARCH_32_BIT 1
-#define V8_HOST_CAN_READ_UNALIGNED 1
-#elif defined(__AARCH64EL__)
-#define V8_HOST_ARCH_ARM64 1
-#define V8_HOST_ARCH_64_BIT 1
-#define V8_HOST_CAN_READ_UNALIGNED 1
-#elif defined(__ARMEL__)
-#define V8_HOST_ARCH_ARM 1
-#define V8_HOST_ARCH_32_BIT 1
-#elif defined(__MIPSEB__) || defined(__MIPSEL__)
-#define V8_HOST_ARCH_MIPS 1
-#define V8_HOST_ARCH_32_BIT 1
-#else
-#error "Host architecture was not detected as supported by v8"
-#endif
-
-#if defined(__ARM_ARCH_7A__) || \
-    defined(__ARM_ARCH_7R__) || \
-    defined(__ARM_ARCH_7__)
-# define CAN_USE_ARMV7_INSTRUCTIONS 1
-# ifndef CAN_USE_VFP3_INSTRUCTIONS
-#  define CAN_USE_VFP3_INSTRUCTIONS
-# endif
-#endif
-
-
-// Target architecture detection. This may be set externally. If not, detect
-// in the same way as the host architecture, that is, target the native
-// environment as presented by the compiler.
-#if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_X87 &&\
-    !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_MIPS
-#if defined(_M_X64) || defined(__x86_64__)
-#define V8_TARGET_ARCH_X64 1
-#elif defined(_M_IX86) || defined(__i386__)
-#define V8_TARGET_ARCH_IA32 1
-#elif defined(__AARCH64EL__)
-#define V8_TARGET_ARCH_ARM64 1
-#elif defined(__ARMEL__)
-#define V8_TARGET_ARCH_ARM 1
-#elif defined(__MIPSEB__) || defined(__MIPSEL__)
-#define V8_TARGET_ARCH_MIPS 1
-#else
-#error Target architecture was not detected as supported by v8
-#endif
-#endif
-
-// Check for supported combinations of host and target architectures.
-#if V8_TARGET_ARCH_IA32 && !V8_HOST_ARCH_IA32
-#error Target architecture ia32 is only supported on ia32 host
-#endif
-#if V8_TARGET_ARCH_X64 && !V8_HOST_ARCH_X64
-#error Target architecture x64 is only supported on x64 host
-#endif
-#if (V8_TARGET_ARCH_ARM && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_ARM))
-#error Target architecture arm is only supported on arm and ia32 host
-#endif
-#if (V8_TARGET_ARCH_ARM64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_ARM64))
-#error Target architecture arm64 is only supported on arm64 and x64 host
-#endif
-#if (V8_TARGET_ARCH_MIPS && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_MIPS))
-#error Target architecture mips is only supported on mips and ia32 host
-#endif
-
 // Determine whether we are running in a simulated environment.
 // Setting USE_SIMULATOR explicitly from the build script will force
 // the use of a simulated environment.
@@ -127,27 +43,6 @@
 #endif
 #endif

-// Determine architecture endianness.
-#if V8_TARGET_ARCH_IA32
-#define V8_TARGET_LITTLE_ENDIAN 1
-#elif V8_TARGET_ARCH_X64
-#define V8_TARGET_LITTLE_ENDIAN 1
-#elif V8_TARGET_ARCH_ARM
-#define V8_TARGET_LITTLE_ENDIAN 1
-#elif V8_TARGET_ARCH_ARM64
-#define V8_TARGET_LITTLE_ENDIAN 1
-#elif V8_TARGET_ARCH_MIPS
-#if defined(__MIPSEB__)
-#define V8_TARGET_BIG_ENDIAN 1
-#else
-#define V8_TARGET_LITTLE_ENDIAN 1
-#endif
-#elif V8_TARGET_ARCH_X87
-#define V8_TARGET_LITTLE_ENDIAN 1
-#else
-#error Unknown target architecture endianness
-#endif
-
 // Determine whether the architecture uses an out-of-line constant pool.
 #define V8_OOL_CONSTANT_POOL 0

@@ -221,10 +116,6 @@
 #define V8PRIxPTR "lx"
 #endif

-#if V8_OS_MACOSX || defined(__FreeBSD__) || defined(__OpenBSD__)
-#define USING_BSD_ABI
-#endif
-
// -----------------------------------------------------------------------------
 // Constants

@@ -300,12 +191,6 @@

 // Round up n to be a multiple of sz, where sz is a power of 2.
 #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
-
-
-// The USE(x) template is used to silence C++ compiler warnings
-// issued for (yet) unused variables (typically parameters).
-template <typename T>
-inline void USE(T) { }


 // FUNCTION_ADDR(f) gets the address of a C function f.
=======================================
--- /branches/bleeding_edge/src/lazy-instance.h Tue Apr 29 06:42:26 2014 UTC
+++ /branches/bleeding_edge/src/lazy-instance.h Wed May 28 08:07:18 2014 UTC
@@ -68,7 +68,7 @@
 #ifndef V8_LAZY_INSTANCE_H_
 #define V8_LAZY_INSTANCE_H_

-#include "checks.h"
+#include "base/macros.h"
 #include "once.h"

 namespace v8 {
=======================================
--- /branches/bleeding_edge/src/once.cc Tue Apr 29 06:42:26 2014 UTC
+++ /branches/bleeding_edge/src/once.cc Wed May 28 08:07:18 2014 UTC
@@ -11,7 +11,6 @@
 #endif

 #include "atomicops.h"
-#include "checks.h"

 namespace v8 {
 namespace internal {
=======================================
--- /branches/bleeding_edge/src/platform/mutex.h Tue Apr 29 06:42:26 2014 UTC +++ /branches/bleeding_edge/src/platform/mutex.h Wed May 28 08:07:18 2014 UTC
@@ -5,6 +5,7 @@
 #ifndef V8_PLATFORM_MUTEX_H_
 #define V8_PLATFORM_MUTEX_H_

+#include "../checks.h"
 #include "../lazy-instance.h"
 #if V8_OS_WIN
 #include "../win32-headers.h"
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Tue May 27 07:57:22 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-api.cc Wed May 28 08:07:18 2014 UTC
@@ -6668,9 +6668,6 @@
       "\"PASS\"",
       "PASS");
 }
-
-
-template <typename T> static void USE(T) { }


 // The point of this test is type checking. We run it only so compilers
@@ -15831,19 +15828,19 @@
   no_failure = i::JSObject::SetElement(
       jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked();
   ASSERT(!no_failure.is_null());
-  i::USE(no_failure);
+  USE(no_failure);
   CheckElementValue(isolate, 2, jsobj, 1);
   *value.location() = i::Smi::FromInt(256);
   no_failure = i::JSObject::SetElement(
       jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked();
   ASSERT(!no_failure.is_null());
-  i::USE(no_failure);
+  USE(no_failure);
   CheckElementValue(isolate, 255, jsobj, 1);
   *value.location() = i::Smi::FromInt(-1);
   no_failure = i::JSObject::SetElement(
       jsobj, 1, value, NONE, i::SLOPPY).ToHandleChecked();
   ASSERT(!no_failure.is_null());
-  i::USE(no_failure);
+  USE(no_failure);
   CheckElementValue(isolate, 0, jsobj, 1);

   result = CompileRun("for (var i = 0; i < 8; i++) {"
=======================================
--- /branches/bleeding_edge/tools/gyp/v8.gyp    Mon May 26 11:28:08 2014 UTC
+++ /branches/bleeding_edge/tools/gyp/v8.gyp    Wed May 28 08:07:18 2014 UTC
@@ -1061,6 +1061,7 @@
         '../../src',
       ],
       'sources': [
+        '../../src/base/build_config.h',
         '../../src/base/macros.h',
       ],
       'conditions': [

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to