File tree 4 files changed +23
-6
lines changed
4 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -465,7 +465,8 @@ MultiIsolatePlatform* CreatePlatform(
465
465
MultiIsolatePlatform* CreatePlatform (
466
466
int thread_pool_size,
467
467
v8::TracingController* tracing_controller) {
468
- return MultiIsolatePlatform::Create (thread_pool_size, tracing_controller)
468
+ return MultiIsolatePlatform::Create (thread_pool_size,
469
+ tracing_controller)
469
470
.release ();
470
471
}
471
472
@@ -475,8 +476,11 @@ void FreePlatform(MultiIsolatePlatform* platform) {
475
476
476
477
std::unique_ptr<MultiIsolatePlatform> MultiIsolatePlatform::Create (
477
478
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);
480
484
}
481
485
482
486
MaybeLocal<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 {
310
310
311
311
static std::unique_ptr<MultiIsolatePlatform> Create (
312
312
int thread_pool_size,
313
- v8::TracingController* tracing_controller = nullptr );
313
+ v8::TracingController* tracing_controller = nullptr ,
314
+ v8::PageAllocator* page_allocator = nullptr );
314
315
};
315
316
316
317
enum IsolateSettingsFlags {
Original file line number Diff line number Diff line change @@ -324,12 +324,17 @@ void PerIsolatePlatformData::DecreaseHandleCount() {
324
324
}
325
325
326
326
NodePlatform::NodePlatform (int thread_pool_size,
327
- v8::TracingController* tracing_controller) {
327
+ v8::TracingController* tracing_controller,
328
+ v8::PageAllocator* page_allocator) {
328
329
if (tracing_controller != nullptr ) {
329
330
tracing_controller_ = tracing_controller;
330
331
} else {
331
332
tracing_controller_ = new v8::TracingController ();
332
333
}
334
+
335
+ // V8 will default to its built in allocator if none is provided.
336
+ page_allocator_ = page_allocator;
337
+
333
338
// TODO(addaleax): It's a bit icky that we use global state here, but we can't
334
339
// really do anything about it unless V8 starts exposing a way to access the
335
340
// current v8::Platform instance.
@@ -550,6 +555,10 @@ Platform::StackTracePrinter NodePlatform::GetStackTracePrinter() {
550
555
};
551
556
}
552
557
558
+ v8::PageAllocator* NodePlatform::GetPageAllocator () {
559
+ return page_allocator_;
560
+ }
561
+
553
562
template <class T >
554
563
TaskQueue<T>::TaskQueue()
555
564
: lock_(), tasks_available_(), tasks_drained_(),
Original file line number Diff line number Diff line change @@ -138,7 +138,8 @@ class WorkerThreadsTaskRunner {
138
138
class NodePlatform : public MultiIsolatePlatform {
139
139
public:
140
140
NodePlatform (int thread_pool_size,
141
- v8::TracingController* tracing_controller);
141
+ v8::TracingController* tracing_controller,
142
+ v8::PageAllocator* page_allocator = nullptr );
142
143
~NodePlatform () override ;
143
144
144
145
void DrainTasks (v8::Isolate* isolate) override ;
@@ -170,6 +171,7 @@ class NodePlatform : public MultiIsolatePlatform {
170
171
v8::Isolate* isolate) override ;
171
172
172
173
Platform::StackTracePrinter GetStackTracePrinter () override ;
174
+ v8::PageAllocator* GetPageAllocator () override ;
173
175
174
176
private:
175
177
IsolatePlatformDelegate* ForIsolate (v8::Isolate* isolate);
@@ -181,6 +183,7 @@ class NodePlatform : public MultiIsolatePlatform {
181
183
std::unordered_map<v8::Isolate*, DelegatePair> per_isolate_;
182
184
183
185
v8::TracingController* tracing_controller_;
186
+ v8::PageAllocator* page_allocator_;
184
187
std::shared_ptr<WorkerThreadsTaskRunner> worker_thread_task_runner_;
185
188
bool has_shut_down_ = false ;
186
189
};
You can’t perform that action at this time.
0 commit comments