Commit dedf6f6d authored by jochen's avatar jochen Committed by Commit bot

Reland of land "Turn libbase into a component" (patchset #1 id:1 of...

Reland of land "Turn libbase into a component" (patchset #1 id:1 of https://codereview.chromium.org/2396933002/ )

Reason for revert:
let's see whether it sticks this time

Original issue's description:
> Revert of Reland "Turn libbase into a component" (patchset #1 id:1 of https://codereview.chromium.org/2395553002/ )
>
> Reason for revert:
> Speculative revert due to very strange-looking win/dbg failures
> which reference SignedDivisionByConstant:
>
> https://build.chromium.org/p/client.v8/builders/V8%20Win64%20-%20debug/builds/12736
>
> Original issue's description:
> > Reland "Turn libbase into a component"
> >
> > Original issue's description:
> > > Turn libbase into a component
> > >
> > > This is a precondition for turning libplatform into a component
> > >
> > > BUG=v8:5412
> > > R=jgruber@chromium.org,machenbach@chromium.org
> > > CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_compile_
> > dbg_ng;master.tryserver.chromium.android:android_clang_dbg_recipe
> > >
> > > Committed: https://crrev.com/614e615775f732d71b5ee94ed29737d8de687104
> > > Cr-Commit-Position: refs/heads/master@{#39950}
> >
> > BUG=v8:5412
> > TBR=jgruber@chromium.org,machenbach@chromium.org
> > CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_chromium_compile_dbg_ng;master.tryserver.chromium.android:android_clang_dbg_recipe;master.tryserver.chromium.mac:mac_chromium_compile_dbg_ng
> >
> > Committed: https://crrev.com/17cb51254cafa932025e9980b60f89f756d411cb
> > Cr-Commit-Position: refs/heads/master@{#39969}
>
> TBR=jgruber@chromium.org,machenbach@chromium.org,jochen@chromium.org
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=v8:5412
>
> Committed: https://crrev.com/e75b9f6ed5da39e6c7a8d70cf48afbc9958afc85
> Cr-Commit-Position: refs/heads/master@{#40009}

TBR=jgruber@chromium.org,machenbach@chromium.org,adamk@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=v8:5412

Review-Url: https://codereview.chromium.org/2399323002
Cr-Commit-Position: refs/heads/master@{#40068}
parent 19dab886
......@@ -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",
......
......@@ -36,6 +36,7 @@
'type': 'executable',
'dependencies': [
'../src/v8.gyp:v8',
'../src/v8.gyp:v8_libbase',
'../src/v8.gyp:v8_libplatform',
],
'include_dirs': [
......
......@@ -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")
......
// 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_
......@@ -6,6 +6,8 @@
#define V8_BASE_BITS_H_
#include <stdint.h>
#include "src/base/base-export.h"
#include "src/base/macros.h"
#if V8_CC_MSVC
#include <intrin.h>
......@@ -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<int64_t> value);
V8_BASE_EXPORT int64_t
FromCheckedNumeric(const internal::CheckedNumeric<int64_t> 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
......
......@@ -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_<arch>.cc contains the
// implementation of these static functions.
class CPU final {
class V8_BASE_EXPORT CPU final {
public:
CPU();
......
......@@ -13,6 +13,7 @@
#include <iosfwd>
#include <string>
#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
......
......@@ -12,13 +12,6 @@
namespace v8 {
namespace base {
template <class T>
bool MagicNumbersForDivision<T>::operator==(
const MagicNumbersForDivision& rhs) const {
return multiplier == rhs.multiplier && shift == rhs.shift && add == rhs.add;
}
template <class T>
MagicNumbersForDivision<T> SignedDivisionByConstant(T d) {
STATIC_ASSERT(static_cast<T>(0) < static_cast<T>(-1));
......@@ -100,9 +93,6 @@ MagicNumbersForDivision<T> UnsignedDivisionByConstant(T d,
// -----------------------------------------------------------------------------
// Instantiations.
template struct MagicNumbersForDivision<uint32_t>;
template struct MagicNumbersForDivision<uint64_t>;
template MagicNumbersForDivision<uint32_t> SignedDivisionByConstant(uint32_t d);
template MagicNumbersForDivision<uint64_t> SignedDivisionByConstant(uint64_t d);
......
......@@ -5,6 +5,10 @@
#ifndef V8_BASE_DIVISION_BY_CONSTANT_H_
#define V8_BASE_DIVISION_BY_CONSTANT_H_
#include <stdint.h>
#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 <class T>
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 <class T>
MagicNumbersForDivision<T> SignedDivisionByConstant(T d);
V8_BASE_EXPORT MagicNumbersForDivision<T> 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 <class T>
MagicNumbersForDivision<T> UnsignedDivisionByConstant(
V8_BASE_EXPORT MagicNumbersForDivision<T> UnsignedDivisionByConstant(
T d, unsigned leading_zeros = 0);
template struct V8_BASE_EXPORT MagicNumbersForDivision<uint32_t>;
template struct V8_BASE_EXPORT MagicNumbersForDivision<uint64_t>;
extern template V8_BASE_EXPORT MagicNumbersForDivision<uint32_t>
SignedDivisionByConstant(uint32_t d);
extern template V8_BASE_EXPORT MagicNumbersForDivision<uint64_t>
SignedDivisionByConstant(uint64_t d);
extern template V8_BASE_EXPORT MagicNumbersForDivision<uint32_t>
UnsignedDivisionByConstant(uint32_t d, unsigned leading_zeros);
extern template V8_BASE_EXPORT MagicNumbersForDivision<uint64_t>
UnsignedDivisionByConstant(uint64_t d, unsigned leading_zeros);
} // namespace base
} // namespace v8
......
......@@ -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<int>(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
......@@ -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_
......@@ -13,6 +13,7 @@
#include <functional>
#include <utility>
#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 <typename T, typename... Ts>
V8_INLINE size_t hash_combine(T const& v, Ts const&... vs) {
return hash_combine(hash_combine(vs...), hash<T>()(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) { \
......
......@@ -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
......
......@@ -9,10 +9,11 @@
#include <sstream>
#include <string>
#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<type, type>( \
#define DEFINE_MAKE_CHECK_OP_STRING(type) \
extern template V8_BASE_EXPORT std::string* MakeCheckOpString<type, type>( \
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<float, float>( \
extern template V8_BASE_EXPORT std::string* Check##NAME##Impl<float, float>( \
float const& lhs, float const& rhs, char const* msg); \
extern template std::string* Check##NAME##Impl<double, double>( \
double const& lhs, double const& rhs, char const* msg);
extern template V8_BASE_EXPORT std::string* \
Check##NAME##Impl<double, double>(double const& lhs, double const& rhs, \
char const* msg);
DEFINE_CHECK_OP_IMPL(EQ, ==)
DEFINE_CHECK_OP_IMPL(NE, !=)
DEFINE_CHECK_OP_IMPL(LE, <=)
......
......@@ -55,6 +55,7 @@
#include <stddef.h>
#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) {
......
......@@ -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();
......
......@@ -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<Mutex, DefaultConstructTrait<Mutex>,
// 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();
......
......@@ -25,6 +25,7 @@
#include <string>
#include <vector>
#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;
......
......@@ -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();
......
......@@ -9,6 +9,7 @@
#include <iosfwd>
#include <limits>
#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<Time> {
class V8_BASE_EXPORT Time final : public time_internal::TimeBase<Time> {
public:
// Contains the NULL time. Use Time::Now() to get the current time.
Time() : TimeBase(0) {}
......@@ -322,7 +323,7 @@ class Time final : public time_internal::TimeBase<Time> {
explicit Time(int64_t us) : TimeBase(us) {}
};
std::ostream& operator<<(std::ostream&, const Time&);
V8_BASE_EXPORT std::ostream& operator<<(std::ostream&, const Time&);
inline Time operator+(const TimeDelta& delta, const Time& time) {
return time + delta;
......@@ -339,7 +340,8 @@ inline Time operator+(const TimeDelta& delta, const Time& time) {
// Time::Now() may actually decrease or jump). But note that TimeTicks may
// "stand still", for example if the computer suspended.
class TimeTicks final : public time_internal::TimeBase<TimeTicks> {
class V8_BASE_EXPORT TimeTicks final
: public time_internal::TimeBase<TimeTicks> {
public:
TimeTicks() : TimeBase(0) {}
......@@ -376,7 +378,8 @@ inline TimeTicks operator+(const TimeDelta& delta, const TimeTicks& ticks) {
// Represents a clock, specific to a particular thread, than runs only while the
// thread is running.
class ThreadTicks final : public time_internal::TimeBase<ThreadTicks> {
class V8_BASE_EXPORT ThreadTicks final
: public time_internal::TimeBase<ThreadTicks> {
public:
ThreadTicks() : TimeBase(0) {}
......@@ -408,6 +411,9 @@ class ThreadTicks final : public time_internal::TimeBase<ThreadTicks> {
#endif
private:
template <class TimeClass>
friend class time_internal::TimeBase;
// Please use Now() or GetForThread() to create a new object. This is for
// internal use and testing. Ticks are in microseconds.
explicit ThreadTicks(int64_t ticks) : TimeBase(ticks) {}
......
......@@ -6,12 +6,14 @@
#define V8_BASE_SYS_INFO_H_
#include <stdint.h>
#include "src/base/base-export.h"
#include "src/base/compiler-specific.h"
namespace v8 {
namespace base {
class SysInfo final {
class V8_BASE_EXPORT SysInfo final {
public:
// Returns the number of logical processors/core on the current machine.
static int NumberOfProcessors();
......
......@@ -5,6 +5,7 @@
#ifndef V8_BASE_UTILS_RANDOM_NUMBER_GENERATOR_H_
#define V8_BASE_UTILS_RANDOM_NUMBER_GENERATOR_H_
#include "src/base/base-export.h"
#include "src/base/macros.h"
namespace v8 {
......@@ -31,7 +32,7 @@ namespace base {
// https://code.google.com/p/v8/issues/detail?id=2905
// This class is neither reentrant nor threadsafe.
class RandomNumberGenerator final {
class V8_BASE_EXPORT RandomNumberGenerator final {
public:
// EntropySource is used as a callback function when V8 needs a source of
// entropy.
......
......@@ -39,6 +39,7 @@
'type': 'executable',
'dependencies': [
'v8.gyp:v8',
'v8.gyp:v8_libbase',
'v8.gyp:v8_libplatform',
],
# Generated source files need this explicitly:
......
......@@ -465,7 +465,7 @@ class MemoryChunk {
V8_EXPORT_PRIVATE void AllocateOldToNewSlots();
void ReleaseOldToNewSlots();
void AllocateOldToOldSlots();
V8_EXPORT_PRIVATE void AllocateOldToOldSlots();
void ReleaseOldToOldSlots();
void AllocateTypedOldToNewSlots();
void ReleaseTypedOldToNewSlots();
......
......@@ -52,9 +52,9 @@ bool InitializeICUDefaultLocation(const char* exec_path,
}
char* icu_data_file_default;
#if defined(V8_TARGET_LITTLE_ENDIAN)
RelativePath(&icu_data_file_default, exec_path, "icudtl.dat");
base::RelativePath(&icu_data_file_default, exec_path, "icudtl.dat");
#elif defined(V8_TARGET_BIG_ENDIAN)
RelativePath(&icu_data_file_default, exec_path, "icudtb.dat");
base::RelativePath(&icu_data_file_default, exec_path, "icudtb.dat");
#else
#error Unknown byte ordering
#endif
......
......@@ -86,8 +86,9 @@ void InitializeExternalStartupData(const char* directory_path) {
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
char* natives;
char* snapshot;
LoadFromFiles(RelativePath(&natives, directory_path, "natives_blob.bin"),
RelativePath(&snapshot, directory_path, "snapshot_blob.bin"));
LoadFromFiles(
base::RelativePath(&natives, directory_path, "natives_blob.bin"),
base::RelativePath(&snapshot, directory_path, "snapshot_blob.bin"));
free(natives);
free(snapshot);
#endif // V8_USE_EXTERNAL_STARTUP_DATA
......
......@@ -68,16 +68,6 @@
'USING_V8_SHARED',
],
},
'target_conditions': [
['OS=="android" and _toolset=="target"', {
'libraries': [
'-llog',
],
'include_dirs': [
'src/common/android/include',
],
}],
],
'conditions': [
['OS=="mac"', {
'xcode_settings': {
......@@ -1768,7 +1758,7 @@
},
{
'target_name': 'v8_libbase',
'type': 'static_library',
'type': '<(component)',
'variables': {
'optimize': 'max',
},
......@@ -1791,6 +1781,7 @@
'base/atomicops_internals_x86_gcc.cc',
'base/atomicops_internals_x86_gcc.h',
'base/atomicops_internals_x86_msvc.h',
'base/base-export.h',
'base/bits.cc',
'base/bits.h',
'base/build_config.h',
......@@ -1838,6 +1829,16 @@
'base/utils/random-number-generator.cc',
'base/utils/random-number-generator.h',
],
'target_conditions': [
['OS=="android" and _toolset=="target"', {
'libraries': [
'-llog',
],
'include_dirs': [
'src/common/android/include',
],
}],
],
'conditions': [
['want_separate_host_toolset==1 or \
want_separate_host_toolset_mkpeephole==1', {
......@@ -1845,6 +1846,16 @@
}, {
'toolsets': ['target'],
}],
['component=="shared_library"', {
'defines': [
'BUILDING_V8_BASE_SHARED',
],
'direct_dependent_settings': {
'defines': [
'USING_V8_BASE_SHARED',
],
},
}],
['OS=="linux"', {
'link_settings': {
'libraries': [
......@@ -2405,7 +2416,12 @@
{
'target_name': 'mksnapshot',
'type': 'executable',
'dependencies': ['v8_base', 'v8_nosnapshot', 'v8_libplatform'],
'dependencies': [
'v8_base',
'v8_libbase',
'v8_nosnapshot',
'v8_libplatform'
],
'include_dirs+': [
'..',
'<(DEPTH)',
......
......@@ -324,6 +324,7 @@ v8_executable("cctest") {
deps = [
":resources",
"../..:v8_libbase",
"../..:v8_libplatform",
"../..:wasm_module_runner",
"../..:wasm_test_signatures",
......
......@@ -320,6 +320,7 @@
'type': 'executable',
'dependencies': [
'resources',
'../../src/v8.gyp:v8_libbase',
'../../src/v8.gyp:v8_libplatform',
],
'include_dirs': [
......
......@@ -386,6 +386,7 @@
'type': 'static_library',
'dependencies': [
'../../src/v8.gyp:v8',
'../../src/v8.gyp:v8_libbase',
'../../src/v8.gyp:v8_libplatform',
],
'include_dirs': [
......@@ -400,6 +401,7 @@
'target_name': 'fuzzer_support_nocomponent',
'type': 'static_library',
'dependencies': [
'../../src/v8.gyp:v8_libbase',
'../../src/v8.gyp:v8_libplatform',
],
'include_dirs': [
......
......@@ -159,6 +159,7 @@ v8_executable("unittests") {
#}],
deps = [
"../..:v8_libbase",
"../..:v8_libplatform",
"//build/config/sanitizers:deps",
"//build/win:default_exe_manifest",
......
......@@ -163,6 +163,7 @@
'dependencies': [
'../../testing/gmock.gyp:gmock',
'../../testing/gtest.gyp:gtest',
'../../src/v8.gyp:v8_libbase',
'../../src/v8.gyp:v8_libplatform',
],
'include_dirs': [
......
......@@ -37,6 +37,7 @@
'type': 'executable',
'dependencies': [
'../src/v8.gyp:v8',
'../src/v8.gyp:v8_libbase',
'../src/v8.gyp:v8_libplatform',
],
'conditions': [
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment