Index: src/builtins/ia32/builtins-ia32.cc |
diff --git a/src/builtins/ia32/builtins-ia32.cc b/src/builtins/ia32/builtins-ia32.cc |
index ed736ca904430d1fef52a73e7d9f59102f68c97d..7acd701b6e41297e4925ef597655736eb8fb26c7 100644 |
--- a/src/builtins/ia32/builtins-ia32.cc |
+++ b/src/builtins/ia32/builtins-ia32.cc |
@@ -3285,6 +3285,41 @@ void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
Generate_OnStackReplacementHelper(masm, true); |
} |
+void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { |
+ { |
+ FrameScope scope(masm, StackFrame::INTERNAL); |
+ |
+ // Save all parameter registers (see wasm-linkage.cc). They might be |
+ // overwritten in the runtime call below. |
+ // Other registers (like context and root) are not relevant here. The |
+ // CEntryStub will overwrite them anyway. |
+ constexpr Register gp_regs[]{eax, ebx, ecx, edx, esi}; |
+ constexpr XMMRegister xmm_regs[]{xmm1, xmm2, xmm3, xmm4, xmm5, xmm6}; |
+ |
+ for (auto reg : gp_regs) __ Push(reg); |
+ __ sub(esp, Immediate(16 * arraysize(xmm_regs))); |
+ for (int i = 0, e = arraysize(xmm_regs); i < e; ++i) { |
+ __ movdqu(Operand(esp, 16 * i), xmm_regs[i]); |
+ } |
+ |
+ // Initialize rsi register with kZero, CEntryStub will use it to set the |
+ // current context on the isolate. |
+ __ Move(esi, Smi::kZero); |
+ __ CallRuntime(Runtime::kWasmCompileLazy); |
+ // Store returned instruction start in edi. |
+ __ lea(edi, FieldOperand(eax, Code::kHeaderSize)); |
+ |
+ // Restore registers. |
+ for (int i = arraysize(xmm_regs) - 1; i >= 0; --i) { |
+ __ movdqu(xmm_regs[i], Operand(esp, 16 * i)); |
+ } |
+ __ add(esp, Immediate(16 * arraysize(xmm_regs))); |
+ for (int i = arraysize(gp_regs) - 1; i >= 0; --i) __ Pop(gp_regs[i]); |
+ } |
+ // Now jump to the instructions of the returned code object. |
+ __ jmp(edi); |
+} |
+ |
#undef __ |
} // namespace internal |
} // namespace v8 |