aboutsummaryrefslogtreecommitdiff
path: root/deps/v8/src/wasm/baseline/ia32/liftoff-assembler-ia32.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/wasm/baseline/ia32/liftoff-assembler-ia32.h')
-rw-r--r--deps/v8/src/wasm/baseline/ia32/liftoff-assembler-ia32.h44
1 files changed, 30 insertions, 14 deletions
diff --git a/deps/v8/src/wasm/baseline/ia32/liftoff-assembler-ia32.h b/deps/v8/src/wasm/baseline/ia32/liftoff-assembler-ia32.h
index 8c5d8c918d..1b5ca87c3d 100644
--- a/deps/v8/src/wasm/baseline/ia32/liftoff-assembler-ia32.h
+++ b/deps/v8/src/wasm/baseline/ia32/liftoff-assembler-ia32.h
@@ -7,7 +7,7 @@
#include "src/wasm/baseline/liftoff-assembler.h"
-#include "src/assembler.h"
+#include "src/codegen/assembler.h"
#include "src/wasm/value-type.h"
namespace v8 {
@@ -101,11 +101,11 @@ inline void push(LiftoffAssembler* assm, LiftoffRegister reg, ValueType type) {
assm->push(reg.low_gp());
break;
case kWasmF32:
- assm->sub(esp, Immediate(sizeof(float)));
+ assm->AllocateStackSpace(sizeof(float));
assm->movss(Operand(esp, 0), reg.fp());
break;
case kWasmF64:
- assm->sub(esp, Immediate(sizeof(double)));
+ assm->AllocateStackSpace(sizeof(double));
assm->movsd(Operand(esp, 0), reg.fp());
break;
default:
@@ -171,8 +171,7 @@ void LiftoffAssembler::PatchPrepareStackFrame(int offset,
AssemblerOptions{},
ExternalAssemblerBuffer(buffer_start_ + offset, kAvailableSpace));
#if V8_OS_WIN
- constexpr int kPageSize = 4 * 1024;
- if (bytes > kPageSize) {
+ if (bytes > kStackPageSize) {
// Generate OOL code (at the end of the function, where the current
// assembler is pointing) to do the explicit stack limit check (see
// https://docs.microsoft.com/en-us/previous-versions/visualstudio/
@@ -186,10 +185,7 @@ void LiftoffAssembler::PatchPrepareStackFrame(int offset,
patching_assembler.pc_offset());
// Now generate the OOL code.
- // Use {edi} as scratch register; it is not being used as parameter
- // register (see wasm-linkage.h).
- mov(edi, bytes);
- AllocateStackFrame(edi);
+ AllocateStackSpace(bytes);
// Jump back to the start of the function (from {pc_offset()} to {offset +
// kSubSpSize}).
int func_start_offset = offset + liftoff::kSubSpSize - pc_offset();
@@ -557,6 +553,13 @@ void EmitCommutativeBinOp(LiftoffAssembler* assm, Register dst, Register lhs,
(assm->*op)(dst, rhs);
}
}
+
+template <void (Assembler::*op)(Register, int32_t)>
+void EmitCommutativeBinOpImm(LiftoffAssembler* assm, Register dst, Register lhs,
+ int32_t imm) {
+ if (dst != lhs) assm->mov(dst, lhs);
+ (assm->*op)(dst, imm);
+}
} // namespace liftoff
void LiftoffAssembler::emit_i32_mul(Register dst, Register lhs, Register rhs) {
@@ -659,14 +662,26 @@ void LiftoffAssembler::emit_i32_and(Register dst, Register lhs, Register rhs) {
liftoff::EmitCommutativeBinOp<&Assembler::and_>(this, dst, lhs, rhs);
}
+void LiftoffAssembler::emit_i32_and(Register dst, Register lhs, int32_t imm) {
+ liftoff::EmitCommutativeBinOpImm<&Assembler::and_>(this, dst, lhs, imm);
+}
+
void LiftoffAssembler::emit_i32_or(Register dst, Register lhs, Register rhs) {
liftoff::EmitCommutativeBinOp<&Assembler::or_>(this, dst, lhs, rhs);
}
+void LiftoffAssembler::emit_i32_or(Register dst, Register lhs, int32_t imm) {
+ liftoff::EmitCommutativeBinOpImm<&Assembler::or_>(this, dst, lhs, imm);
+}
+
void LiftoffAssembler::emit_i32_xor(Register dst, Register lhs, Register rhs) {
liftoff::EmitCommutativeBinOp<&Assembler::xor_>(this, dst, lhs, rhs);
}
+void LiftoffAssembler::emit_i32_xor(Register dst, Register lhs, int32_t imm) {
+ liftoff::EmitCommutativeBinOpImm<&Assembler::xor_>(this, dst, lhs, imm);
+}
+
namespace liftoff {
inline void EmitShiftOperation(LiftoffAssembler* assm, Register dst,
Register src, Register amount,
@@ -825,7 +840,8 @@ inline void OpWithCarryI(LiftoffAssembler* assm, LiftoffRegister dst,
if (dst_high != lhs.high_gp()) assm->mov(dst_high, lhs.high_gp());
// Top half of the immediate sign extended, either 0 or -1.
- (assm->*op_with_carry)(dst_high, imm < 0 ? -1 : 0);
+ int32_t sign_extend = imm < 0 ? -1 : 0;
+ (assm->*op_with_carry)(dst_high, sign_extend);
// If necessary, move result into the right registers.
LiftoffRegister tmp_result = LiftoffRegister::ForPair(dst_low, dst_high);
@@ -1439,7 +1455,7 @@ bool LiftoffAssembler::emit_type_conversion(WasmOpcode opcode,
return true;
case kExprI64ReinterpretF64:
// Push src to the stack.
- sub(esp, Immediate(8));
+ AllocateStackSpace(8);
movsd(Operand(esp, 0), src.fp());
// Pop to dst.
pop(dst.low_gp());
@@ -1689,7 +1705,7 @@ void LiftoffAssembler::PushRegisters(LiftoffRegList regs) {
LiftoffRegList fp_regs = regs & kFpCacheRegList;
unsigned num_fp_regs = fp_regs.GetNumRegsSet();
if (num_fp_regs) {
- sub(esp, Immediate(num_fp_regs * kStackSlotSize));
+ AllocateStackSpace(num_fp_regs * kStackSlotSize);
unsigned offset = 0;
while (!fp_regs.is_empty()) {
LiftoffRegister reg = fp_regs.GetFirstRegSet();
@@ -1730,7 +1746,7 @@ void LiftoffAssembler::CallC(wasm::FunctionSig* sig,
const LiftoffRegister* rets,
ValueType out_argument_type, int stack_bytes,
ExternalReference ext_ref) {
- sub(esp, Immediate(stack_bytes));
+ AllocateStackSpace(stack_bytes);
int arg_bytes = 0;
for (ValueType param_type : sig->parameters()) {
@@ -1795,7 +1811,7 @@ void LiftoffAssembler::CallRuntimeStub(WasmCode::RuntimeStubId sid) {
}
void LiftoffAssembler::AllocateStackSlot(Register addr, uint32_t size) {
- sub(esp, Immediate(size));
+ AllocateStackSpace(size);
mov(addr, esp);
}