OLD | NEW |
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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 3267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3278 } | 3278 } |
3279 | 3279 |
3280 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 3280 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
3281 Generate_OnStackReplacementHelper(masm, false); | 3281 Generate_OnStackReplacementHelper(masm, false); |
3282 } | 3282 } |
3283 | 3283 |
3284 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 3284 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
3285 Generate_OnStackReplacementHelper(masm, true); | 3285 Generate_OnStackReplacementHelper(masm, true); |
3286 } | 3286 } |
3287 | 3287 |
| 3288 void Builtins::Generate_WasmCompileLazy(MacroAssembler* masm) { |
| 3289 { |
| 3290 FrameScope scope(masm, StackFrame::INTERNAL); |
| 3291 |
| 3292 // Save all parameter registers (see wasm-linkage.cc). They might be |
| 3293 // overwritten in the runtime call below. |
| 3294 // Other registers (like context and root) are not relevant here. The |
| 3295 // CEntryStub will overwrite them anyway. |
| 3296 constexpr Register gp_regs[]{eax, ebx, ecx, edx, esi}; |
| 3297 constexpr XMMRegister xmm_regs[]{xmm1, xmm2, xmm3, xmm4, xmm5, xmm6}; |
| 3298 |
| 3299 for (auto reg : gp_regs) __ Push(reg); |
| 3300 __ sub(esp, Immediate(16 * arraysize(xmm_regs))); |
| 3301 for (int i = 0, e = arraysize(xmm_regs); i < e; ++i) { |
| 3302 __ movdqu(Operand(esp, 16 * i), xmm_regs[i]); |
| 3303 } |
| 3304 |
| 3305 // Initialize rsi register with kZero, CEntryStub will use it to set the |
| 3306 // current context on the isolate. |
| 3307 __ Move(esi, Smi::kZero); |
| 3308 __ CallRuntime(Runtime::kWasmCompileLazy); |
| 3309 // Store returned instruction start in edi. |
| 3310 __ lea(edi, FieldOperand(eax, Code::kHeaderSize)); |
| 3311 |
| 3312 // Restore registers. |
| 3313 for (int i = arraysize(xmm_regs) - 1; i >= 0; --i) { |
| 3314 __ movdqu(xmm_regs[i], Operand(esp, 16 * i)); |
| 3315 } |
| 3316 __ add(esp, Immediate(16 * arraysize(xmm_regs))); |
| 3317 for (int i = arraysize(gp_regs) - 1; i >= 0; --i) __ Pop(gp_regs[i]); |
| 3318 } |
| 3319 // Now jump to the instructions of the returned code object. |
| 3320 __ jmp(edi); |
| 3321 } |
| 3322 |
3288 #undef __ | 3323 #undef __ |
3289 } // namespace internal | 3324 } // namespace internal |
3290 } // namespace v8 | 3325 } // namespace v8 |
3291 | 3326 |
3292 #endif // V8_TARGET_ARCH_IA32 | 3327 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |