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

[baseline] Adds VerifyRelocInfo

Adds a verification step when we're compiling on heap.

Bug: v8:11872
Change-Id: Ic71dc2b54e667ed4d5d861b4b9c1e1c2362f9821
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3013936
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/master@{#75630}
parent 8d3c8093
...@@ -297,6 +297,10 @@ void Factory::CodeBuilder::FinalizeOnHeapCode(Handle<Code> code, ...@@ -297,6 +297,10 @@ void Factory::CodeBuilder::FinalizeOnHeapCode(Handle<Code> code,
code->CopyRelocInfoToByteArray(reloc_info, code_desc_); code->CopyRelocInfoToByteArray(reloc_info, code_desc_);
#ifdef VERIFY_HEAP
code->VerifyRelocInfo(isolate_, reloc_info);
#endif
int old_object_size = Code::SizeFor(code_desc_.origin->buffer_size()); int old_object_size = Code::SizeFor(code_desc_.origin->buffer_size());
int new_object_size = int new_object_size =
Code::SizeFor(code_desc_.instruction_size() + code_desc_.metadata_size()); Code::SizeFor(code_desc_.instruction_size() + code_desc_.metadata_size());
......
...@@ -139,6 +139,15 @@ void Code::RelocateFromDesc(ByteArray reloc_info, Heap* heap, ...@@ -139,6 +139,15 @@ void Code::RelocateFromDesc(ByteArray reloc_info, Heap* heap,
} }
} }
#ifdef VERIFY_HEAP
void Code::VerifyRelocInfo(Isolate* isolate, ByteArray reloc_info) {
const int mode_mask = RelocInfo::PostCodegenRelocationMask();
for (RelocIterator it(*this, reloc_info, mode_mask); !it.done(); it.next()) {
it.rinfo()->Verify(isolate);
}
}
#endif
SafepointEntry Code::GetSafepointEntry(Isolate* isolate, Address pc) { SafepointEntry Code::GetSafepointEntry(Isolate* isolate, Address pc) {
SafepointTable table(isolate, pc, *this); SafepointTable table(isolate, pc, *this);
return table.FindEntry(pc); return table.FindEntry(pc);
......
...@@ -438,6 +438,10 @@ class Code : public HeapObject { ...@@ -438,6 +438,10 @@ class Code : public HeapObject {
void CopyFromNoFlush(ByteArray reloc_info, Heap* heap, const CodeDesc& desc); void CopyFromNoFlush(ByteArray reloc_info, Heap* heap, const CodeDesc& desc);
void RelocateFromDesc(ByteArray reloc_info, Heap* heap, const CodeDesc& desc); void RelocateFromDesc(ByteArray reloc_info, Heap* heap, const CodeDesc& desc);
#ifdef VERIFY_HEAP
void VerifyRelocInfo(Isolate* isolate, ByteArray reloc_info);
#endif
// Copy the RelocInfo portion of |desc| to |dest|. The ByteArray must be // Copy the RelocInfo portion of |desc| to |dest|. The ByteArray must be
// exactly the same size as the RelocInfo in |desc|. // exactly the same size as the RelocInfo in |desc|.
static inline void CopyRelocInfoToByteArray(ByteArray dest, static inline void CopyRelocInfoToByteArray(ByteArray dest,
......
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