Commit 6f16737f authored by Pierre Langlois's avatar Pierre Langlois Committed by V8 LUCI CQ

[arm64] Fix BlockPoolsScope when generating debug messages.

When running with the simulator, Assembler::debug() can record an inline
comment to be printed when the simulator encounters it. We need to make
sure pools are not emitted while the comment is recorded in the code
stream.

However the BlockPoolsScope was missing its margin argument to tell it
how much code we're going to generate, and could forget to emit pools
when it should have, causing crashes later on when a branch cannot jump
over the code comment.

Bug: v8:12637
Change-Id: I39e50f176d87c781c865b81fb9aca57d69c8c019
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3494544Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
Cr-Commit-Position: refs/heads/main@{#79317}
parent f1f7cafe
......@@ -3696,9 +3696,12 @@ void Assembler::EmitStringData(const char* string) {
void Assembler::debug(const char* message, uint32_t code, Instr params) {
if (options().enable_simulator_code) {
size_t size_of_debug_sequence =
4 * kInstrSize + RoundUp<kInstrSize>(strlen(message) + 1);
// The arguments to the debug marker need to be contiguous in memory, so
// make sure we don't try to emit pools.
BlockPoolsScope scope(this);
BlockPoolsScope scope(this, size_of_debug_sequence);
Label start;
bind(&start);
......@@ -3713,6 +3716,7 @@ void Assembler::debug(const char* message, uint32_t code, Instr params) {
DCHECK_EQ(SizeOfCodeGeneratedSince(&start), kDebugMessageOffset);
EmitStringData(message);
hlt(kImmExceptionIsUnreachable);
DCHECK_EQ(SizeOfCodeGeneratedSince(&start), size_of_debug_sequence);
return;
}
......
......@@ -185,9 +185,6 @@
'test-api/ExternalArrays': [PASS, SLOW],
'test-api/Threading*': [SKIP],
'test-cpu-profiler/MultipleIsolates': [PASS, ['not pointer_compression', SLOW]],
# https://crbug.com/v8/12637
'test-code-generator/FuzzAssemble*': [SKIP],
}], # 'arch == arm64 and simulator_run'
['arch == arm64 and system == macos and not simulator_run', {
......
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