Commit 877e428f authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [wasm] Relocatable Globals.

  port 2d1f977c (r36978)

  original commit message:
  Support for relocatable globals, to facilitate compilation before
  instantiation.

BUG=

Review-Url: https://codereview.chromium.org/2096273002
Cr-Commit-Position: refs/heads/master@{#37266}
parent d0607218
......@@ -61,6 +61,7 @@ class X87OperandConverter : public InstructionOperandConverter {
Constant constant = ToConstant(operand);
if (constant.type() == Constant::kInt32 &&
(constant.rmode() == RelocInfo::WASM_MEMORY_REFERENCE ||
constant.rmode() == RelocInfo::WASM_GLOBAL_REFERENCE ||
constant.rmode() == RelocInfo::WASM_MEMORY_SIZE_REFERENCE)) {
return Immediate(reinterpret_cast<Address>(constant.ToInt32()),
constant.rmode());
......
......@@ -106,6 +106,11 @@ Address RelocInfo::wasm_memory_reference() {
return Memory::Address_at(pc_);
}
Address RelocInfo::wasm_global_reference() {
DCHECK(IsWasmGlobalReference(rmode_));
return Memory::Address_at(pc_);
}
uint32_t RelocInfo::wasm_memory_size_reference() {
DCHECK(IsWasmMemorySizeReference(rmode_));
return Memory::uint32_at(pc_);
......@@ -138,6 +143,19 @@ void RelocInfo::update_wasm_memory_reference(
}
}
void RelocInfo::update_wasm_global_reference(
Address old_base, Address new_base, ICacheFlushMode icache_flush_mode) {
DCHECK(IsWasmGlobalReference(rmode_));
Address updated_reference;
DCHECK(old_base <= wasm_global_reference());
updated_reference = new_base + (wasm_global_reference() - old_base);
DCHECK(new_base <= updated_reference);
Memory::Address_at(pc_) = updated_reference;
if (icache_flush_mode != SKIP_ICACHE_FLUSH) {
Assembler::FlushICache(isolate_, pc_, sizeof(int32_t));
}
}
// -----------------------------------------------------------------------------
// Implementation of Operand
......
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