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

[baseline] Use CodeBuilder:TryBuild to handle on heap compilation

Bug: v8:11872
Change-Id: Ibd26b025fc5eb12d90c3a1c932bd9b8473612016
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2978254Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75329}
parent 151668b9
...@@ -322,20 +322,9 @@ MaybeHandle<Code> BaselineCompiler::Build(Isolate* isolate) { ...@@ -322,20 +322,9 @@ MaybeHandle<Code> BaselineCompiler::Build(Isolate* isolate) {
// Allocate the bytecode offset table. // Allocate the bytecode offset table.
Handle<ByteArray> bytecode_offset_table = Handle<ByteArray> bytecode_offset_table =
bytecode_offset_table_builder_.ToBytecodeOffsetTable(isolate); bytecode_offset_table_builder_.ToBytecodeOffsetTable(isolate);
if (masm_.IsOnHeap()) { return Factory::CodeBuilder(isolate, desc, CodeKind::BASELINE)
// We compiled on heap, we need to finalise the code object fields. .set_bytecode_offset_table(bytecode_offset_table)
DCHECK(FLAG_sparkplug_on_heap); .TryBuild();
// TODO(victorgomes): Use CodeDesc to handle on-heap-ness.
// We can then simply call TryBuild() here.
return Factory::CodeBuilder(isolate, desc, CodeKind::BASELINE)
.set_bytecode_offset_table(bytecode_offset_table)
.FinishBaselineCode(masm_.code().ToHandleChecked(),
masm_.buffer_size());
} else {
return Factory::CodeBuilder(isolate, desc, CodeKind::BASELINE)
.set_bytecode_offset_table(bytecode_offset_table)
.TryBuild();
}
} }
int BaselineCompiler::EstimateInstructionSize(BytecodeArray bytecode) { int BaselineCompiler::EstimateInstructionSize(BytecodeArray bytecode) {
......
This diff is collapsed.
...@@ -845,9 +845,6 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> { ...@@ -845,9 +845,6 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> {
// Like Build, builds a new code object. May return an empty handle if the // Like Build, builds a new code object. May return an empty handle if the
// allocation fails. // allocation fails.
V8_WARN_UNUSED_RESULT MaybeHandle<Code> TryBuild(); V8_WARN_UNUSED_RESULT MaybeHandle<Code> TryBuild();
// Expects a baseline code object and finalizes all its fields.
V8_WARN_UNUSED_RESULT Handle<Code> FinishBaselineCode(Handle<Code> code,
int buffer_size);
// Sets the self-reference object in which a reference to the code object is // Sets the self-reference object in which a reference to the code object is
// stored. This allows generated code to reference its own Code object by // stored. This allows generated code to reference its own Code object by
...@@ -930,8 +927,8 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> { ...@@ -930,8 +927,8 @@ class V8_EXPORT_PRIVATE Factory : public FactoryBase<Factory> {
private: private:
MaybeHandle<Code> BuildInternal(bool retry_allocation_or_fail); MaybeHandle<Code> BuildInternal(bool retry_allocation_or_fail);
void SetCodeFields(Code raw_code, Handle<ByteArray> reloc_info, MaybeHandle<Code> AllocateCode(bool retry_allocation_or_fail);
Handle<CodeDataContainer> data_container); void FinalizeOnHeapCode(Handle<Code> code);
Isolate* const isolate_; Isolate* const isolate_;
const CodeDesc& code_desc_; const CodeDesc& code_desc_;
......
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