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

Unified Diff: src/builtins/x64/builtins-x64.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/mips64/builtins-mips64.cc ('k') | src/compiler/wasm-compiler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins/x64/builtins-x64.cc
diff --git a/src/builtins/x64/builtins-x64.cc b/src/builtins/x64/builtins-x64.cc
index b4f63c6a33b08dbb840e8b9895477fe53f38ddb2..f3d6f252de8442a5a15155f90427bbdfc08769c5 100644
--- a/src/builtins/x64/builtins-x64.cc
+++ b/src/builtins/x64/builtins-x64.cc
@@ -3185,6 +3185,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[]{rax, rbx, rcx, rdx, rsi, rdi};
+ constexpr XMMRegister xmm_regs[]{xmm1, xmm2, xmm3, xmm4, xmm5, xmm6};
+
+ for (auto reg : gp_regs) __ Push(reg);
+ __ subp(rsp, Immediate(16 * arraysize(xmm_regs)));
+ for (int i = 0, e = arraysize(xmm_regs); i < e; ++i) {
+ __ movdqu(Operand(rsp, 16 * i), xmm_regs[i]);
+ }
+
+ // Initialize rsi register with kZero, CEntryStub will use it to set the
+ // current context on the isolate.
+ __ Move(rsi, Smi::kZero);
+ __ CallRuntime(Runtime::kWasmCompileLazy);
+ // Store returned instruction start in r11.
+ __ leap(r11, FieldOperand(rax, Code::kHeaderSize));
+
+ // Restore registers.
+ for (int i = arraysize(xmm_regs) - 1; i >= 0; --i) {
+ __ movdqu(xmm_regs[i], Operand(rsp, 16 * i));
+ }
+ __ addp(rsp, 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(r11);
+}
+
#undef __
} // namespace internal
« no previous file with comments | « src/builtins/mips64/builtins-mips64.cc ('k') | src/compiler/wasm-compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698