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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_X64 5 #if V8_TARGET_ARCH_X64
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/codegen.h" 8 #include "src/codegen.h"
9 #include "src/counters.h" 9 #include "src/counters.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
(...skipping 3167 matching lines...) Expand 10 before | Expand all | Expand 10 after
3178 } 3178 }
3179 3179
3180 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { 3180 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
3181 Generate_OnStackReplacementHelper(masm, false); 3181 Generate_OnStackReplacementHelper(masm, false);
3182 } 3182 }
3183 3183
3184 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { 3184 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
3185 Generate_OnStackReplacementHelper(masm, true); 3185 Generate_OnStackReplacementHelper(masm, true);
3186 } 3186 }
3187 3187
3188 void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) {
3189 {
3190 FrameScope scope(masm, StackFrame::INTERNAL);
3191
3192 // Save all parameter registers (see wasm-linkage.cc). They might be
3193 // overwritten in the runtime call below.
3194 // Other registers (like context and root) are not relevant here. The
3195 // CEntryStub will overwrite them anyway.
3196 constexpr Register gp_regs[]{rax, rbx, rcx, rdx, rsi, rdi};
3197 constexpr XMMRegister xmm_regs[]{xmm1, xmm2, xmm3, xmm4, xmm5, xmm6};
3198
3199 for (auto reg : gp_regs) __ Push(reg);
3200 __ subp(rsp, Immediate(16 * arraysize(xmm_regs)));
3201 for (int i = 0, e = arraysize(xmm_regs); i < e; ++i) {
3202 __ movdqu(Operand(rsp, 16 * i), xmm_regs[i]);
3203 }
3204
3205 // Initialize rsi register with kZero, CEntryStub will use it to set the
3206 // current context on the isolate.
3207 __ Move(rsi, Smi::kZero);
3208 __ CallRuntime(Runtime::kWasmCompileLazy);
3209 // Store returned instruction start in r11.
3210 __ leap(r11, FieldOperand(rax, Code::kHeaderSize));
3211
3212 // Restore registers.
3213 for (int i = arraysize(xmm_regs) - 1; i >= 0; --i) {
3214 __ movdqu(xmm_regs[i], Operand(rsp, 16 * i));
3215 }
3216 __ addp(rsp, Immediate(16 * arraysize(xmm_regs)));
3217 for (int i = arraysize(gp_regs) - 1; i >= 0; --i) __ Pop(gp_regs[i]);
3218 }
3219 // Now jump to the instructions of the returned code object.
3220 __ jmp(r11);
3221 }
3222
3188 #undef __ 3223 #undef __
3189 3224
3190 } // namespace internal 3225 } // namespace internal
3191 } // namespace v8 3226 } // namespace v8
3192 3227
3193 #endif // V8_TARGET_ARCH_X64 3228 #endif // V8_TARGET_ARCH_X64
OLDNEW
« 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