Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: src/builtins/ia32/builtins-ia32.cc

Issue 2731523005: [wasm] Lazy compilation for asm.js (Closed)
Patch Set: [wasm] Lazy compilation for asm.js Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins/builtins.h ('k') | src/builtins/mips/builtins-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/builtins/builtins.h ('k') | src/builtins/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698