Commit b60da28c authored by jyan's avatar jyan Committed by Commit bot

S390: [wasm] Relocatable Globals.

Port 2d1f977c

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, bjaideep@ca.ibm.com

BUG=v8:5072
LOG=N

Review-Url: https://codereview.chromium.org/2071883002
Cr-Commit-Position: refs/heads/master@{#37041}
parent a3b6f9bb
...@@ -2001,6 +2001,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source, ...@@ -2001,6 +2001,7 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
if (src.rmode() == RelocInfo::WASM_MEMORY_SIZE_REFERENCE) { if (src.rmode() == RelocInfo::WASM_MEMORY_SIZE_REFERENCE) {
#else #else
if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE || if (src.rmode() == RelocInfo::WASM_MEMORY_REFERENCE ||
src.rmode() == RelocInfo::WASM_GLOBAL_REFERENCE ||
src.rmode() == RelocInfo::WASM_MEMORY_SIZE_REFERENCE) { src.rmode() == RelocInfo::WASM_MEMORY_SIZE_REFERENCE) {
#endif #endif
__ mov(dst, Operand(src.ToInt32(), src.rmode())); __ mov(dst, Operand(src.ToInt32(), src.rmode()));
...@@ -2010,7 +2011,8 @@ void CodeGenerator::AssembleMove(InstructionOperand* source, ...@@ -2010,7 +2011,8 @@ void CodeGenerator::AssembleMove(InstructionOperand* source,
break; break;
case Constant::kInt64: case Constant::kInt64:
#if V8_TARGET_ARCH_S390X #if V8_TARGET_ARCH_S390X
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())); __ mov(dst, Operand(src.ToInt64(), src.rmode()));
} else { } else {
DCHECK(src.rmode() != RelocInfo::WASM_MEMORY_SIZE_REFERENCE); DCHECK(src.rmode() != RelocInfo::WASM_MEMORY_SIZE_REFERENCE);
......
...@@ -228,6 +228,11 @@ uint32_t RelocInfo::wasm_memory_size_reference() { ...@@ -228,6 +228,11 @@ uint32_t RelocInfo::wasm_memory_size_reference() {
reinterpret_cast<intptr_t>(Assembler::target_address_at(pc_, host_))); 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( void RelocInfo::update_wasm_memory_reference(
Address old_base, Address new_base, uint32_t old_size, uint32_t new_size, Address old_base, Address new_base, uint32_t old_size, uint32_t new_size,
ICacheFlushMode icache_flush_mode) { ICacheFlushMode icache_flush_mode) {
...@@ -255,6 +260,17 @@ void RelocInfo::update_wasm_memory_reference( ...@@ -255,6 +260,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 // Implementation of Operand and MemOperand
// See assembler-s390-inl.h for inlined constructors // See assembler-s390-inl.h for inlined constructors
......
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