PPC/s390: fix WasmCodeManager for s390 and ppc

R=joransiu@ca.ibm.com, mtrofin@chromium.org, jbarboza@ca.ibm.com

Bug: 
Change-Id: I89fc3ef038310fa98e957407b44ed524b4f313bd
Reviewed-on: https://chromium-review.googlesource.com/818155
Reviewed-by: Ben Titzer <titzer@chromium.org>
Commit-Queue: Junliang Yan <jyan@ca.ibm.com>
Cr-Commit-Position: refs/heads/master@{#50593}
This commit is contained in:
Junliang Yan 2018-01-12 13:14:45 -05:00 committed by Commit Bot
parent 7b9ea02a70
commit 27629cbab5
3 changed files with 21 additions and 2 deletions

View File

@ -833,8 +833,13 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
}
if (instr->InputAt(0)->IsImmediate()) {
#ifdef V8_TARGET_ARCH_PPC64
Address wasm_code = reinterpret_cast<Address>(
i.ToConstant(instr->InputAt(0)).ToInt64());
#else
Address wasm_code = reinterpret_cast<Address>(
i.ToConstant(instr->InputAt(0)).ToInt32());
#endif
__ Call(wasm_code, rmode);
} else {
__ Call(i.InputRegister(0));

View File

@ -1084,8 +1084,13 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
}
if (instr->InputAt(0)->IsImmediate()) {
#ifdef V8_TARGET_ARCH_S390X
Address wasm_code = reinterpret_cast<Address>(
i.ToConstant(instr->InputAt(0)).ToInt64());
#else
Address wasm_code = reinterpret_cast<Address>(
i.ToConstant(instr->InputAt(0)).ToInt32());
#endif
__ Call(wasm_code, rmode);
} else {
__ Call(i.InputRegister(0));

View File

@ -41,6 +41,15 @@ void GenerateJumpTrampoline(MacroAssembler* masm, Address target) {
__ jmp(kScratchRegister);
}
#undef __
#elif V8_TARGET_ARCH_S390X
#define __ masm->
constexpr bool kModuleCanAllocateMoreMemory = false;
void GenerateJumpTrampoline(MacroAssembler* masm, Address target) {
__ mov(ip, Operand(bit_cast<intptr_t, Address>(target)));
__ b(ip);
}
#undef __
#else
const bool kModuleCanAllocateMoreMemory = true;
#endif
@ -55,7 +64,7 @@ void PatchTrampolineAndStubCalls(
new_code->constant_pool(), RelocInfo::kCodeTargetMask);
!it.done(); it.next(), orig_it.next()) {
Address old_target = orig_it.rinfo()->target_address();
#if V8_TARGET_ARCH_X64
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_S390X
auto found = reverse_lookup.find(old_target);
DCHECK(found != reverse_lookup.end());
Address new_target = found->second;
@ -472,7 +481,7 @@ WasmCode* NativeModule::AddCode(
return ret;
}
#if V8_TARGET_ARCH_X64
#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_S390X
Address NativeModule::CreateTrampolineTo(Handle<Code> code) {
MacroAssembler masm(code->GetIsolate(), nullptr, 0, CodeObjectRequired::kNo);
Address dest = code->instruction_start();