Commit 959d67e1 authored by Samuel Groß's avatar Samuel Groß Committed by V8 LUCI CQ

[sandbox] Properly initialize LocalFactory::isolate_for_sandbox

This is required when allocating external pointer table entries from
background threads through the LocalFactory interface.

Bug: v8:10391
Change-Id: Ice5eee1000e1c7341bd0e58782cbb175080a5a74
Cq-Include-Trybots: luci.v8.try:v8_linux64_heap_sandbox_dbg_ng,v8_linux_arm64_sim_heap_sandbox_dbg_ng
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3448376Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Samuel Groß <saelo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79010}
parent aa83ce1e
......@@ -82,10 +82,10 @@ Handle<CodeDataContainer> FactoryBase<Impl>::NewCodeDataContainer(
data_container.set_kind_specific_flags(flags, kRelaxedStore);
if (V8_EXTERNAL_CODE_SPACE_BOOL) {
data_container.set_code_cage_base(impl()->isolate()->code_cage_base());
Isolate* isolate_for_heap_sandbox = impl()->isolate_for_heap_sandbox();
data_container.AllocateExternalPointerEntries(isolate_for_heap_sandbox);
Isolate* isolate_for_sandbox = impl()->isolate_for_sandbox();
data_container.AllocateExternalPointerEntries(isolate_for_sandbox);
data_container.set_raw_code(Smi::zero(), SKIP_WRITE_BARRIER);
data_container.set_code_entry_point(isolate_for_heap_sandbox, kNullAddress);
data_container.set_code_entry_point(isolate_for_sandbox, kNullAddress);
}
data_container.clear_padding();
return handle(data_container, isolate());
......
......@@ -1021,7 +1021,7 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> {
// This is the real Isolate that will be used for allocating and accessing
// external pointer entries when V8_SANDBOXED_EXTERNAL_POINTERS is enabled.
Isolate* isolate_for_heap_sandbox() const {
Isolate* isolate_for_sandbox() const {
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
return isolate();
#else
......
......@@ -19,7 +19,12 @@
namespace v8 {
namespace internal {
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
LocalFactory::LocalFactory(Isolate* isolate)
: roots_(isolate), isolate_for_sandbox_(isolate) {}
#else
LocalFactory::LocalFactory(Isolate* isolate) : roots_(isolate) {}
#endif
void LocalFactory::AddToScriptList(Handle<Script> shared) {
// TODO(leszeks): Actually add the script to the main Isolate's script list,
......
......@@ -66,9 +66,9 @@ class V8_EXPORT_PRIVATE LocalFactory : public FactoryBase<LocalFactory> {
// This is the real Isolate that will be used for allocating and accessing
// external pointer entries when V8_SANDBOXED_EXTERNAL_POINTERS is enabled.
Isolate* isolate_for_heap_sandbox() {
Isolate* isolate_for_sandbox() {
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
return isolate_for_heap_sandbox_;
return isolate_for_sandbox_;
#else
return nullptr;
#endif // V8_SANDBOXED_EXTERNAL_POINTERS
......@@ -84,7 +84,7 @@ class V8_EXPORT_PRIVATE LocalFactory : public FactoryBase<LocalFactory> {
ReadOnlyRoots roots_;
#ifdef V8_SANDBOXED_EXTERNAL_POINTERS
Isolate* isolate_for_heap_sandbox_;
Isolate* isolate_for_sandbox_;
#endif
#ifdef DEBUG
bool a_script_was_added_to_the_script_list_ = false;
......
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