// Copyright 2024 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_INIT_ISOLATE_GROUP_H_ #define V8_INIT_ISOLATE_GROUP_H_ #include <memory> #include "include/v8-memory-span.h" #include "src/base/once.h" #include "src/base/page-allocator.h" #include "src/codegen/external-reference-table.h" #include "src/common/globals.h" #include "src/flags/flags.h" #include "src/utils/allocation.h" namespace v8 { namespace base { template <typename T> class LeakyObject; } // namespace base namespace internal { #ifdef V8_ENABLE_SANDBOX class Sandbox; #endif class CodeRange; // An IsolateGroup allows an API user to control which isolates get allocated // together in a shared pointer cage. // // The standard configuration of V8 is to enable pointer compression and to // allocate all isolates in a single shared pointer cage // (V8_COMPRESS_POINTERS_IN_SHARED_CAGE). This also enables the sandbox // (V8_ENABLE_SANDBOX), of which there can currently be only one per process, as // it requires a large part of the virtual address space. // // The standard configuration comes with a limitation, in that the total size of // the compressed pointer cage is limited to 4 GB. Some API users would like // pointer compression but also want to avoid the 4 GB limit of the shared // pointer cage. Isolate groups allow users to declare which isolates should be // co-located in a single pointer cage. // // Isolate groups are useful only if pointer compression is enabled. Otherwise, // the isolate could just allocate pages from the global system allocator; // there's no need to stay within any particular address range. If pointer // compression is disabled, isolate groups are a no-op. // // Note that JavaScript objects can only be passed between isolates of the same // group. Ensuring this invariant is the responsibility of the API user. class V8_EXPORT_PRIVATE IsolateGroup final { … }; } // namespace internal } // namespace v8 #endif // V8_INIT_ISOLATE_GROUP_H_