Commit d909af08 authored by Victor Gomes's avatar Victor Gomes Committed by V8 LUCI CQ

[baseline] Allow concurrent code allocation to fail

Drive-by: Use only LocalIsolate in AllocateConcurrentSP

Bug: v8:12054
Change-Id: Ibdd8b562548f249fc2be4dca723ce4fedc7c09ad
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3240783
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77520}
parent 0996db8b
......@@ -71,6 +71,7 @@
#include "src/wasm/wasm-value.h"
#endif
#include "src/heap/local-factory-inl.h"
#include "src/heap/local-heap-inl.h"
namespace v8 {
......@@ -300,14 +301,16 @@ MaybeHandle<Code> Factory::CodeBuilder::AllocateConcurrentSparkplugCode(
? AllocationType::kCode
: AllocationType::kReadOnly;
const int object_size = Code::SizeFor(code_desc_.body_size());
HeapObject result =
heap->AllocateRaw(object_size, allocation_type).ToObject();
HeapObject result;
if (!heap->AllocateRaw(object_size, allocation_type).To(&result)) {
return MaybeHandle<Code>();
}
CHECK(!result.is_null());
// The code object has not been fully initialized yet. We rely on the
// fact that no allocation will happen from this point on.
DisallowGarbageCollection no_gc;
result.set_map_after_allocation(*isolate_->factory()->code_map(),
result.set_map_after_allocation(*local_isolate_->factory()->code_map(),
SKIP_WRITE_BARRIER);
Handle<Code> code = handle(Code::cast(result), local_isolate_);
DCHECK_IMPLIES(is_executable_, IsAligned(code->address(), kCodeAlignment));
......
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