Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/heap/read-only-heap.h')
-rw-r--r--deps/v8/src/heap/read-only-heap.h42
1 files changed, 24 insertions, 18 deletions
diff --git a/deps/v8/src/heap/read-only-heap.h b/deps/v8/src/heap/read-only-heap.h
index 27d34b4c034..ed105211296 100644
--- a/deps/v8/src/heap/read-only-heap.h
+++ b/deps/v8/src/heap/read-only-heap.h
@@ -5,6 +5,7 @@
#ifndef V8_HEAP_READ_ONLY_HEAP_H_
#define V8_HEAP_READ_ONLY_HEAP_H_
+#include <memory>
#include <utility>
#include "src/base/macros.h"
@@ -14,10 +15,14 @@
#include "src/roots/roots.h"
namespace v8 {
+
+class SharedMemoryStatistics;
+
namespace internal {
class Isolate;
class Page;
+class ReadOnlyArtifacts;
class ReadOnlyDeserializer;
class ReadOnlySpace;
@@ -28,23 +33,27 @@ class ReadOnlyHeap final {
static constexpr size_t kEntriesCount =
static_cast<size_t>(RootIndex::kReadOnlyRootsCount);
- // If necessary creates read-only heap and initializes its artifacts (if
- // the deserializer is provided). Then attaches the read-only heap to the
- // isolate.
+ // If necessary creates read-only heap and initializes its artifacts (if the
+ // deserializer is provided). Then attaches the read-only heap to the isolate.
+ // If the deserializer is not provided, then the read-only heap will be only
+ // finish initializing when initial heap object creation in the Isolate is
+ // completed, which is signalled by calling OnCreateHeapObjectsComplete. When
+ // V8_SHARED_RO_HEAP is enabled, a lock will be held until that method is
+ // called.
// TODO(v8:7464): Ideally we'd create this without needing a heap.
static void SetUp(Isolate* isolate, ReadOnlyDeserializer* des);
// Indicates that the isolate has been set up and all read-only space objects
- // have been created and will not be written to. This is not thread safe, and
- // should really only be used during snapshot creation or when read-only heap
- // sharing is disabled.
+ // have been created and will not be written to. This should only be called if
+ // a deserializer was not previously provided to Setup. When V8_SHARED_RO_HEAP
+ // is enabled, this releases the ReadOnlyHeap creation lock.
void OnCreateHeapObjectsComplete(Isolate* isolate);
// Indicates that the current isolate no longer requires the read-only heap
// and it may be safely disposed of.
void OnHeapTearDown();
-
-#ifdef V8_SHARED_RO_HEAP
- static const ReadOnlyHeap* Instance();
-#endif
+ // If the read-only heap is shared, then populate |statistics| with its stats,
+ // otherwise the read-only heap stats are set to 0.
+ static void PopulateReadOnlySpaceStatistics(
+ SharedMemoryStatistics* statistics);
// Returns whether the address is within the read-only space.
V8_EXPORT_PRIVATE static bool Contains(Address address);
@@ -56,10 +65,6 @@ class ReadOnlyHeap final {
V8_EXPORT_PRIVATE inline static ReadOnlyRoots GetReadOnlyRoots(
HeapObject object);
- // Clears any shared read-only heap artifacts for testing, forcing read-only
- // heap to be re-created on next set up.
- V8_EXPORT_PRIVATE static void ClearSharedHeapForTest();
-
// Extends the read-only object cache with new zero smi and returns a
// reference to it.
Object* ExtendReadOnlyObjectCache();
@@ -71,14 +76,15 @@ class ReadOnlyHeap final {
private:
// Creates a new read-only heap and attaches it to the provided isolate.
- static ReadOnlyHeap* CreateAndAttachToIsolate(Isolate* isolate);
- // Runs the read-only deserailizer and calls InitFromIsolate to complete
+ static ReadOnlyHeap* CreateAndAttachToIsolate(
+ Isolate* isolate, std::shared_ptr<ReadOnlyArtifacts> artifacts);
+ // Runs the read-only deserializer and calls InitFromIsolate to complete
// read-only heap initialization.
void DeseralizeIntoIsolate(Isolate* isolate, ReadOnlyDeserializer* des);
// Initializes read-only heap from an already set-up isolate, copying
// read-only roots from the isolate. This then seals the space off from
- // further writes, marks it as read-only and detaches it from the heap (unless
- // sharing is disabled).
+ // further writes, marks it as read-only and detaches it from the heap
+ // (unless sharing is disabled).
void InitFromIsolate(Isolate* isolate);
bool init_complete_ = false;