File tree Expand file tree Collapse file tree 4 files changed +23
-6
lines changed
Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -465,7 +465,8 @@ MultiIsolatePlatform* CreatePlatform(
465465MultiIsolatePlatform* CreatePlatform (
466466 int thread_pool_size,
467467 v8::TracingController* tracing_controller) {
468- return MultiIsolatePlatform::Create (thread_pool_size, tracing_controller)
468+ return MultiIsolatePlatform::Create (thread_pool_size,
469+ tracing_controller)
469470 .release ();
470471}
471472
@@ -475,8 +476,11 @@ void FreePlatform(MultiIsolatePlatform* platform) {
475476
476477std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create (
477478 int thread_pool_size,
478- v8::TracingController* tracing_controller) {
479- return std::make_unique<NodePlatform>(thread_pool_size, tracing_controller);
479+ v8::TracingController* tracing_controller,
480+ v8::PageAllocator* page_allocator) {
481+ return std::make_unique<NodePlatform>(thread_pool_size,
482+ tracing_controller,
483+ page_allocator);
480484}
481485
482486MaybeLocal<Object> GetPerContextExports (Local<Context> context) {
Original file line number Diff line number Diff line change @@ -310,7 +310,8 @@ class NODE_EXTERN MultiIsolatePlatform : public v8::Platform {
310310
311311 static std::unique_ptr<MultiIsolatePlatform> Create (
312312 int thread_pool_size,
313- v8::TracingController* tracing_controller = nullptr );
313+ v8::TracingController* tracing_controller = nullptr ,
314+ v8::PageAllocator* page_allocator = nullptr );
314315};
315316
316317enum IsolateSettingsFlags {
Original file line number Diff line number Diff line change @@ -324,12 +324,17 @@ void PerIsolatePlatformData::DecreaseHandleCount() {
324324}
325325
326326NodePlatform::NodePlatform (int thread_pool_size,
327- v8::TracingController* tracing_controller) {
327+ v8::TracingController* tracing_controller,
328+ v8::PageAllocator* page_allocator) {
328329 if (tracing_controller != nullptr ) {
329330 tracing_controller_ = tracing_controller;
330331 } else {
331332 tracing_controller_ = new v8::TracingController ();
332333 }
334+
335+ // V8 will default to its built in allocator if none is provided.
336+ page_allocator_ = page_allocator;
337+
333338 // TODO(addaleax): It's a bit icky that we use global state here, but we can't
334339 // really do anything about it unless V8 starts exposing a way to access the
335340 // current v8::Platform instance.
@@ -550,6 +555,10 @@ Platform::StackTracePrinter NodePlatform::GetStackTracePrinter() {
550555 };
551556}
552557
558+ v8::PageAllocator* NodePlatform::GetPageAllocator () {
559+ return page_allocator_;
560+ }
561+
553562template <class T >
554563TaskQueue<T>::TaskQueue()
555564 : lock_(), tasks_available_(), tasks_drained_(),
Original file line number Diff line number Diff line change @@ -138,7 +138,8 @@ class WorkerThreadsTaskRunner {
138138class NodePlatform : public MultiIsolatePlatform {
139139 public:
140140 NodePlatform (int thread_pool_size,
141- v8::TracingController* tracing_controller);
141+ v8::TracingController* tracing_controller,
142+ v8::PageAllocator* page_allocator = nullptr );
142143 ~NodePlatform () override ;
143144
144145 void DrainTasks (v8::Isolate* isolate) override ;
@@ -170,6 +171,7 @@ class NodePlatform : public MultiIsolatePlatform {
170171 v8::Isolate* isolate) override ;
171172
172173 Platform::StackTracePrinter GetStackTracePrinter () override ;
174+ v8::PageAllocator* GetPageAllocator () override ;
173175
174176 private:
175177 IsolatePlatformDelegate* ForIsolate (v8::Isolate* isolate);
@@ -181,6 +183,7 @@ class NodePlatform : public MultiIsolatePlatform {
181183 std::unordered_map<v8::Isolate*, DelegatePair> per_isolate_;
182184
183185 v8::TracingController* tracing_controller_;
186+ v8::PageAllocator* page_allocator_;
184187 std::shared_ptr<WorkerThreadsTaskRunner> worker_thread_task_runner_;
185188 bool has_shut_down_ = false ;
186189};
You can’t perform that action at this time.
0 commit comments