Commit f8aaf984 authored by Anton Bikineev's avatar Anton Bikineev Committed by Commit Bot

Add missing explicit instantiation declarations

This is a cosmetic change aimed to reduce compilation
time spent on instantiating things and potentially reduce
code (in case instantiated specializations are in
different shared objects).

Change-Id: I719b4d376a0d707f4724555a2f404327d19d8477
Reviewed-on: https://chromium-review.googlesource.com/c/1484298
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59988}
parent 9405fcfd
...@@ -230,6 +230,35 @@ typedef PerIsolateAssertScopeDebugOnly<NO_EXCEPTION_ASSERT, false> ...@@ -230,6 +230,35 @@ typedef PerIsolateAssertScopeDebugOnly<NO_EXCEPTION_ASSERT, false>
// Scope to introduce an exception to DisallowExceptions. // Scope to introduce an exception to DisallowExceptions.
typedef PerIsolateAssertScopeDebugOnly<NO_EXCEPTION_ASSERT, true> typedef PerIsolateAssertScopeDebugOnly<NO_EXCEPTION_ASSERT, true>
AllowExceptions; AllowExceptions;
// Explicit instantiation declarations.
extern template class PerThreadAssertScope<HEAP_ALLOCATION_ASSERT, false>;
extern template class PerThreadAssertScope<HEAP_ALLOCATION_ASSERT, true>;
extern template class PerThreadAssertScope<HANDLE_ALLOCATION_ASSERT, false>;
extern template class PerThreadAssertScope<HANDLE_ALLOCATION_ASSERT, true>;
extern template class PerThreadAssertScope<HANDLE_DEREFERENCE_ASSERT, false>;
extern template class PerThreadAssertScope<HANDLE_DEREFERENCE_ASSERT, true>;
extern template class PerThreadAssertScope<DEFERRED_HANDLE_DEREFERENCE_ASSERT,
false>;
extern template class PerThreadAssertScope<DEFERRED_HANDLE_DEREFERENCE_ASSERT,
true>;
extern template class PerThreadAssertScope<CODE_DEPENDENCY_CHANGE_ASSERT,
false>;
extern template class PerThreadAssertScope<CODE_DEPENDENCY_CHANGE_ASSERT, true>;
extern template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, false>;
extern template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_ASSERT, true>;
extern template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, false>;
extern template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_THROWS, true>;
extern template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_DUMP, false>;
extern template class PerIsolateAssertScope<JAVASCRIPT_EXECUTION_DUMP, true>;
extern template class PerIsolateAssertScope<DEOPTIMIZATION_ASSERT, false>;
extern template class PerIsolateAssertScope<DEOPTIMIZATION_ASSERT, true>;
extern template class PerIsolateAssertScope<COMPILATION_ASSERT, false>;
extern template class PerIsolateAssertScope<COMPILATION_ASSERT, true>;
extern template class PerIsolateAssertScope<NO_EXCEPTION_ASSERT, false>;
extern template class PerIsolateAssertScope<NO_EXCEPTION_ASSERT, true>;
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -93,16 +93,22 @@ MagicNumbersForDivision<T> UnsignedDivisionByConstant(T d, ...@@ -93,16 +93,22 @@ MagicNumbersForDivision<T> UnsignedDivisionByConstant(T d,
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Instantiations. // Instantiations.
template struct V8_BASE_EXPORT MagicNumbersForDivision<uint32_t>; template struct EXPORT_TEMPLATE_DEFINE(V8_BASE_EXPORT)
template struct V8_BASE_EXPORT MagicNumbersForDivision<uint64_t>; MagicNumbersForDivision<uint32_t>;
template struct EXPORT_TEMPLATE_DEFINE(V8_BASE_EXPORT)
MagicNumbersForDivision<uint64_t>;
template MagicNumbersForDivision<uint32_t> SignedDivisionByConstant(uint32_t d); template EXPORT_TEMPLATE_DEFINE(V8_BASE_EXPORT)
template MagicNumbersForDivision<uint64_t> SignedDivisionByConstant(uint64_t d); MagicNumbersForDivision<uint32_t> SignedDivisionByConstant(uint32_t d);
template EXPORT_TEMPLATE_DEFINE(V8_BASE_EXPORT)
MagicNumbersForDivision<uint64_t> SignedDivisionByConstant(uint64_t d);
template MagicNumbersForDivision<uint32_t> UnsignedDivisionByConstant( template EXPORT_TEMPLATE_DEFINE(V8_BASE_EXPORT)
uint32_t d, unsigned leading_zeros); MagicNumbersForDivision<uint32_t> UnsignedDivisionByConstant(
template MagicNumbersForDivision<uint64_t> UnsignedDivisionByConstant( uint32_t d, unsigned leading_zeros);
uint64_t d, unsigned leading_zeros); template EXPORT_TEMPLATE_DEFINE(V8_BASE_EXPORT)
MagicNumbersForDivision<uint64_t> UnsignedDivisionByConstant(
uint64_t d, unsigned leading_zeros);
} // namespace base } // namespace base
} // namespace v8 } // namespace v8
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <stdint.h> #include <stdint.h>
#include "src/base/base-export.h" #include "src/base/base-export.h"
#include "src/base/export-template.h"
namespace v8 { namespace v8 {
namespace base { namespace base {
...@@ -18,7 +19,7 @@ namespace base { ...@@ -18,7 +19,7 @@ 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 EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT) 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 {
...@@ -34,25 +35,35 @@ struct V8_BASE_EXPORT MagicNumbersForDivision { ...@@ -34,25 +35,35 @@ 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); EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
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( EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
MagicNumbersForDivision<T> UnsignedDivisionByConstant(
T d, unsigned leading_zeros = 0); T d, unsigned leading_zeros = 0);
extern template V8_BASE_EXPORT MagicNumbersForDivision<uint32_t> // Explicit instantiation declarations.
SignedDivisionByConstant(uint32_t d); extern template struct EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
extern template V8_BASE_EXPORT MagicNumbersForDivision<uint64_t> MagicNumbersForDivision<uint32_t>;
SignedDivisionByConstant(uint64_t d); extern template struct EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
MagicNumbersForDivision<uint64_t>;
extern template V8_BASE_EXPORT MagicNumbersForDivision<uint32_t> extern template EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
UnsignedDivisionByConstant(uint32_t d, unsigned leading_zeros); MagicNumbersForDivision<uint32_t> SignedDivisionByConstant(uint32_t d);
extern template V8_BASE_EXPORT MagicNumbersForDivision<uint64_t> extern template EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
UnsignedDivisionByConstant(uint64_t d, unsigned leading_zeros); MagicNumbersForDivision<uint64_t> SignedDivisionByConstant(uint64_t d);
extern template EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
MagicNumbersForDivision<uint32_t> UnsignedDivisionByConstant(
uint32_t d, unsigned leading_zeros);
extern template EXPORT_TEMPLATE_DECLARE(V8_BASE_EXPORT)
MagicNumbersForDivision<uint64_t> UnsignedDivisionByConstant(
uint64_t d, unsigned leading_zeros);
} // namespace base } // namespace base
} // namespace v8 } // namespace v8
......
...@@ -112,11 +112,13 @@ void NodeCache<Key, Hash, Pred>::GetCachedNodes(ZoneVector<Node*>* nodes) { ...@@ -112,11 +112,13 @@ void NodeCache<Key, Hash, Pred>::GetCachedNodes(ZoneVector<Node*>* nodes) {
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Instantiations // Instantiations
template class V8_EXPORT_PRIVATE NodeCache<int32_t>; template class EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) NodeCache<int32_t>;
template class V8_EXPORT_PRIVATE NodeCache<int64_t>; template class EXPORT_TEMPLATE_DEFINE(V8_EXPORT_PRIVATE) NodeCache<int64_t>;
template class V8_EXPORT_PRIVATE NodeCache<RelocInt32Key>; template class EXPORT_TEMPLATE_DEFINE(
template class V8_EXPORT_PRIVATE NodeCache<RelocInt64Key>; V8_EXPORT_PRIVATE) NodeCache<RelocInt32Key>;
template class EXPORT_TEMPLATE_DEFINE(
V8_EXPORT_PRIVATE) NodeCache<RelocInt64Key>;
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef V8_COMPILER_NODE_CACHE_H_ #ifndef V8_COMPILER_NODE_CACHE_H_
#define V8_COMPILER_NODE_CACHE_H_ #define V8_COMPILER_NODE_CACHE_H_
#include "src/base/export-template.h"
#include "src/base/functional.h" #include "src/base/functional.h"
#include "src/base/macros.h" #include "src/base/macros.h"
...@@ -27,7 +28,7 @@ class Node; ...@@ -27,7 +28,7 @@ class Node;
// nodes such as constants, parameters, etc. // nodes such as constants, parameters, etc.
template <typename Key, typename Hash = base::hash<Key>, template <typename Key, typename Hash = base::hash<Key>,
typename Pred = std::equal_to<Key> > typename Pred = std::equal_to<Key> >
class V8_EXPORT_PRIVATE NodeCache final { class EXPORT_TEMPLATE_DECLARE(V8_EXPORT_PRIVATE) NodeCache final {
public: public:
explicit NodeCache(unsigned max = 256) explicit NodeCache(unsigned max = 256)
: entries_(nullptr), size_(0), max_(max) {} : entries_(nullptr), size_(0), max_(max) {}
...@@ -77,6 +78,17 @@ typedef Int32NodeCache IntPtrNodeCache; ...@@ -77,6 +78,17 @@ typedef Int32NodeCache IntPtrNodeCache;
typedef Int64NodeCache IntPtrNodeCache; typedef Int64NodeCache IntPtrNodeCache;
#endif #endif
// Explicit instantiation declarations.
extern template class EXPORT_TEMPLATE_DECLARE(
V8_EXPORT_PRIVATE) NodeCache<int32_t>;
extern template class EXPORT_TEMPLATE_DECLARE(
V8_EXPORT_PRIVATE) NodeCache<int64_t>;
extern template class EXPORT_TEMPLATE_DECLARE(
V8_EXPORT_PRIVATE) NodeCache<RelocInt32Key>;
extern template class EXPORT_TEMPLATE_DECLARE(
V8_EXPORT_PRIVATE) NodeCache<RelocInt64Key>;
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -157,6 +157,10 @@ class JsonParser { ...@@ -157,6 +157,10 @@ class JsonParser {
ZoneVector<Handle<Object>> properties_; ZoneVector<Handle<Object>> properties_;
}; };
// Explicit instantiation declarations.
extern template class JsonParser<true>;
extern template class JsonParser<false>;
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
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