Index: src/ia32/assembler-ia32.cc |
diff --git a/src/ia32/assembler-ia32.cc b/src/ia32/assembler-ia32.cc |
index fac2d66bcdfea30db13eb66d1cbffe840c7199c9..e6f1d83cb59c2d1a15fb69ceb0ffabfd430547dc 100644 |
--- a/src/ia32/assembler-ia32.cc |
+++ b/src/ia32/assembler-ia32.cc |
@@ -186,6 +186,42 @@ bool RelocInfo::IsInConstantPool() { |
return false; |
} |
+Address RelocInfo::wasm_memory_reference() { |
+ DCHECK(IsWasmMemoryReference(rmode_)); |
+ return Memory::Address_at(pc_); |
+} |
+ |
+uint32_t RelocInfo::wasm_memory_size_reference() { |
+ DCHECK(IsWasmMemorySizeReference(rmode_)); |
+ return Memory::uint32_at(pc_); |
+} |
+ |
+void RelocInfo::update_wasm_memory_reference( |
+ Address old_base, Address new_base, uint32_t old_size, uint32_t new_size, |
+ ICacheFlushMode icache_flush_mode) { |
+ DCHECK(IsWasmMemoryReference(rmode_) || IsWasmMemorySizeReference(rmode_)); |
+ if (IsWasmMemoryReference(rmode_)) { |
+ Address updated_reference; |
+ DCHECK(old_base <= wasm_memory_reference() && |
+ wasm_memory_reference() < old_base + old_size); |
+ updated_reference = new_base + (wasm_memory_reference() - old_base); |
+ DCHECK(new_base <= updated_reference && |
+ updated_reference < new_base + new_size); |
+ Memory::Address_at(pc_) = updated_reference; |
+ } else if (IsWasmMemorySizeReference(rmode_)) { |
+ uint32_t updated_size_reference; |
+ DCHECK(wasm_memory_size_reference() <= old_size); |
+ updated_size_reference = |
+ new_size + (wasm_memory_size_reference() - old_size); |
+ DCHECK(updated_size_reference <= new_size); |
+ Memory::uint32_at(pc_) = updated_size_reference; |
+ } else { |
+ UNREACHABLE(); |
+ } |
+ if (icache_flush_mode != SKIP_ICACHE_FLUSH) { |
+ Assembler::FlushICache(isolate_, pc_, sizeof(int32_t)); |
+ } |
+} |
// ----------------------------------------------------------------------------- |
// Implementation of Operand |