This ensures that the stack pointer is restored before we return from the jitted code.
@@ -290,8 +290,18 @@ struct Assembler {
}
+ void enter()
+ {
+ push(Operand::Register(Reg::RBP));
+ mov(Operand::Register(Reg::RBP), Operand::Register(Reg::RSP));
+ sub(Operand::Register(Reg::RSP), Operand::Imm8(8));
+ }
+
void exit()
{
+ // leave
+ emit8(0xc9);
// ret
emit8(0xc3);
@@ -179,6 +179,8 @@ OwnPtr<NativeExecutable> Compiler::compile(Bytecode::Executable const& bytecode_
Compiler compiler;
+ compiler.m_assembler.enter();
compiler.m_assembler.mov(
Assembler::Operand::Register(REGISTER_ARRAY_BASE),
Assembler::Operand::Register(ARG1));