diff --git a/BUILD.gn b/BUILD.gn index 26ef84bdb8..804ae90631 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -130,6 +130,17 @@ config("libplatform_config") { include_dirs = [ "include" ] } +# This config should be applied to code using the libbase. +config("libbase_config") { + if (is_component_build) { + defines = [ "USING_V8_BASE_SHARED" ] + } + libs = [] + if (is_android && current_toolchain != host_toolchain) { + libs += [ "log" ] + } +} + # This config should be applied to code using the libsampler. config("libsampler_config") { include_dirs = [ "include" ] @@ -145,10 +156,6 @@ config("external_config") { if (v8_enable_inspector_override) { include_dirs += [ "$target_gen_dir/include" ] } - libs = [] - if (is_android && current_toolchain != host_toolchain) { - libs += [ "log" ] - } } # This config should only be applied to code that needs to be explicitly @@ -2155,9 +2162,7 @@ v8_source_set("v8_base") { } } -v8_source_set("v8_libbase") { - visibility = [ ":*" ] # Only targets in this file can depend on this. - +v8_component("v8_libbase") { sources = [ "src/base/adapters.h", "src/base/atomic-utils.h", @@ -2173,6 +2178,7 @@ v8_source_set("v8_libbase") { "src/base/atomicops_internals_x86_gcc.cc", "src/base/atomicops_internals_x86_gcc.h", "src/base/atomicops_internals_x86_msvc.h", + "src/base/base-export.h", "src/base/bits.cc", "src/base/bits.h", "src/base/build_config.h", @@ -2223,8 +2229,14 @@ v8_source_set("v8_libbase") { configs = [ ":internal_config_base" ] + public_configs = [ ":libbase_config" ] + defines = [] + if (is_component_build) { + defines = [ "BUILDING_V8_BASE_SHARED" ] + } + if (is_posix) { sources += [ "src/base/platform/platform-posix.cc" ] } @@ -2368,6 +2380,7 @@ v8_source_set("fuzzer_support_nocomponent") { ] public_deps = [ + ":v8_libbase", ":v8_libplatform", ] } @@ -2396,6 +2409,7 @@ if (current_toolchain == v8_snapshot_toolchain) { deps = [ ":v8_base", + ":v8_libbase", ":v8_libplatform", ":v8_nosnapshot", "//build/config/sanitizers:deps", @@ -2518,6 +2532,7 @@ v8_executable("d8") { deps = [ ":d8_js2c", ":v8", + ":v8_libbase", ":v8_libplatform", "//build/config/sanitizers:deps", "//build/win:default_exe_manifest", @@ -2558,6 +2573,7 @@ v8_executable("v8_hello_world") { deps = [ ":v8", + ":v8_libbase", ":v8_libplatform", "//build/config/sanitizers:deps", "//build/win:default_exe_manifest", @@ -2582,6 +2598,7 @@ v8_executable("v8_sample_process") { deps = [ ":v8", + ":v8_libbase", ":v8_libplatform", "//build/config/sanitizers:deps", "//build/win:default_exe_manifest", @@ -2604,6 +2621,7 @@ v8_executable("v8_parser_shell") { ] deps = [ + ":v8_libbase", ":v8_libplatform", "//build/config/sanitizers:deps", "//build/win:default_exe_manifest", @@ -2647,6 +2665,7 @@ if (want_v8_shell) { deps = [ ":v8", + ":v8_libbase", ":v8_libplatform", "//build/config/sanitizers:deps", "//build/win:default_exe_manifest", diff --git a/samples/samples.gyp b/samples/samples.gyp index e5e9ef0f8c..e7c26cf262 100644 --- a/samples/samples.gyp +++ b/samples/samples.gyp @@ -36,6 +36,7 @@ 'type': 'executable', 'dependencies': [ '../src/v8.gyp:v8', + '../src/v8.gyp:v8_libbase', '../src/v8.gyp:v8_libplatform', ], 'include_dirs': [ diff --git a/src/base/atomicops_internals_x86_gcc.h b/src/base/atomicops_internals_x86_gcc.h index 55bc44cd8b..8bd0c3bd9e 100644 --- a/src/base/atomicops_internals_x86_gcc.h +++ b/src/base/atomicops_internals_x86_gcc.h @@ -7,6 +7,8 @@ #ifndef V8_BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ #define V8_BASE_ATOMICOPS_INTERNALS_X86_GCC_H_ +#include "src/base/base-export.h" + namespace v8 { namespace base { @@ -21,7 +23,8 @@ struct AtomicOps_x86CPUFeatureStruct { bool has_sse2; // Processor has SSE2. #endif }; -extern struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures; +V8_BASE_EXPORT extern struct AtomicOps_x86CPUFeatureStruct + AtomicOps_Internalx86CPUFeatures; #define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory") diff --git a/src/base/base-export.h b/src/base/base-export.h new file mode 100644 index 0000000000..a2b3dacaf7 --- /dev/null +++ b/src/base/base-export.h @@ -0,0 +1,31 @@ +// Copyright 2016 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_BASE_EXPORT_H_ +#define V8_BASE_BASE_EXPORT_H_ + +#include "include/v8config.h" + +#if V8_OS_WIN + +#ifdef BUILDING_V8_BASE_SHARED +#define V8_BASE_EXPORT __declspec(dllexport) +#elif USING_V8_BASE_SHARED +#define V8_BASE_EXPORT __declspec(dllimport) +#else +#define V8_BASE_EXPORT +#endif // BUILDING_V8_BASE_SHARED + +#else // !V8_OS_WIN + +// Setup for Linux shared library export. +#ifdef BUILDING_V8_BASE_SHARED +#define V8_BASE_EXPORT __attribute__((visibility("default"))) +#else +#define V8_BASE_EXPORT +#endif + +#endif // V8_OS_WIN + +#endif // V8_BASE_BASE_EXPORT_H_ diff --git a/src/base/bits.h b/src/base/bits.h index da12ee60fe..b1864940b8 100644 --- a/src/base/bits.h +++ b/src/base/bits.h @@ -6,6 +6,8 @@ #define V8_BASE_BITS_H_ #include + +#include "src/base/base-export.h" #include "src/base/macros.h" #if V8_CC_MSVC #include @@ -172,8 +174,7 @@ inline bool IsPowerOfTwo64(uint64_t value) { // power of two, it is returned as is. |value| must be less than or equal to // 0x80000000u. Implementation is from "Hacker's Delight" by Henry S. Warren, // Jr., figure 3-3, page 48, where the function is called clp2. -uint32_t RoundUpToPowerOfTwo32(uint32_t value); - +V8_BASE_EXPORT uint32_t RoundUpToPowerOfTwo32(uint32_t value); // RoundDownToPowerOfTwo32(value) returns the greatest power of two which is // less than or equal to |value|. If you pass in a |value| that is already a @@ -241,7 +242,7 @@ inline bool SignedSubOverflow32(int32_t lhs, int32_t rhs, int32_t* val) { // SignedMulOverflow32(lhs,rhs,val) performs a signed multiplication of |lhs| // and |rhs| and stores the result into the variable pointed to by |val| and // returns true if the signed multiplication resulted in an overflow. -bool SignedMulOverflow32(int32_t lhs, int32_t rhs, int32_t* val); +V8_BASE_EXPORT bool SignedMulOverflow32(int32_t lhs, int32_t rhs, int32_t* val); // SignedAddOverflow64(lhs,rhs,val) performs a signed summation of |lhs| and // |rhs| and stores the result into the variable pointed to by |val| and @@ -265,31 +266,28 @@ inline bool SignedSubOverflow64(int64_t lhs, int64_t rhs, int64_t* val) { // SignedMulOverflow64(lhs,rhs,val) performs a signed multiplication of |lhs| // and |rhs| and stores the result into the variable pointed to by |val| and // returns true if the signed multiplication resulted in an overflow. -bool SignedMulOverflow64(int64_t lhs, int64_t rhs, int64_t* val); +V8_BASE_EXPORT bool SignedMulOverflow64(int64_t lhs, int64_t rhs, int64_t* val); // SignedMulHigh32(lhs, rhs) multiplies two signed 32-bit values |lhs| and // |rhs|, extracts the most significant 32 bits of the result, and returns // those. -int32_t SignedMulHigh32(int32_t lhs, int32_t rhs); - +V8_BASE_EXPORT int32_t SignedMulHigh32(int32_t lhs, int32_t rhs); // SignedMulHighAndAdd32(lhs, rhs, acc) multiplies two signed 32-bit values // |lhs| and |rhs|, extracts the most significant 32 bits of the result, and // adds the accumulate value |acc|. -int32_t SignedMulHighAndAdd32(int32_t lhs, int32_t rhs, int32_t acc); - +V8_BASE_EXPORT int32_t SignedMulHighAndAdd32(int32_t lhs, int32_t rhs, + int32_t acc); // SignedDiv32(lhs, rhs) divides |lhs| by |rhs| and returns the quotient // truncated to int32. If |rhs| is zero, then zero is returned. If |lhs| // is minint and |rhs| is -1, it returns minint. -int32_t SignedDiv32(int32_t lhs, int32_t rhs); - +V8_BASE_EXPORT int32_t SignedDiv32(int32_t lhs, int32_t rhs); // SignedMod32(lhs, rhs) divides |lhs| by |rhs| and returns the remainder // truncated to int32. If either |rhs| is zero or |lhs| is minint and |rhs| // is -1, it returns zero. -int32_t SignedMod32(int32_t lhs, int32_t rhs); - +V8_BASE_EXPORT int32_t SignedMod32(int32_t lhs, int32_t rhs); // UnsignedAddOverflow32(lhs,rhs,val) performs an unsigned summation of |lhs| // and |rhs| and stores the result into the variable pointed to by |val| and @@ -319,18 +317,16 @@ inline uint32_t UnsignedMod32(uint32_t lhs, uint32_t rhs) { // Clamp |value| on overflow and underflow conditions. -int64_t FromCheckedNumeric(const internal::CheckedNumeric value); - +V8_BASE_EXPORT int64_t +FromCheckedNumeric(const internal::CheckedNumeric value); // SignedSaturatedAdd64(lhs, rhs) adds |lhs| and |rhs|, // checks and returns the result. -int64_t SignedSaturatedAdd64(int64_t lhs, int64_t rhs); - +V8_BASE_EXPORT int64_t SignedSaturatedAdd64(int64_t lhs, int64_t rhs); // SignedSaturatedSub64(lhs, rhs) substracts |lhs| by |rhs|, // checks and returns the result. -int64_t SignedSaturatedSub64(int64_t lhs, int64_t rhs); - +V8_BASE_EXPORT int64_t SignedSaturatedSub64(int64_t lhs, int64_t rhs); } // namespace bits } // namespace base diff --git a/src/base/cpu.h b/src/base/cpu.h index 19d4102f5b..e0fcea1ca0 100644 --- a/src/base/cpu.h +++ b/src/base/cpu.h @@ -13,6 +13,7 @@ #ifndef V8_BASE_CPU_H_ #define V8_BASE_CPU_H_ +#include "src/base/base-export.h" #include "src/base/macros.h" namespace v8 { @@ -28,7 +29,7 @@ namespace base { // architectures. For each architecture the file cpu_.cc contains the // implementation of these static functions. -class CPU final { +class V8_BASE_EXPORT CPU final { public: CPU(); diff --git a/src/base/debug/stack_trace.h b/src/base/debug/stack_trace.h index e938ef2868..1361bb545a 100644 --- a/src/base/debug/stack_trace.h +++ b/src/base/debug/stack_trace.h @@ -13,6 +13,7 @@ #include #include +#include "src/base/base-export.h" #include "src/base/build_config.h" #if V8_OS_POSIX @@ -31,8 +32,8 @@ namespace debug { // Enables stack dump to console output on exception and signals. // When enabled, the process will quit immediately. This is meant to be used in // tests only! -bool EnableInProcessStackDumping(); -void DisableSignalStackDump(); +V8_BASE_EXPORT bool EnableInProcessStackDumping(); +V8_BASE_EXPORT void DisableSignalStackDump(); // A stacktrace can be helpful in debugging. For example, you can include a // stacktrace member in a object (probably around #ifndef NDEBUG) so that you diff --git a/src/base/division-by-constant.cc b/src/base/division-by-constant.cc index 5167b7a60c..3d8fc1a4a9 100644 --- a/src/base/division-by-constant.cc +++ b/src/base/division-by-constant.cc @@ -12,13 +12,6 @@ namespace v8 { namespace base { -template -bool MagicNumbersForDivision::operator==( - const MagicNumbersForDivision& rhs) const { - return multiplier == rhs.multiplier && shift == rhs.shift && add == rhs.add; -} - - template MagicNumbersForDivision SignedDivisionByConstant(T d) { STATIC_ASSERT(static_cast(0) < static_cast(-1)); @@ -100,9 +93,6 @@ MagicNumbersForDivision UnsignedDivisionByConstant(T d, // ----------------------------------------------------------------------------- // Instantiations. -template struct MagicNumbersForDivision; -template struct MagicNumbersForDivision; - template MagicNumbersForDivision SignedDivisionByConstant(uint32_t d); template MagicNumbersForDivision SignedDivisionByConstant(uint64_t d); diff --git a/src/base/division-by-constant.h b/src/base/division-by-constant.h index 02e7e14b01..d018ea5ff1 100644 --- a/src/base/division-by-constant.h +++ b/src/base/division-by-constant.h @@ -5,6 +5,10 @@ #ifndef V8_BASE_DIVISION_BY_CONSTANT_H_ #define V8_BASE_DIVISION_BY_CONSTANT_H_ +#include + +#include "src/base/base-export.h" + namespace v8 { namespace base { @@ -14,10 +18,12 @@ namespace base { // Delight", chapter 10. The template parameter must be one of the unsigned // integral types. template -struct MagicNumbersForDivision { +struct V8_BASE_EXPORT MagicNumbersForDivision { MagicNumbersForDivision(T m, unsigned s, bool a) : multiplier(m), shift(s), add(a) {} - bool operator==(const MagicNumbersForDivision& rhs) const; + bool operator==(const MagicNumbersForDivision& rhs) const { + return multiplier == rhs.multiplier && shift == rhs.shift && add == rhs.add; + } T multiplier; unsigned shift; @@ -28,17 +34,29 @@ struct MagicNumbersForDivision { // Calculate the multiplier and shift for signed division via multiplication. // The divisor must not be -1, 0 or 1 when interpreted as a signed value. template -MagicNumbersForDivision SignedDivisionByConstant(T d); - +V8_BASE_EXPORT MagicNumbersForDivision SignedDivisionByConstant(T d); // Calculate the multiplier and shift for unsigned division via multiplication, // see Warren's "Hacker's Delight", chapter 10. The divisor must not be 0 and // leading_zeros can be used to speed up the calculation if the given number of // upper bits of the dividend value are known to be zero. template -MagicNumbersForDivision UnsignedDivisionByConstant( +V8_BASE_EXPORT MagicNumbersForDivision UnsignedDivisionByConstant( T d, unsigned leading_zeros = 0); +template struct V8_BASE_EXPORT MagicNumbersForDivision; +template struct V8_BASE_EXPORT MagicNumbersForDivision; + +extern template V8_BASE_EXPORT MagicNumbersForDivision +SignedDivisionByConstant(uint32_t d); +extern template V8_BASE_EXPORT MagicNumbersForDivision +SignedDivisionByConstant(uint64_t d); + +extern template V8_BASE_EXPORT MagicNumbersForDivision +UnsignedDivisionByConstant(uint32_t d, unsigned leading_zeros); +extern template V8_BASE_EXPORT MagicNumbersForDivision +UnsignedDivisionByConstant(uint64_t d, unsigned leading_zeros); + } // namespace base } // namespace v8 diff --git a/src/base/file-utils.cc b/src/base/file-utils.cc index 2262df97d0..31b1b41190 100644 --- a/src/base/file-utils.cc +++ b/src/base/file-utils.cc @@ -10,13 +10,13 @@ #include "src/base/platform/platform.h" namespace v8 { -namespace internal { +namespace base { char* RelativePath(char** buffer, const char* exec_path, const char* name) { DCHECK(exec_path); int path_separator = static_cast(strlen(exec_path)) - 1; while (path_separator >= 0 && - !base::OS::isDirectorySeparator(exec_path[path_separator])) { + !OS::isDirectorySeparator(exec_path[path_separator])) { path_separator--; } if (path_separator >= 0) { @@ -32,5 +32,5 @@ char* RelativePath(char** buffer, const char* exec_path, const char* name) { return *buffer; } -} // namespace internal +} // namespace base } // namespace v8 diff --git a/src/base/file-utils.h b/src/base/file-utils.h index ce9e9a1c41..271f0ffb05 100644 --- a/src/base/file-utils.h +++ b/src/base/file-utils.h @@ -2,17 +2,20 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef V8_FILE_UTILS_H_ -#define V8_FILE_UTILS_H_ +#ifndef V8_BASE_FILE_UTILS_H_ +#define V8_BASE_FILE_UTILS_H_ + +#include "src/base/base-export.h" namespace v8 { -namespace internal { +namespace base { // Helper functions to manipulate file paths. -char* RelativePath(char** buffer, const char* exec_path, const char* name); +V8_BASE_EXPORT char* RelativePath(char** buffer, const char* exec_path, + const char* name); -} // namespace internal +} // namespace base } // namespace v8 #endif // V8_FILE_UTILS_H_ diff --git a/src/base/functional.h b/src/base/functional.h index ff0d8075b9..634e7bac85 100644 --- a/src/base/functional.h +++ b/src/base/functional.h @@ -13,6 +13,7 @@ #include #include +#include "src/base/base-export.h" #include "src/base/macros.h" namespace v8 { @@ -67,7 +68,7 @@ struct hash; V8_INLINE size_t hash_combine() { return 0u; } V8_INLINE size_t hash_combine(size_t seed) { return seed; } -size_t hash_combine(size_t seed, size_t value); +V8_BASE_EXPORT size_t hash_combine(size_t seed, size_t value); template V8_INLINE size_t hash_combine(T const& v, Ts const&... vs) { return hash_combine(hash_combine(vs...), hash()(v)); @@ -91,9 +92,9 @@ V8_BASE_HASH_VALUE_TRIVIAL(unsigned char) V8_BASE_HASH_VALUE_TRIVIAL(unsigned short) // NOLINT(runtime/int) #undef V8_BASE_HASH_VALUE_TRIVIAL -size_t hash_value(unsigned int); -size_t hash_value(unsigned long); // NOLINT(runtime/int) -size_t hash_value(unsigned long long); // NOLINT(runtime/int) +V8_BASE_EXPORT size_t hash_value(unsigned int); +V8_BASE_EXPORT size_t hash_value(unsigned long); // NOLINT(runtime/int) +V8_BASE_EXPORT size_t hash_value(unsigned long long); // NOLINT(runtime/int) #define V8_BASE_HASH_VALUE_SIGNED(type) \ V8_INLINE size_t hash_value(signed type v) { \ diff --git a/src/base/ieee754.h b/src/base/ieee754.h index 80523a1414..72f3db15ef 100644 --- a/src/base/ieee754.h +++ b/src/base/ieee754.h @@ -5,73 +5,75 @@ #ifndef V8_BASE_IEEE754_H_ #define V8_BASE_IEEE754_H_ +#include "src/base/base-export.h" + namespace v8 { namespace base { namespace ieee754 { // Returns the arc cosine of |x|; that is the value whose cosine is |x|. -double acos(double x); +V8_BASE_EXPORT double acos(double x); // Returns the inverse hyperbolic cosine of |x|; that is the value whose // hyperbolic cosine is |x|. -double acosh(double x); +V8_BASE_EXPORT double acosh(double x); // Returns the arc sine of |x|; that is the value whose sine is |x|. -double asin(double x); +V8_BASE_EXPORT double asin(double x); // Returns the inverse hyperbolic sine of |x|; that is the value whose // hyperbolic sine is |x|. -double asinh(double x); +V8_BASE_EXPORT double asinh(double x); // Returns the principal value of the arc tangent of |x|; that is the value // whose tangent is |x|. -double atan(double x); +V8_BASE_EXPORT double atan(double x); // Returns the principal value of the arc tangent of |y/x|, using the signs of // the two arguments to determine the quadrant of the result. -double atan2(double y, double x); +V8_BASE_EXPORT double atan2(double y, double x); // Returns the cosine of |x|, where |x| is given in radians. -double cos(double x); +V8_BASE_EXPORT double cos(double x); // Returns the base-e exponential of |x|. -double exp(double x); +V8_BASE_EXPORT double exp(double x); -double atanh(double x); +V8_BASE_EXPORT double atanh(double x); // Returns the natural logarithm of |x|. -double log(double x); +V8_BASE_EXPORT double log(double x); // Returns a value equivalent to |log(1+x)|, but computed in a way that is // accurate even if the value of |x| is near zero. -double log1p(double x); +V8_BASE_EXPORT double log1p(double x); // Returns the base 2 logarithm of |x|. -double log2(double x); +V8_BASE_EXPORT double log2(double x); // Returns the base 10 logarithm of |x|. -double log10(double x); +V8_BASE_EXPORT double log10(double x); // Returns the cube root of |x|. -double cbrt(double x); +V8_BASE_EXPORT double cbrt(double x); // Returns exp(x)-1, the exponential of |x| minus 1. -double expm1(double x); +V8_BASE_EXPORT double expm1(double x); // Returns the sine of |x|, where |x| is given in radians. -double sin(double x); +V8_BASE_EXPORT double sin(double x); // Returns the tangent of |x|, where |x| is given in radians. -double tan(double x); +V8_BASE_EXPORT double tan(double x); // Returns the hyperbolic cosine of |x|, where |x| is given radians. -double cosh(double x); +V8_BASE_EXPORT double cosh(double x); // Returns the hyperbolic sine of |x|, where |x| is given radians. -double sinh(double x); +V8_BASE_EXPORT double sinh(double x); // Returns the hyperbolic tangent of |x|, where |x| is given radians. -double tanh(double x); +V8_BASE_EXPORT double tanh(double x); } // namespace ieee754 } // namespace base diff --git a/src/base/logging.h b/src/base/logging.h index 50fceca88b..7bbb82a485 100644 --- a/src/base/logging.h +++ b/src/base/logging.h @@ -9,10 +9,11 @@ #include #include +#include "src/base/base-export.h" #include "src/base/build_config.h" #include "src/base/compiler-specific.h" -extern "C" PRINTF_FORMAT(3, 4) V8_NORETURN +extern "C" PRINTF_FORMAT(3, 4) V8_NORETURN V8_BASE_EXPORT void V8_Fatal(const char* file, int line, const char* format, ...); // The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during @@ -87,8 +88,8 @@ std::string* MakeCheckOpString(Lhs const& lhs, Rhs const& rhs, // Commonly used instantiations of MakeCheckOpString<>. Explicitly instantiated // in logging.cc. -#define DEFINE_MAKE_CHECK_OP_STRING(type) \ - extern template std::string* MakeCheckOpString( \ +#define DEFINE_MAKE_CHECK_OP_STRING(type) \ + extern template V8_BASE_EXPORT std::string* MakeCheckOpString( \ type const&, type const&, char const*); DEFINE_MAKE_CHECK_OP_STRING(int) DEFINE_MAKE_CHECK_OP_STRING(long) // NOLINT(runtime/int) @@ -117,10 +118,11 @@ DEFINE_MAKE_CHECK_OP_STRING(void const*) char const* msg) { \ return V8_LIKELY(lhs op rhs) ? nullptr : MakeCheckOpString(lhs, rhs, msg); \ } \ - extern template std::string* Check##NAME##Impl( \ + extern template V8_BASE_EXPORT std::string* Check##NAME##Impl( \ float const& lhs, float const& rhs, char const* msg); \ - extern template std::string* Check##NAME##Impl( \ - double const& lhs, double const& rhs, char const* msg); + extern template V8_BASE_EXPORT std::string* \ + Check##NAME##Impl(double const& lhs, double const& rhs, \ + char const* msg); DEFINE_CHECK_OP_IMPL(EQ, ==) DEFINE_CHECK_OP_IMPL(NE, !=) DEFINE_CHECK_OP_IMPL(LE, <=) diff --git a/src/base/once.h b/src/base/once.h index 790a8866e0..8008812d75 100644 --- a/src/base/once.h +++ b/src/base/once.h @@ -55,6 +55,7 @@ #include #include "src/base/atomicops.h" +#include "src/base/base-export.h" namespace v8 { namespace base { @@ -79,7 +80,8 @@ struct OneArgFunction { typedef void (*type)(T); }; -void CallOnceImpl(OnceType* once, PointerArgFunction init_func, void* arg); +V8_BASE_EXPORT void CallOnceImpl(OnceType* once, PointerArgFunction init_func, + void* arg); inline void CallOnce(OnceType* once, NoArgFunction init_func) { if (Acquire_Load(once) != ONCE_STATE_DONE) { diff --git a/src/base/platform/condition-variable.h b/src/base/platform/condition-variable.h index 72d6f28507..48e7c369ca 100644 --- a/src/base/platform/condition-variable.h +++ b/src/base/platform/condition-variable.h @@ -5,6 +5,7 @@ #ifndef V8_BASE_PLATFORM_CONDITION_VARIABLE_H_ #define V8_BASE_PLATFORM_CONDITION_VARIABLE_H_ +#include "src/base/base-export.h" #include "src/base/lazy-instance.h" #include "src/base/platform/mutex.h" @@ -28,7 +29,7 @@ class TimeDelta; // the mutex and suspend the execution of the calling thread. When the condition // variable is notified, the thread is awakened, and the mutex is reacquired. -class ConditionVariable final { +class V8_BASE_EXPORT ConditionVariable final { public: ConditionVariable(); ~ConditionVariable(); diff --git a/src/base/platform/mutex.h b/src/base/platform/mutex.h index 61df19d66a..e7231bdd9e 100644 --- a/src/base/platform/mutex.h +++ b/src/base/platform/mutex.h @@ -5,6 +5,7 @@ #ifndef V8_BASE_PLATFORM_MUTEX_H_ #define V8_BASE_PLATFORM_MUTEX_H_ +#include "src/base/base-export.h" #include "src/base/lazy-instance.h" #if V8_OS_WIN #include "src/base/win32-headers.h" @@ -33,7 +34,7 @@ namespace base { // |TryLock()|. The behavior of a program is undefined if a mutex is destroyed // while still owned by some thread. The Mutex class is non-copyable. -class Mutex final { +class V8_BASE_EXPORT Mutex final { public: Mutex(); ~Mutex(); @@ -127,7 +128,7 @@ typedef LazyStaticInstance, // The behavior of a program is undefined if a recursive mutex is destroyed // while still owned by some thread. The RecursiveMutex class is non-copyable. -class RecursiveMutex final { +class V8_BASE_EXPORT RecursiveMutex final { public: RecursiveMutex(); ~RecursiveMutex(); diff --git a/src/base/platform/platform.h b/src/base/platform/platform.h index d3b6c9c1cf..5d570e7048 100644 --- a/src/base/platform/platform.h +++ b/src/base/platform/platform.h @@ -25,6 +25,7 @@ #include #include +#include "src/base/base-export.h" #include "src/base/build_config.h" #include "src/base/compiler-specific.h" #include "src/base/platform/mutex.h" @@ -69,7 +70,7 @@ inline intptr_t InternalGetExistingThreadLocal(intptr_t index) { #define V8_FAST_TLS_SUPPORTED 1 -extern intptr_t kMacTlsBaseOffset; +extern V8_BASE_EXPORT intptr_t kMacTlsBaseOffset; INLINE(intptr_t InternalGetExistingThreadLocal(intptr_t index)); @@ -102,7 +103,7 @@ class TimezoneCache; // functions. Add methods here to cope with differences between the // supported platforms. -class OS { +class V8_BASE_EXPORT OS { public: // Initialize the OS class. // - random_seed: Used for the GetRandomMmapAddress() if non-zero. @@ -211,7 +212,7 @@ class OS { char text[kStackWalkMaxTextLen]; }; - class MemoryMappedFile { + class V8_BASE_EXPORT MemoryMappedFile { public: virtual ~MemoryMappedFile() {} virtual void* memory() const = 0; @@ -286,7 +287,7 @@ class OS { // Control of the reserved memory can be assigned to another VirtualMemory // object by assignment or copy-contructing. This removes the reserved memory // from the original object. -class VirtualMemory { +class V8_BASE_EXPORT VirtualMemory { public: // Empty VirtualMemory object, controlling no reserved memory. VirtualMemory(); @@ -418,7 +419,7 @@ class VirtualMemory { // thread. The Thread object should not be deallocated before the thread has // terminated. -class Thread { +class V8_BASE_EXPORT Thread { public: // Opaque data type for thread-local storage keys. typedef int32_t LocalStorageKey; diff --git a/src/base/platform/semaphore.h b/src/base/platform/semaphore.h index 39029c83fc..31aeca3d9b 100644 --- a/src/base/platform/semaphore.h +++ b/src/base/platform/semaphore.h @@ -5,6 +5,7 @@ #ifndef V8_BASE_PLATFORM_SEMAPHORE_H_ #define V8_BASE_PLATFORM_SEMAPHORE_H_ +#include "src/base/base-export.h" #include "src/base/lazy-instance.h" #if V8_OS_WIN #include "src/base/win32-headers.h" @@ -31,7 +32,7 @@ class TimeDelta; // count reaches zero, threads waiting for the semaphore blocks until the // count becomes non-zero. -class Semaphore final { +class V8_BASE_EXPORT Semaphore final { public: explicit Semaphore(int count); ~Semaphore(); diff --git a/src/base/platform/time.h b/src/base/platform/time.h index be62014f91..ed1751268f 100644 --- a/src/base/platform/time.h +++ b/src/base/platform/time.h @@ -9,6 +9,7 @@ #include #include +#include "src/base/base-export.h" #include "src/base/bits.h" #include "src/base/macros.h" #include "src/base/safe_math.h" @@ -42,7 +43,7 @@ class TimeBase; // This class represents a duration of time, internally represented in // microseonds. -class TimeDelta final { +class V8_BASE_EXPORT TimeDelta final { public: TimeDelta() : delta_(0) {} @@ -277,7 +278,7 @@ class TimeBase { // This class represents an absolute point in time, internally represented as // microseconds (s/1,000,000) since 00:00:00 UTC, January 1, 1970. -class Time final : public time_internal::TimeBase