PPC: [wasm] Relocatable Globals.

Port 2d1f977c93

Original commit message:

    Support for relocatable globals, to facilitate compilation before
    instantiation.

R=mtrofin@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, mbrandy@us.ibm.com

BUG=v8:5072
LOG=N

Review-Url: https://codereview.chromium.org/2069163003
Cr-Commit-Position: refs/heads/master@{#37021}
This commit is contained in:
bjaideep 2016-06-15 22:37:57 -07:00 committed by Commit bot
parent daf462a61b
commit aa2e6a73ae
2 changed files with 20 additions and 1 deletions

View File

@ -1992,6 +1992,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
if (src.rmode() == RelocInfo::WASM_MEMORY_SIZE_REFERENCE) {
#else
if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE ||
src.rmode() == RelocInfo::WASM_GLOBAL_REFERENCE ||
src.rmode() == RelocInfo::WASM_MEMORY_SIZE_REFERENCE) {
#endif
__ mov(dst, Operand(src.ToInt32(), src.rmode()));
@ -2001,7 +2002,8 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
break;
case Constant::kInt64:
#if V8_TARGET_ARCH_PPC64
if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE) {
if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE ||
src.rmode() == RelocInfo::WASM_GLOBAL_REFERENCE) {
__ mov(dst, Operand(src.ToInt64(), src.rmode()));
} else {
DCHECK(src.rmode() != RelocInfo::WASM_MEMORY_SIZE_REFERENCE);

View File

@ -166,6 +166,12 @@ uint32_t RelocInfo::wasm_memory_size_reference() {
reinterpret_cast<intptr_t>(Assembler::target_address_at(pc_, host_)));
}
Address RelocInfo::wasm_global_reference() {
DCHECK(IsWasmGlobalReference(rmode_));
return Assembler::target_address_at(pc_, host_);
}
void RelocInfo::update_wasm_memory_reference(
Address old_base, Address new_base, uint32_t old_size, uint32_t new_size,
ICacheFlushMode icache_flush_mode) {
@ -193,6 +199,17 @@ 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);
Assembler::set_target_address_at(isolate_, pc_, host_, updated_reference,
icache_flush_mode);
}
// -----------------------------------------------------------------------------
// Implementation of Operand and MemOperand
// See assembler-ppc-inl.h for inlined constructors