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

[baseline] Fix large code object check when compiling on heap

- Fixes the size check to include Code::kHeaderSize.
- Adds a DCHECK in NewEmptyCode.

Bug: v8:11872
Change-Id: I05156bbe42e7efa8aa0e1982c9e2166d7b09ef5b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3015055
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75643}
parent 05fe0462
......@@ -257,7 +257,8 @@ std::unique_ptr<AssemblerBuffer> AllocateBuffer(
// TODO(victorgomes): When compiling on heap, we allocate whatever is left
// over on the page with a minimum of the estimated_size.
if (code_location == BaselineCompiler::kOnHeap &&
estimated_size < heap->MaxRegularHeapObjectSize(AllocationType::kCode)) {
Code::SizeFor(estimated_size) <
heap->MaxRegularHeapObjectSize(AllocationType::kCode)) {
// TODO(victorgomes): We're currently underestimating the size of the
// buffer, since we don't know how big the reloc info will be. We could
// use a separate zone vector for the RelocInfo.
......
......@@ -344,6 +344,7 @@ MaybeHandle<Code> Factory::NewEmptyCode(CodeKind kind, int buffer_size) {
!V8_ENABLE_THIRD_PARTY_HEAP_BOOL && !heap->code_region().is_empty(),
heap->code_region().contains(code->address()));
DCHECK(heap->code_space()->Contains(raw_code));
return code;
}
......
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