Commit 391f9c25 authored by Igor Sheludko's avatar Igor Sheludko Committed by V8 LUCI CQ

[ext-code-space] Support background compilation

Bug: v8:11880
Change-Id: I557c4d6f83bc3203c115824e26fcb2ecf0473e1a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3308796
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78155}
parent f054a191
...@@ -81,7 +81,10 @@ Handle<CodeDataContainer> FactoryBase<Impl>::NewCodeDataContainer( ...@@ -81,7 +81,10 @@ Handle<CodeDataContainer> FactoryBase<Impl>::NewCodeDataContainer(
SKIP_WRITE_BARRIER); SKIP_WRITE_BARRIER);
data_container.set_kind_specific_flags(flags, kRelaxedStore); data_container.set_kind_specific_flags(flags, kRelaxedStore);
if (V8_EXTERNAL_CODE_SPACE_BOOL) { if (V8_EXTERNAL_CODE_SPACE_BOOL) {
impl()->SetExternalCodeSpaceInDataContainer(data_container); Isolate* isolate_for_heap_sandbox = impl()->isolate_for_heap_sandbox();
data_container.AllocateExternalPointerEntries(isolate_for_heap_sandbox);
data_container.set_raw_code(Smi::zero(), SKIP_WRITE_BARRIER);
data_container.set_code_entry_point(isolate_for_heap_sandbox, kNullAddress);
} }
data_container.clear_padding(); data_container.clear_padding();
return handle(data_container, isolate()); return handle(data_container, isolate());
......
...@@ -1371,14 +1371,6 @@ void Factory::AddToScriptList(Handle<Script> script) { ...@@ -1371,14 +1371,6 @@ void Factory::AddToScriptList(Handle<Script> script) {
isolate()->heap()->set_script_list(*scripts); isolate()->heap()->set_script_list(*scripts);
} }
void Factory::SetExternalCodeSpaceInDataContainer(
CodeDataContainer data_container) {
DCHECK(V8_EXTERNAL_CODE_SPACE_BOOL);
data_container.AllocateExternalPointerEntries(isolate());
data_container.set_raw_code(Smi::zero(), SKIP_WRITE_BARRIER);
data_container.set_code_entry_point(isolate(), kNullAddress);
}
Handle<Script> Factory::CloneScript(Handle<Script> script) { Handle<Script> Factory::CloneScript(Handle<Script> script) {
Heap* heap = isolate()->heap(); Heap* heap = isolate()->heap();
int script_id = isolate()->GetNextScriptId(); int script_id = isolate()->GetNextScriptId();
......
...@@ -1001,12 +1001,22 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> { ...@@ -1001,12 +1001,22 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> {
// NOLINTNEXTLINE (google-readability-casting) // NOLINTNEXTLINE (google-readability-casting)
return (Isolate*)this; // NOLINT(readability/casting) return (Isolate*)this; // NOLINT(readability/casting)
} }
// This is the real Isolate that will be used for allocating and accessing
// external pointer entries when V8_HEAP_SANDBOX is enabled.
Isolate* isolate_for_heap_sandbox() const {
#ifdef V8_HEAP_SANDBOX
return isolate();
#else
return nullptr;
#endif // V8_HEAP_SANDBOX
}
bool CanAllocateInReadOnlySpace(); bool CanAllocateInReadOnlySpace();
bool EmptyStringRootIsInitialized(); bool EmptyStringRootIsInitialized();
AllocationType AllocationTypeForInPlaceInternalizableString(); AllocationType AllocationTypeForInPlaceInternalizableString();
void AddToScriptList(Handle<Script> shared); void AddToScriptList(Handle<Script> shared);
void SetExternalCodeSpaceInDataContainer(CodeDataContainer data_container);
// ------ // ------
HeapObject AllocateRawWithAllocationSite( HeapObject AllocateRawWithAllocationSite(
......
...@@ -66,19 +66,29 @@ class V8_EXPORT_PRIVATE LocalFactory : public FactoryBase<LocalFactory> { ...@@ -66,19 +66,29 @@ class V8_EXPORT_PRIVATE LocalFactory : public FactoryBase<LocalFactory> {
// NOLINTNEXTLINE (google-readability-casting) // NOLINTNEXTLINE (google-readability-casting)
return (LocalIsolate*)this; // NOLINT(readability/casting) return (LocalIsolate*)this; // NOLINT(readability/casting)
} }
// This is the real Isolate that will be used for allocating and accessing
// external pointer entries when V8_HEAP_SANDBOX is enabled.
Isolate* isolate_for_heap_sandbox() {
#ifdef V8_HEAP_SANDBOX
return isolate_for_heap_sandbox_;
#else
return nullptr;
#endif // V8_HEAP_SANDBOX
}
inline bool CanAllocateInReadOnlySpace() { return false; } inline bool CanAllocateInReadOnlySpace() { return false; }
inline bool EmptyStringRootIsInitialized() { return true; } inline bool EmptyStringRootIsInitialized() { return true; }
inline AllocationType AllocationTypeForInPlaceInternalizableString(); inline AllocationType AllocationTypeForInPlaceInternalizableString();
// ------ // ------
void AddToScriptList(Handle<Script> shared); void AddToScriptList(Handle<Script> shared);
void SetExternalCodeSpaceInDataContainer(CodeDataContainer data_container) {
UNREACHABLE();
}
// ------ // ------
ReadOnlyRoots roots_; ReadOnlyRoots roots_;
#ifdef V8_HEAP_SANDBOX
Isolate* isolate_for_heap_sandbox_;
#endif
#ifdef DEBUG #ifdef DEBUG
bool a_script_was_added_to_the_script_list_ = false; bool a_script_was_added_to_the_script_list_ = false;
#endif #endif
......
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