[assembler] [wasm] Don't flush the icache twice
Several code patching paths actually flushed the icache twice. This CL removes all icache flushing on wasm updates from assembler.cc and pushes it into the platform specific unchecked_update_wasm_size and unchecked_update_wasm_memory_reference methods. They were already receiving the ICacheFlushMode, and on some platforms would already perform the flush. R=ahaas@chromium.org Change-Id: I388701f13d733cb5387d5bed4dbed33879179a91 Reviewed-on: https://chromium-review.googlesource.com/450246 Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Reviewed-by: Andreas Haas <ahaas@chromium.org> Reviewed-by: Georg Neis <neis@chromium.org> Cr-Commit-Position: refs/heads/master@{#43635}
This commit is contained in:
parent
ab47148421
commit
83b96b5832
@ -207,6 +207,7 @@ void RelocInfo::unchecked_update_wasm_memory_reference(
|
||||
void RelocInfo::unchecked_update_wasm_size(uint32_t size,
|
||||
ICacheFlushMode flush_mode) {
|
||||
Memory::uint32_at(Assembler::target_pointer_address_at(pc_)) = size;
|
||||
// No icache flushing needed, see comment in set_target_address_at.
|
||||
}
|
||||
|
||||
Register GetAllocatableRegisterThatIsNotOneOf(Register reg1, Register reg2,
|
||||
|
@ -315,9 +315,6 @@ void RelocInfo::update_wasm_memory_reference(
|
||||
// The reference is not checked here but at runtime. Validity of references
|
||||
// may change over time.
|
||||
unchecked_update_wasm_memory_reference(updated_reference, icache_flush_mode);
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
Assembler::FlushICache(isolate_, pc_, sizeof(int64_t));
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::update_wasm_memory_size(uint32_t old_size, uint32_t new_size,
|
||||
@ -327,24 +324,16 @@ void RelocInfo::update_wasm_memory_size(uint32_t old_size, uint32_t new_size,
|
||||
uint32_t updated_size_reference =
|
||||
new_size + (current_size_reference - old_size);
|
||||
unchecked_update_wasm_size(updated_size_reference, icache_flush_mode);
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
Assembler::FlushICache(isolate_, pc_, sizeof(int64_t));
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::update_wasm_global_reference(
|
||||
Address old_base, Address new_base, ICacheFlushMode icache_flush_mode) {
|
||||
DCHECK(IsWasmGlobalReference(rmode_));
|
||||
Address updated_reference;
|
||||
DCHECK(reinterpret_cast<uintptr_t>(old_base) <=
|
||||
reinterpret_cast<uintptr_t>(wasm_global_reference()));
|
||||
DCHECK_LE(old_base, wasm_global_reference());
|
||||
updated_reference = new_base + (wasm_global_reference() - old_base);
|
||||
DCHECK(reinterpret_cast<uintptr_t>(new_base) <=
|
||||
reinterpret_cast<uintptr_t>(updated_reference));
|
||||
DCHECK_LE(new_base, updated_reference);
|
||||
unchecked_update_wasm_memory_reference(updated_reference, icache_flush_mode);
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
Assembler::FlushICache(isolate_, pc_, sizeof(int32_t));
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::update_wasm_function_table_size_reference(
|
||||
@ -354,9 +343,6 @@ void RelocInfo::update_wasm_function_table_size_reference(
|
||||
uint32_t updated_size_reference =
|
||||
new_size + (current_size_reference - old_size);
|
||||
unchecked_update_wasm_size(updated_size_reference, icache_flush_mode);
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
Assembler::FlushICache(isolate_, pc_, sizeof(int64_t));
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::set_target_address(Address target,
|
||||
|
@ -207,13 +207,19 @@ uint32_t RelocInfo::wasm_function_table_size_reference() {
|
||||
}
|
||||
|
||||
void RelocInfo::unchecked_update_wasm_memory_reference(
|
||||
Address address, ICacheFlushMode flush_mode) {
|
||||
Address address, ICacheFlushMode icache_flush_mode) {
|
||||
Memory::Address_at(pc_) = address;
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
Assembler::FlushICache(isolate_, pc_, sizeof(Address));
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::unchecked_update_wasm_size(uint32_t size,
|
||||
ICacheFlushMode flush_mode) {
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
Memory::uint32_at(pc_) = size;
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
Assembler::FlushICache(isolate_, pc_, sizeof(uint32_t));
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -143,13 +143,19 @@ uint32_t RelocInfo::wasm_function_table_size_reference() {
|
||||
}
|
||||
|
||||
void RelocInfo::unchecked_update_wasm_memory_reference(
|
||||
Address address, ICacheFlushMode flush_mode) {
|
||||
Address address, ICacheFlushMode icache_flush_mode) {
|
||||
Memory::Address_at(pc_) = address;
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
Assembler::FlushICache(isolate_, pc_, sizeof(Address));
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::unchecked_update_wasm_size(uint32_t size,
|
||||
ICacheFlushMode flush_mode) {
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
Memory::uint32_at(pc_) = size;
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
Assembler::FlushICache(isolate_, pc_, sizeof(uint32_t));
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
@ -122,13 +122,19 @@ uint32_t RelocInfo::wasm_function_table_size_reference() {
|
||||
}
|
||||
|
||||
void RelocInfo::unchecked_update_wasm_memory_reference(
|
||||
Address address, ICacheFlushMode flush_mode) {
|
||||
Address address, ICacheFlushMode icache_flush_mode) {
|
||||
Memory::Address_at(pc_) = address;
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
Assembler::FlushICache(isolate_, pc_, sizeof(Address));
|
||||
}
|
||||
}
|
||||
|
||||
void RelocInfo::unchecked_update_wasm_size(uint32_t size,
|
||||
ICacheFlushMode flush_mode) {
|
||||
ICacheFlushMode icache_flush_mode) {
|
||||
Memory::uint32_at(pc_) = size;
|
||||
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
|
||||
Assembler::FlushICache(isolate_, pc_, sizeof(uint32_t));
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user