Skip to content

Commit e8e324a

Browse files
billtiCommit Bot
authored andcommitted
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}
1 parent 566d174 commit e8e324a

10 files changed

Lines changed: 38 additions & 32 deletions

File tree

BUILD.gn

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,10 @@ config("toolchain") {
760760
]
761761
}
762762

763+
if (!is_clang && is_win) {
764+
cflags += [ "/wd4506" ] # Benign "no definition for inline function"
765+
}
766+
763767
if (!is_clang && !is_win) {
764768
cflags += [
765769
# Disable gcc warnings for optimizations based on the assumption that

src/codegen/code-stub-assembler.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7578,12 +7578,12 @@ TNode<MaybeObject> CodeStubAssembler::LoadFieldTypeByDescriptorEntry(
75787578
DescriptorArray::ToValueIndex(0) * kTaggedSize);
75797579
}
75807580

7581-
template TNode<IntPtrT> CodeStubAssembler::EntryToIndex<NameDictionary>(
7582-
TNode<IntPtrT>, int);
7583-
template TNode<IntPtrT> CodeStubAssembler::EntryToIndex<GlobalDictionary>(
7584-
TNode<IntPtrT>, int);
7585-
template TNode<IntPtrT> CodeStubAssembler::EntryToIndex<NumberDictionary>(
7586-
TNode<IntPtrT>, int);
7581+
template V8_EXPORT_PRIVATE TNode<IntPtrT>
7582+
CodeStubAssembler::EntryToIndex<NameDictionary>(TNode<IntPtrT>, int);
7583+
template V8_EXPORT_PRIVATE TNode<IntPtrT>
7584+
CodeStubAssembler::EntryToIndex<GlobalDictionary>(TNode<IntPtrT>, int);
7585+
template V8_EXPORT_PRIVATE TNode<IntPtrT>
7586+
CodeStubAssembler::EntryToIndex<NumberDictionary>(TNode<IntPtrT>, int);
75877587

75887588
// This must be kept in sync with HashTableBase::ComputeCapacity().
75897589
TNode<IntPtrT> CodeStubAssembler::HashTableComputeCapacity(

src/codegen/code-stub-assembler.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2935,10 +2935,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
29352935
// Calculates array index for given dictionary entry and entry field.
29362936
// See Dictionary::EntryToIndex().
29372937
template <typename Dictionary>
2938-
V8_EXPORT_PRIVATE TNode<IntPtrT> EntryToIndex(TNode<IntPtrT> entry,
2939-
int field_index);
2938+
TNode<IntPtrT> EntryToIndex(TNode<IntPtrT> entry, int field_index);
29402939
template <typename Dictionary>
2941-
V8_EXPORT_PRIVATE TNode<IntPtrT> EntryToIndex(TNode<IntPtrT> entry) {
2940+
TNode<IntPtrT> EntryToIndex(TNode<IntPtrT> entry) {
29422941
return EntryToIndex<Dictionary>(entry, Dictionary::kEntryKeyIndex);
29432942
}
29442943

src/objects/dictionary.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ class V8_EXPORT_PRIVATE NameDictionary
194194
BaseNameDictionary<NameDictionary, NameDictionaryShape>);
195195
};
196196

197-
class GlobalDictionaryShape : public NameDictionaryShape {
197+
class V8_EXPORT_PRIVATE GlobalDictionaryShape : public NameDictionaryShape {
198198
public:
199199
static inline bool IsMatch(Handle<Name> key, Object other);
200200
static inline uint32_t HashForObject(ReadOnlyRoots roots, Object object);

src/objects/hash-table.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace internal {
5757
// information by subclasses.
5858

5959
template <typename KeyT>
60-
class BaseShape {
60+
class V8_EXPORT_PRIVATE BaseShape {
6161
public:
6262
using Key = KeyT;
6363
static inline RootIndex GetMapRootIndex();

src/objects/string-table.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class StringTableKey {
3737
int length_;
3838
};
3939

40-
class StringTableShape : public BaseShape<StringTableKey*> {
40+
class V8_EXPORT_PRIVATE StringTableShape : public BaseShape<StringTableKey*> {
4141
public:
4242
static inline bool IsMatch(Key key, Object value);
4343

@@ -59,12 +59,12 @@ class SeqOneByteString;
5959
//
6060
// No special elements in the prefix and the element size is 1
6161
// because only the string itself (the key) needs to be stored.
62-
class StringTable : public HashTable<StringTable, StringTableShape> {
62+
class V8_EXPORT_PRIVATE StringTable
63+
: public HashTable<StringTable, StringTableShape> {
6364
public:
6465
// Find string in the string table. If it is not there yet, it is
6566
// added. The return value is the string found.
66-
V8_EXPORT_PRIVATE static Handle<String> LookupString(Isolate* isolate,
67-
Handle<String> key);
67+
static Handle<String> LookupString(Isolate* isolate, Handle<String> key);
6868
template <typename StringTableKey>
6969
static Handle<String> LookupKey(Isolate* isolate, StringTableKey* key);
7070
static Handle<String> AddKeyNoResize(Isolate* isolate, StringTableKey* key);
@@ -77,8 +77,8 @@ class StringTable : public HashTable<StringTable, StringTableShape> {
7777
// {raw_string} must be a tagged String pointer.
7878
// Returns a tagged pointer: either an internalized string, or a Smi
7979
// sentinel.
80-
V8_EXPORT_PRIVATE static Address LookupStringIfExists_NoAllocate(
81-
Isolate* isolate, Address raw_string);
80+
static Address LookupStringIfExists_NoAllocate(Isolate* isolate,
81+
Address raw_string);
8282

8383
static void EnsureCapacityForDeserialization(Isolate* isolate, int expected);
8484

src/strings/unicode-decoder.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ void Utf8Decoder::Decode(Char* out, const Vector<const uint8_t>& data) {
7171
if (t != unibrow::Utf8::kBufferEmpty) *out = static_cast<Char>(t);
7272
}
7373

74-
template void Utf8Decoder::Decode(uint8_t* out,
75-
const Vector<const uint8_t>& data);
74+
template V8_EXPORT_PRIVATE void Utf8Decoder::Decode(
75+
uint8_t* out, const Vector<const uint8_t>& data);
7676

77-
template void Utf8Decoder::Decode(uint16_t* out,
78-
const Vector<const uint8_t>& data);
77+
template V8_EXPORT_PRIVATE void Utf8Decoder::Decode(
78+
uint16_t* out, const Vector<const uint8_t>& data);
7979

8080
} // namespace internal
8181
} // namespace v8

src/torque/contextual.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class ContextualVariable {
7070

7171
private:
7272
template <class T>
73-
friend typename T::Scope*& ContextualVariableTop();
73+
friend V8_EXPORT_PRIVATE typename T::Scope*& ContextualVariableTop();
7474
static Scope*& Top() { return ContextualVariableTop<Derived>(); }
7575

7676
static bool HasScope() { return Top() != nullptr; }

src/utils/allocation.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ bool OnCriticalMemoryPressure(size_t length) {
210210
return true;
211211
}
212212

213+
VirtualMemory::VirtualMemory() = default;
214+
213215
VirtualMemory::VirtualMemory(v8::PageAllocator* page_allocator, size_t size,
214216
void* hint, size_t alignment)
215217
: page_allocator_(page_allocator) {

src/utils/allocation.h

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,17 +148,18 @@ inline bool SetPermissions(v8::PageAllocator* page_allocator, Address address,
148148
V8_EXPORT_PRIVATE bool OnCriticalMemoryPressure(size_t length);
149149

150150
// Represents and controls an area of reserved memory.
151-
class V8_EXPORT_PRIVATE VirtualMemory final {
151+
class VirtualMemory final {
152152
public:
153153
// Empty VirtualMemory object, controlling no reserved memory.
154-
VirtualMemory() = default;
154+
V8_EXPORT_PRIVATE VirtualMemory();
155155

156156
// Reserves virtual memory containing an area of the given size that is
157157
// aligned per |alignment| rounded up to the |page_allocator|'s allocate page
158158
// size. The |size| must be aligned with |page_allocator|'s commit page size.
159159
// This may not be at the position returned by address().
160-
VirtualMemory(v8::PageAllocator* page_allocator, size_t size, void* hint,
161-
size_t alignment = 1);
160+
V8_EXPORT_PRIVATE VirtualMemory(v8::PageAllocator* page_allocator,
161+
size_t size, void* hint,
162+
size_t alignment = 1);
162163

163164
// Construct a virtual memory by assigning it some already mapped address
164165
// and size.
@@ -171,7 +172,7 @@ class V8_EXPORT_PRIVATE VirtualMemory final {
171172

172173
// Releases the reserved memory, if any, controlled by this VirtualMemory
173174
// object.
174-
~VirtualMemory();
175+
V8_EXPORT_PRIVATE ~VirtualMemory();
175176

176177
// Move constructor.
177178
VirtualMemory(VirtualMemory&& other) V8_NOEXCEPT { *this = std::move(other); }
@@ -189,7 +190,7 @@ class V8_EXPORT_PRIVATE VirtualMemory final {
189190
bool IsReserved() const { return region_.begin() != kNullAddress; }
190191

191192
// Initialize or resets an embedded VirtualMemory object.
192-
void Reset();
193+
V8_EXPORT_PRIVATE void Reset();
193194

194195
v8::PageAllocator* page_allocator() { return page_allocator_; }
195196

@@ -217,14 +218,14 @@ class V8_EXPORT_PRIVATE VirtualMemory final {
217218

218219
// Sets permissions according to the access argument. address and size must be
219220
// multiples of CommitPageSize(). Returns true on success, otherwise false.
220-
bool SetPermissions(Address address, size_t size,
221-
PageAllocator::Permission access);
221+
V8_EXPORT_PRIVATE bool SetPermissions(Address address, size_t size,
222+
PageAllocator::Permission access);
222223

223224
// Releases memory after |free_start|. Returns the number of bytes released.
224-
size_t Release(Address free_start);
225+
V8_EXPORT_PRIVATE size_t Release(Address free_start);
225226

226227
// Frees all memory.
227-
void Free();
228+
V8_EXPORT_PRIVATE void Free();
228229

229230
bool InVM(Address address, size_t size) {
230231
return region_.contains(address, size);

0 commit comments

Comments
 (0)