Commit c25a324d authored by Wenyu Zhao's avatar Wenyu Zhao Committed by V8 LUCI CQ

[heap] Allow TPH to access some heap private interfaces.

This CL make TPH be able to access some heap private interfaces, by
marking TPH classes as friend classes.

Bug: v8:11641
Change-Id: I72aebf267c8f36593f50279bec5dccb44cda9528
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2994220
Auto-Submit: Wenyu Zhao <wenyu.zhao@anu.edu.au>
Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Wenyu Zhao <wenyu.zhao@anu.edu.au>
Cr-Commit-Position: refs/heads/master@{#75572}
parent 8b18c5e6
...@@ -53,6 +53,7 @@ class TestMemoryAllocatorScope; ...@@ -53,6 +53,7 @@ class TestMemoryAllocatorScope;
namespace third_party_heap { namespace third_party_heap {
class Heap; class Heap;
class Impl;
} // namespace third_party_heap } // namespace third_party_heap
class IncrementalMarking; class IncrementalMarking;
...@@ -2499,6 +2500,8 @@ class Heap { ...@@ -2499,6 +2500,8 @@ class Heap {
friend class Space; friend class Space;
friend class Sweeper; friend class Sweeper;
friend class heap::TestMemoryAllocatorScope; friend class heap::TestMemoryAllocatorScope;
friend class third_party_heap::Heap;
friend class third_party_heap::Impl;
// The allocator interface. // The allocator interface.
friend class Factory; friend class Factory;
......
...@@ -20,6 +20,8 @@ namespace v8 { ...@@ -20,6 +20,8 @@ namespace v8 {
namespace internal { namespace internal {
namespace third_party_heap { namespace third_party_heap {
class Impl {};
// static // static
std::unique_ptr<Heap> Heap::New(v8::internal::Isolate*) { return nullptr; } std::unique_ptr<Heap> Heap::New(v8::internal::Isolate*) { return nullptr; }
......
...@@ -13,6 +13,8 @@ namespace v8 { ...@@ -13,6 +13,8 @@ namespace v8 {
namespace internal { namespace internal {
namespace third_party_heap { namespace third_party_heap {
class Impl;
class Heap { class Heap {
public: public:
static std::unique_ptr<Heap> New(v8::internal::Isolate* isolate); static std::unique_ptr<Heap> New(v8::internal::Isolate* isolate);
...@@ -48,6 +50,11 @@ class Heap { ...@@ -48,6 +50,11 @@ class Heap {
bool CollectGarbage(); bool CollectGarbage();
size_t Capacity(); size_t Capacity();
V8_INLINE Impl* impl() { return impl_; }
private:
Impl* impl_ = nullptr;
}; };
} // namespace third_party_heap } // namespace third_party_heap
......
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
namespace third_party_heap {
class Impl;
}
// HashTable is a subclass of FixedArray that implements a hash table // HashTable is a subclass of FixedArray that implements a hash table
// that uses open addressing and quadratic probing. // that uses open addressing and quadratic probing.
// //
...@@ -399,6 +403,7 @@ class V8_EXPORT_PRIVATE EphemeronHashTable ...@@ -399,6 +403,7 @@ class V8_EXPORT_PRIVATE EphemeronHashTable
protected: protected:
friend class MarkCompactCollector; friend class MarkCompactCollector;
friend class ScavengerCollector; friend class ScavengerCollector;
friend class third_party_heap::Impl;
friend class HashTable<EphemeronHashTable, ObjectHashTableShape>; friend class HashTable<EphemeronHashTable, ObjectHashTableShape>;
friend class ObjectHashTableBase<EphemeronHashTable, ObjectHashTableShape>; friend class ObjectHashTableBase<EphemeronHashTable, ObjectHashTableShape>;
inline void set_key(int index, Object value); inline void set_key(int index, Object value);
......
...@@ -19,6 +19,10 @@ ...@@ -19,6 +19,10 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
namespace third_party_heap {
class Impl;
}
// Find all transitions with given name and calls the callback. // Find all transitions with given name and calls the callback.
using ForEachTransitionCallback = std::function<void(Map)>; using ForEachTransitionCallback = std::function<void(Map)>;
...@@ -165,6 +169,7 @@ class V8_EXPORT_PRIVATE TransitionsAccessor { ...@@ -165,6 +169,7 @@ class V8_EXPORT_PRIVATE TransitionsAccessor {
private: private:
friend class MarkCompactCollector; // For HasSimpleTransitionTo. friend class MarkCompactCollector; // For HasSimpleTransitionTo.
friend class third_party_heap::Impl;
friend class TransitionArray; friend class TransitionArray;
inline PropertyDetails GetSimpleTargetDetails(Map transition); inline PropertyDetails GetSimpleTargetDetails(Map transition);
...@@ -285,6 +290,7 @@ class TransitionArray : public WeakFixedArray { ...@@ -285,6 +290,7 @@ class TransitionArray : public WeakFixedArray {
private: private:
friend class Factory; friend class Factory;
friend class MarkCompactCollector; friend class MarkCompactCollector;
friend class third_party_heap::Impl;
friend class TransitionsAccessor; friend class TransitionsAccessor;
inline void SetNumberOfTransitions(int number_of_transitions); inline void SetNumberOfTransitions(int number_of_transitions);
......
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