Fix MSVC component build

Add the necessary V8_EXPORT_PRIVATE attributes and a few other minor
changes to make building DLLs with MSVC happy. (Note: Debug builds still
seem to be failing in Torque, but this fixes Release builds).

Bug: v8:8791
Change-Id: Ia4d5372fd1cb961e6268a2b5c089bcd17822f1e5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1996157
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65822}
This commit is contained in:
Bill Ticehurst 2020-01-13 21:55:25 -08:00 committed by Commit Bot
parent 566d174ed4
commit e8e324aa9d
10 changed files with 38 additions and 32 deletions

View File

@ -760,6 +760,10 @@ config("toolchain") {
]
}
if (!is_clang && is_win) {
cflags += [ "/wd4506" ] # Benign "no definition for inline function"
}
if (!is_clang && !is_win) {
cflags += [
# Disable gcc warnings for optimizations based on the assumption that

View File

@ -7578,12 +7578,12 @@ TNode<MaybeObject> CodeStubAssembler::LoadFieldTypeByDescriptorEntry(
DescriptorArray::ToValueIndex(0) * kTaggedSize);
}
template TNode<IntPtrT> CodeStubAssembler::EntryToIndex<NameDictionary>(
TNode<IntPtrT>, int);
template TNode<IntPtrT> CodeStubAssembler::EntryToIndex<GlobalDictionary>(
TNode<IntPtrT>, int);
template TNode<IntPtrT> CodeStubAssembler::EntryToIndex<NumberDictionary>(
TNode<IntPtrT>, int);
template V8_EXPORT_PRIVATE TNode<IntPtrT>
CodeStubAssembler::EntryToIndex<NameDictionary>(TNode<IntPtrT>, int);
template V8_EXPORT_PRIVATE TNode<IntPtrT>
CodeStubAssembler::EntryToIndex<GlobalDictionary>(TNode<IntPtrT>, int);
template V8_EXPORT_PRIVATE TNode<IntPtrT>
CodeStubAssembler::EntryToIndex<NumberDictionary>(TNode<IntPtrT>, int);
// This must be kept in sync with HashTableBase::ComputeCapacity().
TNode<IntPtrT> CodeStubAssembler::HashTableComputeCapacity(

View File

@ -2935,10 +2935,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
// Calculates array index for given dictionary entry and entry field.
// See Dictionary::EntryToIndex().
template <typename Dictionary>
V8_EXPORT_PRIVATE TNode<IntPtrT> EntryToIndex(TNode<IntPtrT> entry,
int field_index);
TNode<IntPtrT> EntryToIndex(TNode<IntPtrT> entry, int field_index);
template <typename Dictionary>
V8_EXPORT_PRIVATE TNode<IntPtrT> EntryToIndex(TNode<IntPtrT> entry) {
TNode<IntPtrT> EntryToIndex(TNode<IntPtrT> entry) {
return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex);
}

View File

@ -194,7 +194,7 @@ class V8_EXPORT_PRIVATE NameDictionary
BaseNameDictionary<NameDictionary, NameDictionaryShape>);
};
class GlobalDictionaryShape : public NameDictionaryShape {
class V8_EXPORT_PRIVATE GlobalDictionaryShape : public NameDictionaryShape {
public:
static inline bool IsMatch(Handle<Name> key, Object other);
static inline uint32_t HashForObject(ReadOnlyRoots roots, Object object);

View File

@ -57,7 +57,7 @@ namespace internal {
// information by subclasses.
template <typename KeyT>
class BaseShape {
class V8_EXPORT_PRIVATE BaseShape {
public:
using Key = KeyT;
static inline RootIndex GetMapRootIndex();

View File

@ -37,7 +37,7 @@ class StringTableKey {
int length_;
};
class StringTableShape : public BaseShape<StringTableKey*> {
class V8_EXPORT_PRIVATE StringTableShape : public BaseShape<StringTableKey*> {
public:
static inline bool IsMatch(Key key, Object value);
@ -59,12 +59,12 @@ class SeqOneByteString;
//
// No special elements in the prefix and the element size is 1
// because only the string itself (the key) needs to be stored.
class StringTable : public HashTable<StringTable, StringTableShape> {
class V8_EXPORT_PRIVATE StringTable
: public HashTable<StringTable, StringTableShape> {
public:
// Find string in the string table. If it is not there yet, it is
// added. The return value is the string found.
V8_EXPORT_PRIVATE static Handle<String> LookupString(Isolate* isolate,
Handle<String> key);
static Handle<String> LookupString(Isolate* isolate, Handle<String> key);
template <typename StringTableKey>
static Handle<String> LookupKey(Isolate* isolate, StringTableKey* key);
static Handle<String> AddKeyNoResize(Isolate* isolate, StringTableKey* key);
@ -77,8 +77,8 @@ class StringTable : public HashTable<StringTable, StringTableShape> {
// {raw_string} must be a tagged String pointer.
// Returns a tagged pointer: either an internalized string, or a Smi
// sentinel.
V8_EXPORT_PRIVATE static Address LookupStringIfExists_NoAllocate(
Isolate* isolate, Address raw_string);
static Address LookupStringIfExists_NoAllocate(Isolate* isolate,
Address raw_string);
static void EnsureCapacityForDeserialization(Isolate* isolate, int expected);

View File

@ -71,11 +71,11 @@ void Utf8Decoder::Decode(Char* out, const Vector<const uint8_t>& data) {
if (t != unibrow::Utf8::kBufferEmpty) *out = static_cast<Char>(t);
}
template void Utf8Decoder::Decode(uint8_t* out,
const Vector<const uint8_t>& data);
template V8_EXPORT_PRIVATE void Utf8Decoder::Decode(
uint8_t* out, const Vector<const uint8_t>& data);
template void Utf8Decoder::Decode(uint16_t* out,
const Vector<const uint8_t>& data);
template V8_EXPORT_PRIVATE void Utf8Decoder::Decode(
uint16_t* out, const Vector<const uint8_t>& data);
} // namespace internal
} // namespace v8

View File

@ -70,7 +70,7 @@ class ContextualVariable {
private:
template <class T>
friend typename T::Scope*& ContextualVariableTop();
friend V8_EXPORT_PRIVATE typename T::Scope*& ContextualVariableTop();
static Scope*& Top() { return ContextualVariableTop<Derived>(); }
static bool HasScope() { return Top() != nullptr; }

View File

@ -210,6 +210,8 @@ bool OnCriticalMemoryPressure(size_t length) {
return true;
}
VirtualMemory::VirtualMemory() = default;
VirtualMemory::VirtualMemory(v8::PageAllocator* page_allocator, size_t size,
void* hint, size_t alignment)
: page_allocator_(page_allocator) {

View File

@ -148,17 +148,18 @@ inline bool SetPermissions(v8::PageAllocator* page_allocator, Address address,
V8_EXPORT_PRIVATE bool OnCriticalMemoryPressure(size_t length);
// Represents and controls an area of reserved memory.
class V8_EXPORT_PRIVATE VirtualMemory final {
class VirtualMemory final {
public:
// Empty VirtualMemory object, controlling no reserved memory.
VirtualMemory() = default;
V8_EXPORT_PRIVATE VirtualMemory();
// Reserves virtual memory containing an area of the given size that is
// aligned per |alignment| rounded up to the |page_allocator|'s allocate page
// size. The |size| must be aligned with |page_allocator|'s commit page size.
// This may not be at the position returned by address().
VirtualMemory(v8::PageAllocator* page_allocator, size_t size, void* hint,
size_t alignment = 1);
V8_EXPORT_PRIVATE VirtualMemory(v8::PageAllocator* page_allocator,
size_t size, void* hint,
size_t alignment = 1);
// Construct a virtual memory by assigning it some already mapped address
// and size.
@ -171,7 +172,7 @@ class V8_EXPORT_PRIVATE VirtualMemory final {
// Releases the reserved memory, if any, controlled by this VirtualMemory
// object.
~VirtualMemory();
V8_EXPORT_PRIVATE ~VirtualMemory();
// Move constructor.
VirtualMemory(VirtualMemory&& other) V8_NOEXCEPT { *this = std::move(other); }
@ -189,7 +190,7 @@ class V8_EXPORT_PRIVATE VirtualMemory final {
bool IsReserved() const { return region_.begin() != kNullAddress; }
// Initialize or resets an embedded VirtualMemory object.
void Reset();
V8_EXPORT_PRIVATE void Reset();
v8::PageAllocator* page_allocator() { return page_allocator_; }
@ -217,14 +218,14 @@ class V8_EXPORT_PRIVATE VirtualMemory final {
// Sets permissions according to the access argument. address and size must be
// multiples of CommitPageSize(). Returns true on success, otherwise false.
bool SetPermissions(Address address, size_t size,
PageAllocator::Permission access);
V8_EXPORT_PRIVATE bool SetPermissions(Address address, size_t size,
PageAllocator::Permission access);
// Releases memory after |free_start|. Returns the number of bytes released.
size_t Release(Address free_start);
V8_EXPORT_PRIVATE size_t Release(Address free_start);
// Frees all memory.
void Free();
V8_EXPORT_PRIVATE void Free();
bool InVM(Address address, size_t size) {
return region_.contains(address, size);