Commit b1841eec authored by bjaideep's avatar bjaideep Committed by Commit bot

PPC/s390: [wasm] Lazy compilation for asm.js

Port 4f3e168c

Original Commit Message:

    This CL adds general lazy compilation support to WebAssembly, according
    to the design described in the design doc (see referenced bug).

    It's not used currently, but I tested locally that all tests succeed if
    I enable it by default.

    With a later CL, we will enable lazy compilation by default for
    validate-asm: https://chromium-review.googlesource.com/451318

R=clemensh@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=v8:5991
LOG=N

Review-Url: https://codereview.chromium.org/2761773004
Cr-Commit-Position: refs/heads/master@{#43954}
parent 7de5d703
...@@ -3027,6 +3027,35 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { ...@@ -3027,6 +3027,35 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
} }
} }
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
// Save all parameter registers (see wasm-linkage.cc). They might be
// overwritten in the runtime call below. We don't have any callee-saved
// registers in wasm, so no need to store anything else.
const RegList gp_regs = r3.bit() | r4.bit() | r5.bit() | r6.bit() |
r7.bit() | r8.bit() | r9.bit() | r10.bit();
const RegList fp_regs = d1.bit() | d2.bit() | d3.bit() | d4.bit() |
d5.bit() | d6.bit() | d7.bit() | d8.bit();
__ MultiPush(gp_regs);
__ MultiPushDoubles(fp_regs);
// Initialize cp register with kZero, CEntryStub will use it to set the
// current context on the isolate.
__ LoadSmiLiteral(cp, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy);
// Store returned instruction start in ip.
__ addi(ip, r3, Operand(Code::kHeaderSize - kHeapObjectTag));
// Restore registers.
__ MultiPopDoubles(fp_regs);
__ MultiPop(gp_regs);
}
// Now jump to the instructions of the returned code object.
__ Jump(ip);
}
#undef __ #undef __
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -3038,6 +3038,38 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { ...@@ -3038,6 +3038,38 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
} }
} }
void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
{
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
// Save all parameter registers (see wasm-linkage.cc). They might be
// overwritten in the runtime call below. We don't have any callee-saved
// registers in wasm, so no need to store anything else.
const RegList gp_regs =
r2.bit() | r3.bit() | r4.bit() | r5.bit() | r6.bit();
#if V8_TARGET_ARCH_S390X
const RegList fp_regs = d0.bit() | d2.bit() | d4.bit() | d6.bit();
#else
const RegList fp_regs = d0.bit() | d2.bit();
#endif
__ MultiPush(gp_regs);
__ MultiPushDoubles(fp_regs);
// Initialize cp register with kZero, CEntryStub will use it to set the
// current context on the isolate.
__ LoadSmiLiteral(cp, Smi::kZero);
__ CallRuntime(Runtime::kWasmCompileLazy);
// Store returned instruction start in ip.
__ AddP(ip, r2, Operand(Code::kHeaderSize - kHeapObjectTag));
// Restore registers.
__ MultiPopDoubles(fp_regs);
__ MultiPop(gp_regs);
}
// Now jump to the instructions of the returned code object.
__ Jump(ip);
}
#undef __ #undef __
} // namespace internal } // namespace internal
......
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