Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Revert of Turn libbase into a component (patchset #10 id:180001 of ht…
Browse files Browse the repository at this point in the history
…tps://codereview.chromium.org/2381273002/ )

Reason for revert:
Main suspect for roll block:
https://codereview.chromium.org/2387403002/

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}

TBR=jgruber@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/2393603002
Cr-Commit-Position: refs/heads/master@{#39960}
  • Loading branch information
mi-ac authored and Commit bot committed Oct 4, 2016
1 parent 5b1bcae commit efcb1ff
Show file tree
Hide file tree
Showing 33 changed files with 115 additions and 223 deletions.
33 changes: 7 additions & 26 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -130,17 +130,6 @@ 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" ]
Expand All @@ -156,6 +145,10 @@ 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
Expand Down Expand Up @@ -2157,7 +2150,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 = [
"src/base/adapters.h",
"src/base/atomic-utils.h",
Expand All @@ -2173,7 +2168,6 @@ v8_component("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",
Expand Down Expand Up @@ -2224,14 +2218,8 @@ v8_component("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" ]
}
Expand Down Expand Up @@ -2375,7 +2363,6 @@ v8_source_set("fuzzer_support_nocomponent") {
]

public_deps = [
":v8_libbase",
":v8_libplatform",
]
}
Expand Down Expand Up @@ -2404,7 +2391,6 @@ if (current_toolchain == v8_snapshot_toolchain) {

deps = [
":v8_base",
":v8_libbase",
":v8_libplatform",
":v8_nosnapshot",
"//build/config/sanitizers:deps",
Expand Down Expand Up @@ -2527,7 +2513,6 @@ v8_executable("d8") {
deps = [
":d8_js2c",
":v8",
":v8_libbase",
":v8_libplatform",
"//build/config/sanitizers:deps",
"//build/win:default_exe_manifest",
Expand Down Expand Up @@ -2568,7 +2553,6 @@ v8_executable("v8_hello_world") {

deps = [
":v8",
":v8_libbase",
":v8_libplatform",
"//build/config/sanitizers:deps",
"//build/win:default_exe_manifest",
Expand All @@ -2593,7 +2577,6 @@ v8_executable("v8_sample_process") {

deps = [
":v8",
":v8_libbase",
":v8_libplatform",
"//build/config/sanitizers:deps",
"//build/win:default_exe_manifest",
Expand All @@ -2616,7 +2599,6 @@ v8_executable("v8_parser_shell") {
]

deps = [
":v8_libbase",
":v8_libplatform",
"//build/config/sanitizers:deps",
"//build/win:default_exe_manifest",
Expand Down Expand Up @@ -2660,7 +2642,6 @@ if (want_v8_shell) {

deps = [
":v8",
":v8_libbase",
":v8_libplatform",
"//build/config/sanitizers:deps",
"//build/win:default_exe_manifest",
Expand Down
1 change: 0 additions & 1 deletion samples/samples.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
'type': 'executable',
'dependencies': [
'../src/v8.gyp:v8',
'../src/v8.gyp:v8_libbase',
'../src/v8.gyp:v8_libplatform',
],
'include_dirs': [
Expand Down
5 changes: 1 addition & 4 deletions src/base/atomicops_internals_x86_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#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 {

Expand All @@ -23,8 +21,7 @@ struct AtomicOps_x86CPUFeatureStruct {
bool has_sse2; // Processor has SSE2.
#endif
};
V8_BASE_EXPORT extern struct AtomicOps_x86CPUFeatureStruct
AtomicOps_Internalx86CPUFeatures;
extern struct AtomicOps_x86CPUFeatureStruct AtomicOps_Internalx86CPUFeatures;

#define ATOMICOPS_COMPILER_BARRIER() __asm__ __volatile__("" : : : "memory")

Expand Down
31 changes: 0 additions & 31 deletions src/base/base-export.h

This file was deleted.

32 changes: 18 additions & 14 deletions src/base/bits.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
#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>
Expand Down Expand Up @@ -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
// 0x80000000u. Implementation is from "Hacker's Delight" by Henry S. Warren,
// 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
// less than or equal to |value|. If you pass in a |value| that is already a
Expand Down Expand Up @@ -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|
// and |rhs| and stores the result into the variable pointed to by |val| and
// 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
// |rhs| and stores the result into the variable pointed to by |val| and
Expand All @@ -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|
// and |rhs| and stores the result into the variable pointed to by |val| and
// 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
// |rhs|, extracts the most significant 32 bits of the result, and returns
// 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
// |lhs| and |rhs|, extracts the most significant 32 bits of the result, and
// adds the accumulate value |acc|.
V8_BASE_EXPORT int32_t SignedMulHighAndAdd32(int32_t lhs, int32_t rhs,
int32_t acc);
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.
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
// truncated to int32. If either |rhs| is zero or |lhs| is minint and |rhs|
// 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|
// and |rhs| and stores the result into the variable pointed to by |val| and
Expand Down Expand Up @@ -317,16 +319,18 @@ inline uint32_t UnsignedMod32(uint32_t lhs, uint32_t rhs) {


// Clamp |value| on overflow and underflow conditions.
V8_BASE_EXPORT int64_t
FromCheckedNumeric(const internal::CheckedNumeric<int64_t> value);
int64_t FromCheckedNumeric(const internal::CheckedNumeric<int64_t> value);


// SignedSaturatedAdd64(lhs, rhs) adds |lhs| and |rhs|,
// 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|,
// 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 base
Expand Down
3 changes: 1 addition & 2 deletions src/base/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#ifndef V8_BASE_CPU_H_
#define V8_BASE_CPU_H_

#include "src/base/base-export.h"
#include "src/base/macros.h"

namespace v8 {
Expand All @@ -29,7 +28,7 @@ namespace base {
// architectures. For each architecture the file cpu_<arch>.cc contains the
// implementation of these static functions.

class V8_BASE_EXPORT CPU final {
class CPU final {
public:
CPU();

Expand Down
5 changes: 2 additions & 3 deletions src/base/debug/stack_trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <iosfwd>
#include <string>

#include "src/base/base-export.h"
#include "src/base/build_config.h"

#if V8_OS_POSIX
Expand All @@ -32,8 +31,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!
V8_BASE_EXPORT bool EnableInProcessStackDumping();
V8_BASE_EXPORT void DisableSignalStackDump();
bool EnableInProcessStackDumping();
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
Expand Down
10 changes: 10 additions & 0 deletions src/base/division-by-constant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
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));
Expand Down Expand Up @@ -93,6 +100,9 @@ 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);

Expand Down
28 changes: 5 additions & 23 deletions src/base/division-by-constant.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
#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 {

Expand All @@ -18,12 +14,10 @@ namespace base {
// Delight", chapter 10. The template parameter must be one of the unsigned
// integral types.
template <class T>
struct V8_BASE_EXPORT MagicNumbersForDivision {
struct MagicNumbersForDivision {
MagicNumbersForDivision(T m, unsigned s, bool a)
: multiplier(m), shift(s), add(a) {}
bool operator==(const MagicNumbersForDivision& rhs) const {
return multiplier == rhs.multiplier && shift == rhs.shift && add == rhs.add;
}
bool operator==(const MagicNumbersForDivision& rhs) const;

T multiplier;
unsigned shift;
Expand All @@ -34,29 +28,17 @@ struct V8_BASE_EXPORT 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>
V8_BASE_EXPORT MagicNumbersForDivision<T> SignedDivisionByConstant(T d);
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>
V8_BASE_EXPORT MagicNumbersForDivision<T> UnsignedDivisionByConstant(
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

Expand Down
Loading

0 comments on commit efcb1ff

Please sign in to comment.