[wasm] Try to avoid LTO bug on arm

There seems to be an issue where LTO inlines the icache flushing method
but removes the save and restore of the r7 register which is clobbered
for the icache flush syscall.
This CL tries to avoid the bug. It's purely speculative, as we cannot
reproduce the exact bug locally.

R=jkummerow@chromium.org

Bug: chromium:952759
Change-Id: I634fc4de3e8c4d1cb649384542c381d925b07a42
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1571619
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#60922}
This commit is contained in:
Clemens Hammacher 2019-04-18 14:57:00 +02:00 committed by Commit Bot
parent 28705dfbad
commit 241294fe18

View File

@ -727,9 +727,6 @@ std::unique_ptr<WasmCode> NativeModule::AddCodeWithCodeSpace(
} }
} }
// Flush the i-cache after relocation.
FlushInstructionCache(dst_code_bytes.start(), dst_code_bytes.size());
std::unique_ptr<WasmCode> code{new WasmCode{ std::unique_ptr<WasmCode> code{new WasmCode{
this, index, dst_code_bytes, stack_slots, tagged_parameter_slots, this, index, dst_code_bytes, stack_slots, tagged_parameter_slots,
safepoint_table_offset, handler_table_offset, constant_pool_offset, safepoint_table_offset, handler_table_offset, constant_pool_offset,
@ -740,6 +737,11 @@ std::unique_ptr<WasmCode> NativeModule::AddCodeWithCodeSpace(
code->RegisterTrapHandlerData(); code->RegisterTrapHandlerData();
// Flush the i-cache for the region holding the relocated code.
// Do this last, as this seems to trigger an LTO bug that clobbers a register
// on arm, see https://crbug.com/952759#c6.
FlushInstructionCache(dst_code_bytes.start(), dst_code_bytes.size());
return code; return code;
} }