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 Review-Url: https://codereview.chromium.org/2396933002 Cr-Commit-Position: refs/heads/master@{#40009}
This commit is contained in:
parent
f5871336e2
commit
e75b9f6ed5
33
BUILD.gn
33
BUILD.gn
@ -130,17 +130,6 @@ config("libplatform_config") {
|
|||||||
include_dirs = [ "include" ]
|
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.
|
# This config should be applied to code using the libsampler.
|
||||||
config("libsampler_config") {
|
config("libsampler_config") {
|
||||||
include_dirs = [ "include" ]
|
include_dirs = [ "include" ]
|
||||||
@ -156,6 +145,10 @@ config("external_config") {
|
|||||||
if (v8_enable_inspector_override) {
|
if (v8_enable_inspector_override) {
|
||||||
include_dirs += [ "$target_gen_dir/include" ]
|
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
|
# This config should only be applied to code that needs to be explicitly
|
||||||
@ -2159,7 +2152,9 @@ v8_source_set("v8_base") {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
v8_component("v8_libbase") {
|
v8_source_set("v8_libbase") {
|
||||||
|
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
"src/base/adapters.h",
|
"src/base/adapters.h",
|
||||||
"src/base/atomic-utils.h",
|
"src/base/atomic-utils.h",
|
||||||
@ -2175,7 +2170,6 @@ v8_component("v8_libbase") {
|
|||||||
"src/base/atomicops_internals_x86_gcc.cc",
|
"src/base/atomicops_internals_x86_gcc.cc",
|
||||||
"src/base/atomicops_internals_x86_gcc.h",
|
"src/base/atomicops_internals_x86_gcc.h",
|
||||||
"src/base/atomicops_internals_x86_msvc.h",
|
"src/base/atomicops_internals_x86_msvc.h",
|
||||||
"src/base/base-export.h",
|
|
||||||
"src/base/bits.cc",
|
"src/base/bits.cc",
|
||||||
"src/base/bits.h",
|
"src/base/bits.h",
|
||||||
"src/base/build_config.h",
|
"src/base/build_config.h",
|
||||||
@ -2226,14 +2220,8 @@ v8_component("v8_libbase") {
|
|||||||
|
|
||||||
configs = [ ":internal_config_base" ]
|
configs = [ ":internal_config_base" ]
|
||||||
|
|
||||||
public_configs = [ ":libbase_config" ]
|
|
||||||
|
|
||||||
defines = []
|
defines = []
|
||||||
|
|
||||||
if (is_component_build) {
|
|
||||||
defines = [ "BUILDING_V8_BASE_SHARED" ]
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_posix) {
|
if (is_posix) {
|
||||||
sources += [ "src/base/platform/platform-posix.cc" ]
|
sources += [ "src/base/platform/platform-posix.cc" ]
|
||||||
}
|
}
|
||||||
@ -2377,7 +2365,6 @@ v8_source_set("fuzzer_support_nocomponent") {
|
|||||||
]
|
]
|
||||||
|
|
||||||
public_deps = [
|
public_deps = [
|
||||||
":v8_libbase",
|
|
||||||
":v8_libplatform",
|
":v8_libplatform",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -2406,7 +2393,6 @@ if (current_toolchain == v8_snapshot_toolchain) {
|
|||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":v8_base",
|
":v8_base",
|
||||||
":v8_libbase",
|
|
||||||
":v8_libplatform",
|
":v8_libplatform",
|
||||||
":v8_nosnapshot",
|
":v8_nosnapshot",
|
||||||
"//build/config/sanitizers:deps",
|
"//build/config/sanitizers:deps",
|
||||||
@ -2529,7 +2515,6 @@ v8_executable("d8") {
|
|||||||
deps = [
|
deps = [
|
||||||
":d8_js2c",
|
":d8_js2c",
|
||||||
":v8",
|
":v8",
|
||||||
":v8_libbase",
|
|
||||||
":v8_libplatform",
|
":v8_libplatform",
|
||||||
"//build/config/sanitizers:deps",
|
"//build/config/sanitizers:deps",
|
||||||
"//build/win:default_exe_manifest",
|
"//build/win:default_exe_manifest",
|
||||||
@ -2570,7 +2555,6 @@ v8_executable("v8_hello_world") {
|
|||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":v8",
|
":v8",
|
||||||
":v8_libbase",
|
|
||||||
":v8_libplatform",
|
":v8_libplatform",
|
||||||
"//build/config/sanitizers:deps",
|
"//build/config/sanitizers:deps",
|
||||||
"//build/win:default_exe_manifest",
|
"//build/win:default_exe_manifest",
|
||||||
@ -2595,7 +2579,6 @@ v8_executable("v8_sample_process") {
|
|||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":v8",
|
":v8",
|
||||||
":v8_libbase",
|
|
||||||
":v8_libplatform",
|
":v8_libplatform",
|
||||||
"//build/config/sanitizers:deps",
|
"//build/config/sanitizers:deps",
|
||||||
"//build/win:default_exe_manifest",
|
"//build/win:default_exe_manifest",
|
||||||
@ -2618,7 +2601,6 @@ v8_executable("v8_parser_shell") {
|
|||||||
]
|
]
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":v8_libbase",
|
|
||||||
":v8_libplatform",
|
":v8_libplatform",
|
||||||
"//build/config/sanitizers:deps",
|
"//build/config/sanitizers:deps",
|
||||||
"//build/win:default_exe_manifest",
|
"//build/win:default_exe_manifest",
|
||||||
@ -2662,7 +2644,6 @@ if (want_v8_shell) {
|
|||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":v8",
|
":v8",
|
||||||
":v8_libbase",
|
|
||||||
":v8_libplatform",
|
":v8_libplatform",
|
||||||
"//build/config/sanitizers:deps",
|
"//build/config/sanitizers:deps",
|
||||||
"//build/win:default_exe_manifest",
|
"//build/win:default_exe_manifest",
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
'type': 'executable',
|
'type': 'executable',
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
'../src/v8.gyp:v8',
|
'../src/v8.gyp:v8',
|
||||||
'../src/v8.gyp:v8_libbase',
|
|
||||||
'../src/v8.gyp:v8_libplatform',
|
'../src/v8.gyp:v8_libplatform',
|
||||||
],
|
],
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
|
@ -7,8 +7,6 @@
|
|||||||
#ifndef V8_BASE_ATOMICOPS_INTERNALS_X86_GCC_H_
|
#ifndef V8_BASE_ATOMICOPS_INTERNALS_X86_GCC_H_
|
||||||
#define V8_BASE_ATOMICOPS_INTERNALS_X86_GCC_H_
|
#define V8_BASE_ATOMICOPS_INTERNALS_X86_GCC_H_
|
||||||
|
|
||||||
#include "src/base/base-export.h"
|
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
namespace base {
|
namespace base {
|
||||||
|
|
||||||
@ -23,8 +21,7 @@ struct AtomicOps_x86CPUFeatureStruct {
|
|||||||
bool has_sse2; // Processor has SSE2.
|
bool has_sse2; // Processor has SSE2.
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
V8_BASE_EXPORT extern struct AtomicOps_x86CPUFeatureStruct
|
extern struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures;
|
||||||
AtomicOps_Internalx86CPUFeatures;
|
|
||||||
|
|
||||||
#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory")
|
#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory")
|
||||||
|
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
// 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,8 +6,6 @@
|
|||||||
#define V8_BASE_BITS_H_
|
#define V8_BASE_BITS_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "src/base/base-export.h"
|
|
||||||
#include "src/base/macros.h"
|
#include "src/base/macros.h"
|
||||||
#if V8_CC_MSVC
|
#if V8_CC_MSVC
|
||||||
#include <intrin.h>
|
#include <intrin.h>
|
||||||
@ -174,7 +172,8 @@ inline bool IsPowerOfTwo64(uint64_t value) {
|
|||||||
// power of two, it is returned as is. |value| must be less than or equal to
|
// 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,
|
// 0x80000000u. Implementation is from "Hacker's Delight" by Henry S. Warren,
|
||||||
// Jr., figure 3-3, page 48, where the function is called clp2.
|
// Jr., figure 3-3, page 48, where the function is called clp2.
|
||||||
V8_BASE_EXPORT uint32_t RoundUpToPowerOfTwo32(uint32_t value);
|
uint32_t RoundUpToPowerOfTwo32(uint32_t value);
|
||||||
|
|
||||||
|
|
||||||
// RoundDownToPowerOfTwo32(value) returns the greatest power of two which is
|
// 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
|
// less than or equal to |value|. If you pass in a |value| that is already a
|
||||||
@ -242,7 +241,7 @@ inline bool SignedSubOverflow32(int32_t lhs, int32_t rhs, int32_t* val) {
|
|||||||
// SignedMulOverflow32(lhs,rhs,val) performs a signed multiplication of |lhs|
|
// SignedMulOverflow32(lhs,rhs,val) performs a signed multiplication of |lhs|
|
||||||
// and |rhs| and stores the result into the variable pointed to by |val| and
|
// and |rhs| and stores the result into the variable pointed to by |val| and
|
||||||
// returns true if the signed multiplication resulted in an overflow.
|
// returns true if the signed multiplication resulted in an overflow.
|
||||||
V8_BASE_EXPORT bool SignedMulOverflow32(int32_t lhs, int32_t rhs, int32_t* val);
|
bool SignedMulOverflow32(int32_t lhs, int32_t rhs, int32_t* val);
|
||||||
|
|
||||||
// SignedAddOverflow64(lhs,rhs,val) performs a signed summation of |lhs| and
|
// SignedAddOverflow64(lhs,rhs,val) performs a signed summation of |lhs| and
|
||||||
// |rhs| and stores the result into the variable pointed to by |val| and
|
// |rhs| and stores the result into the variable pointed to by |val| and
|
||||||
@ -266,28 +265,31 @@ inline bool SignedSubOverflow64(int64_t lhs, int64_t rhs, int64_t* val) {
|
|||||||
// SignedMulOverflow64(lhs,rhs,val) performs a signed multiplication of |lhs|
|
// SignedMulOverflow64(lhs,rhs,val) performs a signed multiplication of |lhs|
|
||||||
// and |rhs| and stores the result into the variable pointed to by |val| and
|
// and |rhs| and stores the result into the variable pointed to by |val| and
|
||||||
// returns true if the signed multiplication resulted in an overflow.
|
// returns true if the signed multiplication resulted in an overflow.
|
||||||
V8_BASE_EXPORT bool SignedMulOverflow64(int64_t lhs, int64_t rhs, int64_t* val);
|
bool SignedMulOverflow64(int64_t lhs, int64_t rhs, int64_t* val);
|
||||||
|
|
||||||
// SignedMulHigh32(lhs, rhs) multiplies two signed 32-bit values |lhs| and
|
// SignedMulHigh32(lhs, rhs) multiplies two signed 32-bit values |lhs| and
|
||||||
// |rhs|, extracts the most significant 32 bits of the result, and returns
|
// |rhs|, extracts the most significant 32 bits of the result, and returns
|
||||||
// those.
|
// those.
|
||||||
V8_BASE_EXPORT int32_t SignedMulHigh32(int32_t lhs, int32_t rhs);
|
int32_t SignedMulHigh32(int32_t lhs, int32_t rhs);
|
||||||
|
|
||||||
|
|
||||||
// SignedMulHighAndAdd32(lhs, rhs, acc) multiplies two signed 32-bit values
|
// SignedMulHighAndAdd32(lhs, rhs, acc) multiplies two signed 32-bit values
|
||||||
// |lhs| and |rhs|, extracts the most significant 32 bits of the result, and
|
// |lhs| and |rhs|, extracts the most significant 32 bits of the result, and
|
||||||
// adds the accumulate value |acc|.
|
// adds the accumulate value |acc|.
|
||||||
V8_BASE_EXPORT int32_t SignedMulHighAndAdd32(int32_t lhs, int32_t rhs,
|
int32_t SignedMulHighAndAdd32(int32_t lhs, int32_t rhs, int32_t acc);
|
||||||
int32_t acc);
|
|
||||||
|
|
||||||
// SignedDiv32(lhs, rhs) divides |lhs| by |rhs| and returns the quotient
|
// SignedDiv32(lhs, rhs) divides |lhs| by |rhs| and returns the quotient
|
||||||
// truncated to int32. If |rhs| is zero, then zero is returned. If |lhs|
|
// truncated to int32. If |rhs| is zero, then zero is returned. If |lhs|
|
||||||
// is minint and |rhs| is -1, it returns minint.
|
// is minint and |rhs| is -1, it returns minint.
|
||||||
V8_BASE_EXPORT int32_t SignedDiv32(int32_t lhs, int32_t rhs);
|
int32_t SignedDiv32(int32_t lhs, int32_t rhs);
|
||||||
|
|
||||||
|
|
||||||
// SignedMod32(lhs, rhs) divides |lhs| by |rhs| and returns the remainder
|
// 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|
|
// truncated to int32. If either |rhs| is zero or |lhs| is minint and |rhs|
|
||||||
// is -1, it returns zero.
|
// is -1, it returns zero.
|
||||||
V8_BASE_EXPORT int32_t SignedMod32(int32_t lhs, int32_t rhs);
|
int32_t SignedMod32(int32_t lhs, int32_t rhs);
|
||||||
|
|
||||||
|
|
||||||
// UnsignedAddOverflow32(lhs,rhs,val) performs an unsigned summation of |lhs|
|
// UnsignedAddOverflow32(lhs,rhs,val) performs an unsigned summation of |lhs|
|
||||||
// and |rhs| and stores the result into the variable pointed to by |val| and
|
// and |rhs| and stores the result into the variable pointed to by |val| and
|
||||||
@ -317,16 +319,18 @@ inline uint32_t UnsignedMod32(uint32_t lhs, uint32_t rhs) {
|
|||||||
|
|
||||||
|
|
||||||
// Clamp |value| on overflow and underflow conditions.
|
// Clamp |value| on overflow and underflow conditions.
|
||||||
V8_BASE_EXPORT int64_t
|
int64_t FromCheckedNumeric(const internal::CheckedNumeric<int64_t> value);
|
||||||
FromCheckedNumeric(const internal::CheckedNumeric<int64_t> value);
|
|
||||||
|
|
||||||
// SignedSaturatedAdd64(lhs, rhs) adds |lhs| and |rhs|,
|
// SignedSaturatedAdd64(lhs, rhs) adds |lhs| and |rhs|,
|
||||||
// checks and returns the result.
|
// checks and returns the result.
|
||||||
V8_BASE_EXPORT int64_t SignedSaturatedAdd64(int64_t lhs, int64_t rhs);
|
int64_t SignedSaturatedAdd64(int64_t lhs, int64_t rhs);
|
||||||
|
|
||||||
|
|
||||||
// SignedSaturatedSub64(lhs, rhs) substracts |lhs| by |rhs|,
|
// SignedSaturatedSub64(lhs, rhs) substracts |lhs| by |rhs|,
|
||||||
// checks and returns the result.
|
// checks and returns the result.
|
||||||
V8_BASE_EXPORT int64_t SignedSaturatedSub64(int64_t lhs, int64_t rhs);
|
int64_t SignedSaturatedSub64(int64_t lhs, int64_t rhs);
|
||||||
|
|
||||||
|
|
||||||
} // namespace bits
|
} // namespace bits
|
||||||
} // namespace base
|
} // namespace base
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#ifndef V8_BASE_CPU_H_
|
#ifndef V8_BASE_CPU_H_
|
||||||
#define V8_BASE_CPU_H_
|
#define V8_BASE_CPU_H_
|
||||||
|
|
||||||
#include "src/base/base-export.h"
|
|
||||||
#include "src/base/macros.h"
|
#include "src/base/macros.h"
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
@ -29,7 +28,7 @@ namespace base {
|
|||||||
// architectures. For each architecture the file cpu_<arch>.cc contains the
|
// architectures. For each architecture the file cpu_<arch>.cc contains the
|
||||||
// implementation of these static functions.
|
// implementation of these static functions.
|
||||||
|
|
||||||
class V8_BASE_EXPORT CPU final {
|
class CPU final {
|
||||||
public:
|
public:
|
||||||
CPU();
|
CPU();
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "src/base/base-export.h"
|
|
||||||
#include "src/base/build_config.h"
|
#include "src/base/build_config.h"
|
||||||
|
|
||||||
#if V8_OS_POSIX
|
#if V8_OS_POSIX
|
||||||
@ -32,8 +31,8 @@ namespace debug {
|
|||||||
// Enables stack dump to console output on exception and signals.
|
// Enables stack dump to console output on exception and signals.
|
||||||
// When enabled, the process will quit immediately. This is meant to be used in
|
// When enabled, the process will quit immediately. This is meant to be used in
|
||||||
// tests only!
|
// tests only!
|
||||||
V8_BASE_EXPORT bool EnableInProcessStackDumping();
|
bool EnableInProcessStackDumping();
|
||||||
V8_BASE_EXPORT void DisableSignalStackDump();
|
void DisableSignalStackDump();
|
||||||
|
|
||||||
// A stacktrace can be helpful in debugging. For example, you can include a
|
// 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
|
// stacktrace member in a object (probably around #ifndef NDEBUG) so that you
|
||||||
|
@ -12,6 +12,13 @@
|
|||||||
namespace v8 {
|
namespace v8 {
|
||||||
namespace base {
|
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>
|
template <class T>
|
||||||
MagicNumbersForDivision<T> SignedDivisionByConstant(T d) {
|
MagicNumbersForDivision<T> SignedDivisionByConstant(T d) {
|
||||||
STATIC_ASSERT(static_cast<T>(0) < static_cast<T>(-1));
|
STATIC_ASSERT(static_cast<T>(0) < static_cast<T>(-1));
|
||||||
@ -93,6 +100,9 @@ MagicNumbersForDivision<T> UnsignedDivisionByConstant(T d,
|
|||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Instantiations.
|
// Instantiations.
|
||||||
|
|
||||||
|
template struct MagicNumbersForDivision<uint32_t>;
|
||||||
|
template struct MagicNumbersForDivision<uint64_t>;
|
||||||
|
|
||||||
template MagicNumbersForDivision<uint32_t> SignedDivisionByConstant(uint32_t d);
|
template MagicNumbersForDivision<uint32_t> SignedDivisionByConstant(uint32_t d);
|
||||||
template MagicNumbersForDivision<uint64_t> SignedDivisionByConstant(uint64_t d);
|
template MagicNumbersForDivision<uint64_t> SignedDivisionByConstant(uint64_t d);
|
||||||
|
|
||||||
|
@ -5,10 +5,6 @@
|
|||||||
#ifndef V8_BASE_DIVISION_BY_CONSTANT_H_
|
#ifndef V8_BASE_DIVISION_BY_CONSTANT_H_
|
||||||
#define 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 v8 {
|
||||||
namespace base {
|
namespace base {
|
||||||
|
|
||||||
@ -18,12 +14,10 @@ namespace base {
|
|||||||
// Delight", chapter 10. The template parameter must be one of the unsigned
|
// Delight", chapter 10. The template parameter must be one of the unsigned
|
||||||
// integral types.
|
// integral types.
|
||||||
template <class T>
|
template <class T>
|
||||||
struct V8_BASE_EXPORT MagicNumbersForDivision {
|
struct MagicNumbersForDivision {
|
||||||
MagicNumbersForDivision(T m, unsigned s, bool a)
|
MagicNumbersForDivision(T m, unsigned s, bool a)
|
||||||
: multiplier(m), shift(s), add(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;
|
T multiplier;
|
||||||
unsigned shift;
|
unsigned shift;
|
||||||
@ -34,29 +28,17 @@ struct V8_BASE_EXPORT MagicNumbersForDivision {
|
|||||||
// Calculate the multiplier and shift for signed division via multiplication.
|
// 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.
|
// The divisor must not be -1, 0 or 1 when interpreted as a signed value.
|
||||||
template <class T>
|
template <class T>
|
||||||
V8_BASE_EXPORT MagicNumbersForDivision<T> SignedDivisionByConstant(T d);
|
MagicNumbersForDivision<T> SignedDivisionByConstant(T d);
|
||||||
|
|
||||||
|
|
||||||
// Calculate the multiplier and shift for unsigned division via multiplication,
|
// 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
|
// 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
|
// 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.
|
// upper bits of the dividend value are known to be zero.
|
||||||
template <class T>
|
template <class T>
|
||||||
V8_BASE_EXPORT MagicNumbersForDivision<T> UnsignedDivisionByConstant(
|
MagicNumbersForDivision<T> UnsignedDivisionByConstant(
|
||||||
T d, unsigned leading_zeros = 0);
|
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 base
|
||||||
} // namespace v8
|
} // namespace v8
|
||||||
|
|
||||||
|
@ -10,13 +10,13 @@
|
|||||||
#include "src/base/platform/platform.h"
|
#include "src/base/platform/platform.h"
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
namespace base {
|
namespace internal {
|
||||||
|
|
||||||
char* RelativePath(char** buffer, const char* exec_path, const char* name) {
|
char* RelativePath(char** buffer, const char* exec_path, const char* name) {
|
||||||
DCHECK(exec_path);
|
DCHECK(exec_path);
|
||||||
int path_separator = static_cast<int>(strlen(exec_path)) - 1;
|
int path_separator = static_cast<int>(strlen(exec_path)) - 1;
|
||||||
while (path_separator >= 0 &&
|
while (path_separator >= 0 &&
|
||||||
!OS::isDirectorySeparator(exec_path[path_separator])) {
|
!base::OS::isDirectorySeparator(exec_path[path_separator])) {
|
||||||
path_separator--;
|
path_separator--;
|
||||||
}
|
}
|
||||||
if (path_separator >= 0) {
|
if (path_separator >= 0) {
|
||||||
@ -32,5 +32,5 @@ char* RelativePath(char** buffer, const char* exec_path, const char* name) {
|
|||||||
return *buffer;
|
return *buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace base
|
} // namespace internal
|
||||||
} // namespace v8
|
} // namespace v8
|
||||||
|
@ -2,20 +2,17 @@
|
|||||||
// Use of this source code is governed by a BSD-style license that can be
|
// Use of this source code is governed by a BSD-style license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
#ifndef V8_BASE_FILE_UTILS_H_
|
#ifndef V8_FILE_UTILS_H_
|
||||||
#define V8_BASE_FILE_UTILS_H_
|
#define V8_FILE_UTILS_H_
|
||||||
|
|
||||||
#include "src/base/base-export.h"
|
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
namespace base {
|
namespace internal {
|
||||||
|
|
||||||
// Helper functions to manipulate file paths.
|
// Helper functions to manipulate file paths.
|
||||||
|
|
||||||
V8_BASE_EXPORT char* RelativePath(char** buffer, const char* exec_path,
|
char* RelativePath(char** buffer, const char* exec_path, const char* name);
|
||||||
const char* name);
|
|
||||||
|
|
||||||
} // namespace base
|
} // namespace internal
|
||||||
} // namespace v8
|
} // namespace v8
|
||||||
|
|
||||||
#endif // V8_FILE_UTILS_H_
|
#endif // V8_FILE_UTILS_H_
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "src/base/base-export.h"
|
|
||||||
#include "src/base/macros.h"
|
#include "src/base/macros.h"
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
@ -68,7 +67,7 @@ struct hash;
|
|||||||
|
|
||||||
V8_INLINE size_t hash_combine() { return 0u; }
|
V8_INLINE size_t hash_combine() { return 0u; }
|
||||||
V8_INLINE size_t hash_combine(size_t seed) { return seed; }
|
V8_INLINE size_t hash_combine(size_t seed) { return seed; }
|
||||||
V8_BASE_EXPORT size_t hash_combine(size_t seed, size_t value);
|
size_t hash_combine(size_t seed, size_t value);
|
||||||
template <typename T, typename... Ts>
|
template <typename T, typename... Ts>
|
||||||
V8_INLINE size_t hash_combine(T const& v, Ts const&... vs) {
|
V8_INLINE size_t hash_combine(T const& v, Ts const&... vs) {
|
||||||
return hash_combine(hash_combine(vs...), hash<T>()(v));
|
return hash_combine(hash_combine(vs...), hash<T>()(v));
|
||||||
@ -92,9 +91,9 @@ V8_BASE_HASH_VALUE_TRIVIAL(unsigned char)
|
|||||||
V8_BASE_HASH_VALUE_TRIVIAL(unsigned short) // NOLINT(runtime/int)
|
V8_BASE_HASH_VALUE_TRIVIAL(unsigned short) // NOLINT(runtime/int)
|
||||||
#undef V8_BASE_HASH_VALUE_TRIVIAL
|
#undef V8_BASE_HASH_VALUE_TRIVIAL
|
||||||
|
|
||||||
V8_BASE_EXPORT size_t hash_value(unsigned int);
|
size_t hash_value(unsigned int);
|
||||||
V8_BASE_EXPORT size_t hash_value(unsigned long); // NOLINT(runtime/int)
|
size_t hash_value(unsigned long); // NOLINT(runtime/int)
|
||||||
V8_BASE_EXPORT size_t hash_value(unsigned long long); // NOLINT(runtime/int)
|
size_t hash_value(unsigned long long); // NOLINT(runtime/int)
|
||||||
|
|
||||||
#define V8_BASE_HASH_VALUE_SIGNED(type) \
|
#define V8_BASE_HASH_VALUE_SIGNED(type) \
|
||||||
V8_INLINE size_t hash_value(signed type v) { \
|
V8_INLINE size_t hash_value(signed type v) { \
|
||||||
|
@ -5,75 +5,73 @@
|
|||||||
#ifndef V8_BASE_IEEE754_H_
|
#ifndef V8_BASE_IEEE754_H_
|
||||||
#define V8_BASE_IEEE754_H_
|
#define V8_BASE_IEEE754_H_
|
||||||
|
|
||||||
#include "src/base/base-export.h"
|
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
namespace base {
|
namespace base {
|
||||||
namespace ieee754 {
|
namespace ieee754 {
|
||||||
|
|
||||||
// Returns the arc cosine of |x|; that is the value whose cosine is |x|.
|
// Returns the arc cosine of |x|; that is the value whose cosine is |x|.
|
||||||
V8_BASE_EXPORT double acos(double x);
|
double acos(double x);
|
||||||
|
|
||||||
// Returns the inverse hyperbolic cosine of |x|; that is the value whose
|
// Returns the inverse hyperbolic cosine of |x|; that is the value whose
|
||||||
// hyperbolic cosine is |x|.
|
// hyperbolic cosine is |x|.
|
||||||
V8_BASE_EXPORT double acosh(double x);
|
double acosh(double x);
|
||||||
|
|
||||||
// Returns the arc sine of |x|; that is the value whose sine is |x|.
|
// Returns the arc sine of |x|; that is the value whose sine is |x|.
|
||||||
V8_BASE_EXPORT double asin(double x);
|
double asin(double x);
|
||||||
|
|
||||||
// Returns the inverse hyperbolic sine of |x|; that is the value whose
|
// Returns the inverse hyperbolic sine of |x|; that is the value whose
|
||||||
// hyperbolic sine is |x|.
|
// hyperbolic sine is |x|.
|
||||||
V8_BASE_EXPORT double asinh(double x);
|
double asinh(double x);
|
||||||
|
|
||||||
// Returns the principal value of the arc tangent of |x|; that is the value
|
// Returns the principal value of the arc tangent of |x|; that is the value
|
||||||
// whose tangent is |x|.
|
// whose tangent is |x|.
|
||||||
V8_BASE_EXPORT double atan(double x);
|
double atan(double x);
|
||||||
|
|
||||||
// Returns the principal value of the arc tangent of |y/x|, using the signs of
|
// 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.
|
// the two arguments to determine the quadrant of the result.
|
||||||
V8_BASE_EXPORT double atan2(double y, double x);
|
double atan2(double y, double x);
|
||||||
|
|
||||||
// Returns the cosine of |x|, where |x| is given in radians.
|
// Returns the cosine of |x|, where |x| is given in radians.
|
||||||
V8_BASE_EXPORT double cos(double x);
|
double cos(double x);
|
||||||
|
|
||||||
// Returns the base-e exponential of |x|.
|
// Returns the base-e exponential of |x|.
|
||||||
V8_BASE_EXPORT double exp(double x);
|
double exp(double x);
|
||||||
|
|
||||||
V8_BASE_EXPORT double atanh(double x);
|
double atanh(double x);
|
||||||
|
|
||||||
// Returns the natural logarithm of |x|.
|
// Returns the natural logarithm of |x|.
|
||||||
V8_BASE_EXPORT double log(double x);
|
double log(double x);
|
||||||
|
|
||||||
// Returns a value equivalent to |log(1+x)|, but computed in a way that is
|
// 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.
|
// accurate even if the value of |x| is near zero.
|
||||||
V8_BASE_EXPORT double log1p(double x);
|
double log1p(double x);
|
||||||
|
|
||||||
// Returns the base 2 logarithm of |x|.
|
// Returns the base 2 logarithm of |x|.
|
||||||
V8_BASE_EXPORT double log2(double x);
|
double log2(double x);
|
||||||
|
|
||||||
// Returns the base 10 logarithm of |x|.
|
// Returns the base 10 logarithm of |x|.
|
||||||
V8_BASE_EXPORT double log10(double x);
|
double log10(double x);
|
||||||
|
|
||||||
// Returns the cube root of |x|.
|
// Returns the cube root of |x|.
|
||||||
V8_BASE_EXPORT double cbrt(double x);
|
double cbrt(double x);
|
||||||
|
|
||||||
// Returns exp(x)-1, the exponential of |x| minus 1.
|
// Returns exp(x)-1, the exponential of |x| minus 1.
|
||||||
V8_BASE_EXPORT double expm1(double x);
|
double expm1(double x);
|
||||||
|
|
||||||
// Returns the sine of |x|, where |x| is given in radians.
|
// Returns the sine of |x|, where |x| is given in radians.
|
||||||
V8_BASE_EXPORT double sin(double x);
|
double sin(double x);
|
||||||
|
|
||||||
// Returns the tangent of |x|, where |x| is given in radians.
|
// Returns the tangent of |x|, where |x| is given in radians.
|
||||||
V8_BASE_EXPORT double tan(double x);
|
double tan(double x);
|
||||||
|
|
||||||
// Returns the hyperbolic cosine of |x|, where |x| is given radians.
|
// Returns the hyperbolic cosine of |x|, where |x| is given radians.
|
||||||
V8_BASE_EXPORT double cosh(double x);
|
double cosh(double x);
|
||||||
|
|
||||||
// Returns the hyperbolic sine of |x|, where |x| is given radians.
|
// Returns the hyperbolic sine of |x|, where |x| is given radians.
|
||||||
V8_BASE_EXPORT double sinh(double x);
|
double sinh(double x);
|
||||||
|
|
||||||
// Returns the hyperbolic tangent of |x|, where |x| is given radians.
|
// Returns the hyperbolic tangent of |x|, where |x| is given radians.
|
||||||
V8_BASE_EXPORT double tanh(double x);
|
double tanh(double x);
|
||||||
|
|
||||||
} // namespace ieee754
|
} // namespace ieee754
|
||||||
} // namespace base
|
} // namespace base
|
||||||
|
@ -9,11 +9,10 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "src/base/base-export.h"
|
|
||||||
#include "src/base/build_config.h"
|
#include "src/base/build_config.h"
|
||||||
#include "src/base/compiler-specific.h"
|
#include "src/base/compiler-specific.h"
|
||||||
|
|
||||||
extern "C" PRINTF_FORMAT(3, 4) V8_NORETURN V8_BASE_EXPORT
|
extern "C" PRINTF_FORMAT(3, 4) V8_NORETURN
|
||||||
void V8_Fatal(const char* file, int line, const char* format, ...);
|
void V8_Fatal(const char* file, int line, const char* format, ...);
|
||||||
|
|
||||||
// The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during
|
// The FATAL, UNREACHABLE and UNIMPLEMENTED macros are useful during
|
||||||
@ -89,7 +88,7 @@ std::string* MakeCheckOpString(Lhs const& lhs, Rhs const& rhs,
|
|||||||
// Commonly used instantiations of MakeCheckOpString<>. Explicitly instantiated
|
// Commonly used instantiations of MakeCheckOpString<>. Explicitly instantiated
|
||||||
// in logging.cc.
|
// in logging.cc.
|
||||||
#define DEFINE_MAKE_CHECK_OP_STRING(type) \
|
#define DEFINE_MAKE_CHECK_OP_STRING(type) \
|
||||||
extern template V8_BASE_EXPORT std::string* MakeCheckOpString<type, type>( \
|
extern template std::string* MakeCheckOpString<type, type>( \
|
||||||
type const&, type const&, char const*);
|
type const&, type const&, char const*);
|
||||||
DEFINE_MAKE_CHECK_OP_STRING(int)
|
DEFINE_MAKE_CHECK_OP_STRING(int)
|
||||||
DEFINE_MAKE_CHECK_OP_STRING(long) // NOLINT(runtime/int)
|
DEFINE_MAKE_CHECK_OP_STRING(long) // NOLINT(runtime/int)
|
||||||
@ -118,11 +117,10 @@ DEFINE_MAKE_CHECK_OP_STRING(void const*)
|
|||||||
char const* msg) { \
|
char const* msg) { \
|
||||||
return V8_LIKELY(lhs op rhs) ? nullptr : MakeCheckOpString(lhs, rhs, msg); \
|
return V8_LIKELY(lhs op rhs) ? nullptr : MakeCheckOpString(lhs, rhs, msg); \
|
||||||
} \
|
} \
|
||||||
extern template V8_BASE_EXPORT std::string* Check##NAME##Impl<float, float>( \
|
extern template std::string* Check##NAME##Impl<float, float>( \
|
||||||
float const& lhs, float const& rhs, char const* msg); \
|
float const& lhs, float const& rhs, char const* msg); \
|
||||||
extern template V8_BASE_EXPORT std::string* \
|
extern template std::string* Check##NAME##Impl<double, double>( \
|
||||||
Check##NAME##Impl<double, double>(double const& lhs, double const& rhs, \
|
double const& lhs, double const& rhs, char const* msg);
|
||||||
char const* msg);
|
|
||||||
DEFINE_CHECK_OP_IMPL(EQ, ==)
|
DEFINE_CHECK_OP_IMPL(EQ, ==)
|
||||||
DEFINE_CHECK_OP_IMPL(NE, !=)
|
DEFINE_CHECK_OP_IMPL(NE, !=)
|
||||||
DEFINE_CHECK_OP_IMPL(LE, <=)
|
DEFINE_CHECK_OP_IMPL(LE, <=)
|
||||||
|
@ -55,7 +55,6 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "src/base/atomicops.h"
|
#include "src/base/atomicops.h"
|
||||||
#include "src/base/base-export.h"
|
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
namespace base {
|
namespace base {
|
||||||
@ -80,8 +79,7 @@ struct OneArgFunction {
|
|||||||
typedef void (*type)(T);
|
typedef void (*type)(T);
|
||||||
};
|
};
|
||||||
|
|
||||||
V8_BASE_EXPORT void CallOnceImpl(OnceType* once, PointerArgFunction init_func,
|
void CallOnceImpl(OnceType* once, PointerArgFunction init_func, void* arg);
|
||||||
void* arg);
|
|
||||||
|
|
||||||
inline void CallOnce(OnceType* once, NoArgFunction init_func) {
|
inline void CallOnce(OnceType* once, NoArgFunction init_func) {
|
||||||
if (Acquire_Load(once) != ONCE_STATE_DONE) {
|
if (Acquire_Load(once) != ONCE_STATE_DONE) {
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#ifndef V8_BASE_PLATFORM_CONDITION_VARIABLE_H_
|
#ifndef V8_BASE_PLATFORM_CONDITION_VARIABLE_H_
|
||||||
#define 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/lazy-instance.h"
|
||||||
#include "src/base/platform/mutex.h"
|
#include "src/base/platform/mutex.h"
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ class TimeDelta;
|
|||||||
// the mutex and suspend the execution of the calling thread. When the condition
|
// 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.
|
// variable is notified, the thread is awakened, and the mutex is reacquired.
|
||||||
|
|
||||||
class V8_BASE_EXPORT ConditionVariable final {
|
class ConditionVariable final {
|
||||||
public:
|
public:
|
||||||
ConditionVariable();
|
ConditionVariable();
|
||||||
~ConditionVariable();
|
~ConditionVariable();
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#ifndef V8_BASE_PLATFORM_MUTEX_H_
|
#ifndef V8_BASE_PLATFORM_MUTEX_H_
|
||||||
#define V8_BASE_PLATFORM_MUTEX_H_
|
#define V8_BASE_PLATFORM_MUTEX_H_
|
||||||
|
|
||||||
#include "src/base/base-export.h"
|
|
||||||
#include "src/base/lazy-instance.h"
|
#include "src/base/lazy-instance.h"
|
||||||
#if V8_OS_WIN
|
#if V8_OS_WIN
|
||||||
#include "src/base/win32-headers.h"
|
#include "src/base/win32-headers.h"
|
||||||
@ -34,7 +33,7 @@ namespace base {
|
|||||||
// |TryLock()|. The behavior of a program is undefined if a mutex is destroyed
|
// |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.
|
// while still owned by some thread. The Mutex class is non-copyable.
|
||||||
|
|
||||||
class V8_BASE_EXPORT Mutex final {
|
class Mutex final {
|
||||||
public:
|
public:
|
||||||
Mutex();
|
Mutex();
|
||||||
~Mutex();
|
~Mutex();
|
||||||
@ -128,7 +127,7 @@ typedef LazyStaticInstance<Mutex, DefaultConstructTrait<Mutex>,
|
|||||||
// The behavior of a program is undefined if a recursive mutex is destroyed
|
// 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.
|
// while still owned by some thread. The RecursiveMutex class is non-copyable.
|
||||||
|
|
||||||
class V8_BASE_EXPORT RecursiveMutex final {
|
class RecursiveMutex final {
|
||||||
public:
|
public:
|
||||||
RecursiveMutex();
|
RecursiveMutex();
|
||||||
~RecursiveMutex();
|
~RecursiveMutex();
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "src/base/base-export.h"
|
|
||||||
#include "src/base/build_config.h"
|
#include "src/base/build_config.h"
|
||||||
#include "src/base/compiler-specific.h"
|
#include "src/base/compiler-specific.h"
|
||||||
#include "src/base/platform/mutex.h"
|
#include "src/base/platform/mutex.h"
|
||||||
@ -70,7 +69,7 @@ inline intptr_t InternalGetExistingThreadLocal(intptr_t index) {
|
|||||||
|
|
||||||
#define V8_FAST_TLS_SUPPORTED 1
|
#define V8_FAST_TLS_SUPPORTED 1
|
||||||
|
|
||||||
extern V8_BASE_EXPORT intptr_t kMacTlsBaseOffset;
|
extern intptr_t kMacTlsBaseOffset;
|
||||||
|
|
||||||
INLINE(intptr_t InternalGetExistingThreadLocal(intptr_t index));
|
INLINE(intptr_t InternalGetExistingThreadLocal(intptr_t index));
|
||||||
|
|
||||||
@ -103,7 +102,7 @@ class TimezoneCache;
|
|||||||
// functions. Add methods here to cope with differences between the
|
// functions. Add methods here to cope with differences between the
|
||||||
// supported platforms.
|
// supported platforms.
|
||||||
|
|
||||||
class V8_BASE_EXPORT OS {
|
class OS {
|
||||||
public:
|
public:
|
||||||
// Initialize the OS class.
|
// Initialize the OS class.
|
||||||
// - random_seed: Used for the GetRandomMmapAddress() if non-zero.
|
// - random_seed: Used for the GetRandomMmapAddress() if non-zero.
|
||||||
@ -212,7 +211,7 @@ class V8_BASE_EXPORT OS {
|
|||||||
char text[kStackWalkMaxTextLen];
|
char text[kStackWalkMaxTextLen];
|
||||||
};
|
};
|
||||||
|
|
||||||
class V8_BASE_EXPORT MemoryMappedFile {
|
class MemoryMappedFile {
|
||||||
public:
|
public:
|
||||||
virtual ~MemoryMappedFile() {}
|
virtual ~MemoryMappedFile() {}
|
||||||
virtual void* memory() const = 0;
|
virtual void* memory() const = 0;
|
||||||
@ -287,7 +286,7 @@ class V8_BASE_EXPORT OS {
|
|||||||
// Control of the reserved memory can be assigned to another VirtualMemory
|
// Control of the reserved memory can be assigned to another VirtualMemory
|
||||||
// object by assignment or copy-contructing. This removes the reserved memory
|
// object by assignment or copy-contructing. This removes the reserved memory
|
||||||
// from the original object.
|
// from the original object.
|
||||||
class V8_BASE_EXPORT VirtualMemory {
|
class VirtualMemory {
|
||||||
public:
|
public:
|
||||||
// Empty VirtualMemory object, controlling no reserved memory.
|
// Empty VirtualMemory object, controlling no reserved memory.
|
||||||
VirtualMemory();
|
VirtualMemory();
|
||||||
@ -419,7 +418,7 @@ class V8_BASE_EXPORT VirtualMemory {
|
|||||||
// thread. The Thread object should not be deallocated before the thread has
|
// thread. The Thread object should not be deallocated before the thread has
|
||||||
// terminated.
|
// terminated.
|
||||||
|
|
||||||
class V8_BASE_EXPORT Thread {
|
class Thread {
|
||||||
public:
|
public:
|
||||||
// Opaque data type for thread-local storage keys.
|
// Opaque data type for thread-local storage keys.
|
||||||
typedef int32_t LocalStorageKey;
|
typedef int32_t LocalStorageKey;
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#ifndef V8_BASE_PLATFORM_SEMAPHORE_H_
|
#ifndef V8_BASE_PLATFORM_SEMAPHORE_H_
|
||||||
#define V8_BASE_PLATFORM_SEMAPHORE_H_
|
#define V8_BASE_PLATFORM_SEMAPHORE_H_
|
||||||
|
|
||||||
#include "src/base/base-export.h"
|
|
||||||
#include "src/base/lazy-instance.h"
|
#include "src/base/lazy-instance.h"
|
||||||
#if V8_OS_WIN
|
#if V8_OS_WIN
|
||||||
#include "src/base/win32-headers.h"
|
#include "src/base/win32-headers.h"
|
||||||
@ -32,7 +31,7 @@ class TimeDelta;
|
|||||||
// count reaches zero, threads waiting for the semaphore blocks until the
|
// count reaches zero, threads waiting for the semaphore blocks until the
|
||||||
// count becomes non-zero.
|
// count becomes non-zero.
|
||||||
|
|
||||||
class V8_BASE_EXPORT Semaphore final {
|
class Semaphore final {
|
||||||
public:
|
public:
|
||||||
explicit Semaphore(int count);
|
explicit Semaphore(int count);
|
||||||
~Semaphore();
|
~Semaphore();
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#include "src/base/base-export.h"
|
|
||||||
#include "src/base/bits.h"
|
#include "src/base/bits.h"
|
||||||
#include "src/base/macros.h"
|
#include "src/base/macros.h"
|
||||||
#include "src/base/safe_math.h"
|
#include "src/base/safe_math.h"
|
||||||
@ -43,7 +42,7 @@ class TimeBase;
|
|||||||
// This class represents a duration of time, internally represented in
|
// This class represents a duration of time, internally represented in
|
||||||
// microseonds.
|
// microseonds.
|
||||||
|
|
||||||
class V8_BASE_EXPORT TimeDelta final {
|
class TimeDelta final {
|
||||||
public:
|
public:
|
||||||
TimeDelta() : delta_(0) {}
|
TimeDelta() : delta_(0) {}
|
||||||
|
|
||||||
@ -278,7 +277,7 @@ class TimeBase {
|
|||||||
// This class represents an absolute point in time, internally represented as
|
// This class represents an absolute point in time, internally represented as
|
||||||
// microseconds (s/1,000,000) since 00:00:00 UTC, January 1, 1970.
|
// microseconds (s/1,000,000) since 00:00:00 UTC, January 1, 1970.
|
||||||
|
|
||||||
class V8_BASE_EXPORT Time final : public time_internal::TimeBase<Time> {
|
class Time final : public time_internal::TimeBase<Time> {
|
||||||
public:
|
public:
|
||||||
// Contains the NULL time. Use Time::Now() to get the current time.
|
// Contains the NULL time. Use Time::Now() to get the current time.
|
||||||
Time() : TimeBase(0) {}
|
Time() : TimeBase(0) {}
|
||||||
@ -323,7 +322,7 @@ class V8_BASE_EXPORT Time final : public time_internal::TimeBase<Time> {
|
|||||||
explicit Time(int64_t us) : TimeBase(us) {}
|
explicit Time(int64_t us) : TimeBase(us) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
V8_BASE_EXPORT std::ostream& operator<<(std::ostream&, const Time&);
|
std::ostream& operator<<(std::ostream&, const Time&);
|
||||||
|
|
||||||
inline Time operator+(const TimeDelta& delta, const Time& time) {
|
inline Time operator+(const TimeDelta& delta, const Time& time) {
|
||||||
return time + delta;
|
return time + delta;
|
||||||
@ -340,8 +339,7 @@ inline Time operator+(const TimeDelta& delta, const Time& time) {
|
|||||||
// Time::Now() may actually decrease or jump). But note that TimeTicks may
|
// Time::Now() may actually decrease or jump). But note that TimeTicks may
|
||||||
// "stand still", for example if the computer suspended.
|
// "stand still", for example if the computer suspended.
|
||||||
|
|
||||||
class V8_BASE_EXPORT TimeTicks final
|
class TimeTicks final : public time_internal::TimeBase<TimeTicks> {
|
||||||
: public time_internal::TimeBase<TimeTicks> {
|
|
||||||
public:
|
public:
|
||||||
TimeTicks() : TimeBase(0) {}
|
TimeTicks() : TimeBase(0) {}
|
||||||
|
|
||||||
@ -378,8 +376,7 @@ inline TimeTicks operator+(const TimeDelta& delta, const TimeTicks& ticks) {
|
|||||||
|
|
||||||
// Represents a clock, specific to a particular thread, than runs only while the
|
// Represents a clock, specific to a particular thread, than runs only while the
|
||||||
// thread is running.
|
// thread is running.
|
||||||
class V8_BASE_EXPORT ThreadTicks final
|
class ThreadTicks final : public time_internal::TimeBase<ThreadTicks> {
|
||||||
: public time_internal::TimeBase<ThreadTicks> {
|
|
||||||
public:
|
public:
|
||||||
ThreadTicks() : TimeBase(0) {}
|
ThreadTicks() : TimeBase(0) {}
|
||||||
|
|
||||||
@ -411,9 +408,6 @@ class V8_BASE_EXPORT ThreadTicks final
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
template <class TimeClass>
|
|
||||||
friend class time_internal::TimeBase;
|
|
||||||
|
|
||||||
// Please use Now() or GetForThread() to create a new object. This is for
|
// Please use Now() or GetForThread() to create a new object. This is for
|
||||||
// internal use and testing. Ticks are in microseconds.
|
// internal use and testing. Ticks are in microseconds.
|
||||||
explicit ThreadTicks(int64_t ticks) : TimeBase(ticks) {}
|
explicit ThreadTicks(int64_t ticks) : TimeBase(ticks) {}
|
||||||
|
@ -6,14 +6,12 @@
|
|||||||
#define V8_BASE_SYS_INFO_H_
|
#define V8_BASE_SYS_INFO_H_
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "src/base/base-export.h"
|
|
||||||
#include "src/base/compiler-specific.h"
|
#include "src/base/compiler-specific.h"
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
namespace base {
|
namespace base {
|
||||||
|
|
||||||
class V8_BASE_EXPORT SysInfo final {
|
class SysInfo final {
|
||||||
public:
|
public:
|
||||||
// Returns the number of logical processors/core on the current machine.
|
// Returns the number of logical processors/core on the current machine.
|
||||||
static int NumberOfProcessors();
|
static int NumberOfProcessors();
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#ifndef V8_BASE_UTILS_RANDOM_NUMBER_GENERATOR_H_
|
#ifndef V8_BASE_UTILS_RANDOM_NUMBER_GENERATOR_H_
|
||||||
#define 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"
|
#include "src/base/macros.h"
|
||||||
|
|
||||||
namespace v8 {
|
namespace v8 {
|
||||||
@ -32,7 +31,7 @@ namespace base {
|
|||||||
// https://code.google.com/p/v8/issues/detail?id=2905
|
// https://code.google.com/p/v8/issues/detail?id=2905
|
||||||
// This class is neither reentrant nor threadsafe.
|
// This class is neither reentrant nor threadsafe.
|
||||||
|
|
||||||
class V8_BASE_EXPORT RandomNumberGenerator final {
|
class RandomNumberGenerator final {
|
||||||
public:
|
public:
|
||||||
// EntropySource is used as a callback function when V8 needs a source of
|
// EntropySource is used as a callback function when V8 needs a source of
|
||||||
// entropy.
|
// entropy.
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
'type': 'executable',
|
'type': 'executable',
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
'v8.gyp:v8',
|
'v8.gyp:v8',
|
||||||
'v8.gyp:v8_libbase',
|
|
||||||
'v8.gyp:v8_libplatform',
|
'v8.gyp:v8_libplatform',
|
||||||
],
|
],
|
||||||
# Generated source files need this explicitly:
|
# Generated source files need this explicitly:
|
||||||
|
@ -465,7 +465,7 @@ class MemoryChunk {
|
|||||||
|
|
||||||
V8_EXPORT_PRIVATE void AllocateOldToNewSlots();
|
V8_EXPORT_PRIVATE void AllocateOldToNewSlots();
|
||||||
void ReleaseOldToNewSlots();
|
void ReleaseOldToNewSlots();
|
||||||
V8_EXPORT_PRIVATE void AllocateOldToOldSlots();
|
void AllocateOldToOldSlots();
|
||||||
void ReleaseOldToOldSlots();
|
void ReleaseOldToOldSlots();
|
||||||
void AllocateTypedOldToNewSlots();
|
void AllocateTypedOldToNewSlots();
|
||||||
void ReleaseTypedOldToNewSlots();
|
void ReleaseTypedOldToNewSlots();
|
||||||
|
@ -52,9 +52,9 @@ bool InitializeICUDefaultLocation(const char* exec_path,
|
|||||||
}
|
}
|
||||||
char* icu_data_file_default;
|
char* icu_data_file_default;
|
||||||
#if defined(V8_TARGET_LITTLE_ENDIAN)
|
#if defined(V8_TARGET_LITTLE_ENDIAN)
|
||||||
base::RelativePath(&icu_data_file_default, exec_path, "icudtl.dat");
|
RelativePath(&icu_data_file_default, exec_path, "icudtl.dat");
|
||||||
#elif defined(V8_TARGET_BIG_ENDIAN)
|
#elif defined(V8_TARGET_BIG_ENDIAN)
|
||||||
base::RelativePath(&icu_data_file_default, exec_path, "icudtb.dat");
|
RelativePath(&icu_data_file_default, exec_path, "icudtb.dat");
|
||||||
#else
|
#else
|
||||||
#error Unknown byte ordering
|
#error Unknown byte ordering
|
||||||
#endif
|
#endif
|
||||||
|
@ -86,9 +86,8 @@ void InitializeExternalStartupData(const char* directory_path) {
|
|||||||
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
|
#ifdef V8_USE_EXTERNAL_STARTUP_DATA
|
||||||
char* natives;
|
char* natives;
|
||||||
char* snapshot;
|
char* snapshot;
|
||||||
LoadFromFiles(
|
LoadFromFiles(RelativePath(&natives, directory_path, "natives_blob.bin"),
|
||||||
base::RelativePath(&natives, directory_path, "natives_blob.bin"),
|
RelativePath(&snapshot, directory_path, "snapshot_blob.bin"));
|
||||||
base::RelativePath(&snapshot, directory_path, "snapshot_blob.bin"));
|
|
||||||
free(natives);
|
free(natives);
|
||||||
free(snapshot);
|
free(snapshot);
|
||||||
#endif // V8_USE_EXTERNAL_STARTUP_DATA
|
#endif // V8_USE_EXTERNAL_STARTUP_DATA
|
||||||
|
40
src/v8.gyp
40
src/v8.gyp
@ -68,6 +68,16 @@
|
|||||||
'USING_V8_SHARED',
|
'USING_V8_SHARED',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
'target_conditions': [
|
||||||
|
['OS=="android" and _toolset=="target"', {
|
||||||
|
'libraries': [
|
||||||
|
'-llog',
|
||||||
|
],
|
||||||
|
'include_dirs': [
|
||||||
|
'src/common/android/include',
|
||||||
|
],
|
||||||
|
}],
|
||||||
|
],
|
||||||
'conditions': [
|
'conditions': [
|
||||||
['OS=="mac"', {
|
['OS=="mac"', {
|
||||||
'xcode_settings': {
|
'xcode_settings': {
|
||||||
@ -1753,7 +1763,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
'target_name': 'v8_libbase',
|
'target_name': 'v8_libbase',
|
||||||
'type': '<(component)',
|
'type': 'static_library',
|
||||||
'variables': {
|
'variables': {
|
||||||
'optimize': 'max',
|
'optimize': 'max',
|
||||||
},
|
},
|
||||||
@ -1776,7 +1786,6 @@
|
|||||||
'base/atomicops_internals_x86_gcc.cc',
|
'base/atomicops_internals_x86_gcc.cc',
|
||||||
'base/atomicops_internals_x86_gcc.h',
|
'base/atomicops_internals_x86_gcc.h',
|
||||||
'base/atomicops_internals_x86_msvc.h',
|
'base/atomicops_internals_x86_msvc.h',
|
||||||
'base/base-export.h',
|
|
||||||
'base/bits.cc',
|
'base/bits.cc',
|
||||||
'base/bits.h',
|
'base/bits.h',
|
||||||
'base/build_config.h',
|
'base/build_config.h',
|
||||||
@ -1824,16 +1833,6 @@
|
|||||||
'base/utils/random-number-generator.cc',
|
'base/utils/random-number-generator.cc',
|
||||||
'base/utils/random-number-generator.h',
|
'base/utils/random-number-generator.h',
|
||||||
],
|
],
|
||||||
'target_conditions': [
|
|
||||||
['OS=="android" and _toolset=="target"', {
|
|
||||||
'libraries': [
|
|
||||||
'-llog',
|
|
||||||
],
|
|
||||||
'include_dirs': [
|
|
||||||
'src/common/android/include',
|
|
||||||
],
|
|
||||||
}],
|
|
||||||
],
|
|
||||||
'conditions': [
|
'conditions': [
|
||||||
['want_separate_host_toolset==1 or \
|
['want_separate_host_toolset==1 or \
|
||||||
want_separate_host_toolset_mkpeephole==1', {
|
want_separate_host_toolset_mkpeephole==1', {
|
||||||
@ -1841,16 +1840,6 @@
|
|||||||
}, {
|
}, {
|
||||||
'toolsets': ['target'],
|
'toolsets': ['target'],
|
||||||
}],
|
}],
|
||||||
['component=="shared_library"', {
|
|
||||||
'defines': [
|
|
||||||
'BUILDING_V8_BASE_SHARED',
|
|
||||||
],
|
|
||||||
'direct_dependent_settings': {
|
|
||||||
'defines': [
|
|
||||||
'USING_V8_BASE_SHARED',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
}],
|
|
||||||
['OS=="linux"', {
|
['OS=="linux"', {
|
||||||
'link_settings': {
|
'link_settings': {
|
||||||
'libraries': [
|
'libraries': [
|
||||||
@ -2411,12 +2400,7 @@
|
|||||||
{
|
{
|
||||||
'target_name': 'mksnapshot',
|
'target_name': 'mksnapshot',
|
||||||
'type': 'executable',
|
'type': 'executable',
|
||||||
'dependencies': [
|
'dependencies': ['v8_base', 'v8_nosnapshot', 'v8_libplatform'],
|
||||||
'v8_base',
|
|
||||||
'v8_libbase',
|
|
||||||
'v8_nosnapshot',
|
|
||||||
'v8_libplatform'
|
|
||||||
],
|
|
||||||
'include_dirs+': [
|
'include_dirs+': [
|
||||||
'..',
|
'..',
|
||||||
'<(DEPTH)',
|
'<(DEPTH)',
|
||||||
|
@ -324,7 +324,6 @@ v8_executable("cctest") {
|
|||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
":resources",
|
":resources",
|
||||||
"../..:v8_libbase",
|
|
||||||
"../..:v8_libplatform",
|
"../..:v8_libplatform",
|
||||||
"../..:wasm_module_runner",
|
"../..:wasm_module_runner",
|
||||||
"../..:wasm_test_signatures",
|
"../..:wasm_test_signatures",
|
||||||
|
@ -320,7 +320,6 @@
|
|||||||
'type': 'executable',
|
'type': 'executable',
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
'resources',
|
'resources',
|
||||||
'../../src/v8.gyp:v8_libbase',
|
|
||||||
'../../src/v8.gyp:v8_libplatform',
|
'../../src/v8.gyp:v8_libplatform',
|
||||||
],
|
],
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
|
@ -386,7 +386,6 @@
|
|||||||
'type': 'static_library',
|
'type': 'static_library',
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
'../../src/v8.gyp:v8',
|
'../../src/v8.gyp:v8',
|
||||||
'../../src/v8.gyp:v8_libbase',
|
|
||||||
'../../src/v8.gyp:v8_libplatform',
|
'../../src/v8.gyp:v8_libplatform',
|
||||||
],
|
],
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
@ -401,7 +400,6 @@
|
|||||||
'target_name': 'fuzzer_support_nocomponent',
|
'target_name': 'fuzzer_support_nocomponent',
|
||||||
'type': 'static_library',
|
'type': 'static_library',
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
'../../src/v8.gyp:v8_libbase',
|
|
||||||
'../../src/v8.gyp:v8_libplatform',
|
'../../src/v8.gyp:v8_libplatform',
|
||||||
],
|
],
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
|
@ -159,7 +159,6 @@ v8_executable("unittests") {
|
|||||||
#}],
|
#}],
|
||||||
|
|
||||||
deps = [
|
deps = [
|
||||||
"../..:v8_libbase",
|
|
||||||
"../..:v8_libplatform",
|
"../..:v8_libplatform",
|
||||||
"//build/config/sanitizers:deps",
|
"//build/config/sanitizers:deps",
|
||||||
"//build/win:default_exe_manifest",
|
"//build/win:default_exe_manifest",
|
||||||
|
@ -163,7 +163,6 @@
|
|||||||
'dependencies': [
|
'dependencies': [
|
||||||
'../../testing/gmock.gyp:gmock',
|
'../../testing/gmock.gyp:gmock',
|
||||||
'../../testing/gtest.gyp:gtest',
|
'../../testing/gtest.gyp:gtest',
|
||||||
'../../src/v8.gyp:v8_libbase',
|
|
||||||
'../../src/v8.gyp:v8_libplatform',
|
'../../src/v8.gyp:v8_libplatform',
|
||||||
],
|
],
|
||||||
'include_dirs': [
|
'include_dirs': [
|
||||||
|
@ -37,7 +37,6 @@
|
|||||||
'type': 'executable',
|
'type': 'executable',
|
||||||
'dependencies': [
|
'dependencies': [
|
||||||
'../src/v8.gyp:v8',
|
'../src/v8.gyp:v8',
|
||||||
'../src/v8.gyp:v8_libbase',
|
|
||||||
'../src/v8.gyp:v8_libplatform',
|
'../src/v8.gyp:v8_libplatform',
|
||||||
],
|
],
|
||||||
'conditions': [
|
'conditions': [
|
||||||
|
Loading…
Reference in New Issue
Block a user