| Index: src/compiler/ia32/code-generator-ia32.cc
|
| diff --git a/src/compiler/ia32/code-generator-ia32.cc b/src/compiler/ia32/code-generator-ia32.cc
|
| index 3a3fd795d8d38cd164fc68e7f6129265548d05f5..d4b14087ded98db9f30a556bedd34ea474451e58 100644
|
| --- a/src/compiler/ia32/code-generator-ia32.cc
|
| +++ b/src/compiler/ia32/code-generator-ia32.cc
|
| @@ -121,6 +121,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
|
| }
|
| break;
|
| case kArchCallCodeObject: {
|
| + EnsureSpaceForLazyDeopt();
|
| if (HasImmediateInput(instr, 0)) {
|
| Handle<Code> code = Handle<Code>::cast(i.InputHeapObject(0));
|
| __ call(code, RelocInfo::CODE_TARGET);
|
| @@ -132,6 +133,7 @@ void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
|
| break;
|
| }
|
| case kArchCallJSFunction: {
|
| + EnsureSpaceForLazyDeopt();
|
| Register func = i.InputRegister(0);
|
| if (FLAG_debug_code) {
|
| // Check the function's context matches the context argument.
|
| @@ -947,6 +949,21 @@ void CodeGenerator::AssembleSwap(InstructionOperand* source,
|
|
|
| void CodeGenerator::AddNopForSmiCodeInlining() { __ nop(); }
|
|
|
| +
|
| +void CodeGenerator::EnsureSpaceForLazyDeopt() {
|
| + int space_needed = Deoptimizer::patch_size();
|
| + if (!linkage()->info()->IsStub()) {
|
| + // Ensure that we have enough space after the previous lazy-bailout
|
| + // instruction for patching the code here.
|
| + int current_pc = masm()->pc_offset();
|
| + if (current_pc < last_lazy_deopt_pc_ + space_needed) {
|
| + int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc;
|
| + __ Nop(padding_size);
|
| + }
|
| + }
|
| + MarkLazyDeoptSite();
|
| +}
|
| +
|
| #undef __
|
|
|
| } // namespace compiler
|
|
|