| Index: src/arm/macro-assembler-arm.cc
 | 
| diff --git a/src/arm/macro-assembler-arm.cc b/src/arm/macro-assembler-arm.cc
 | 
| index 2565328abef594157cc4ee6d5a8420cca5775676..8ad56a81835dff3042e504fc6d67f8dae252b5b0 100644
 | 
| --- a/src/arm/macro-assembler-arm.cc
 | 
| +++ b/src/arm/macro-assembler-arm.cc
 | 
| @@ -1303,18 +1303,65 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
 | 
|  }
 | 
|  
 | 
|  
 | 
| -void MacroAssembler::InvokeCode(Register code,
 | 
| -                                Register new_target,
 | 
| -                                const ParameterCount& expected,
 | 
| -                                const ParameterCount& actual,
 | 
| -                                InvokeFlag flag,
 | 
| -                                const CallWrapper& call_wrapper) {
 | 
| +void MacroAssembler::FloodFunctionIfStepping(Register fun, Register new_target,
 | 
| +                                             const ParameterCount& expected,
 | 
| +                                             const ParameterCount& actual) {
 | 
| +  Label skip_flooding;
 | 
| +  ExternalReference debug_step_action =
 | 
| +      ExternalReference::debug_last_step_action_address(isolate());
 | 
| +  mov(r4, Operand(debug_step_action));
 | 
| +  ldrb(r4, MemOperand(r4));
 | 
| +  cmp(r4, Operand(StepIn));
 | 
| +  b(ne, &skip_flooding);
 | 
| +  {
 | 
| +    FrameScope frame(this,
 | 
| +                     has_frame() ? StackFrame::NONE : StackFrame::INTERNAL);
 | 
| +    if (expected.is_reg()) {
 | 
| +      SmiTag(expected.reg());
 | 
| +      Push(expected.reg());
 | 
| +    }
 | 
| +    if (actual.is_reg()) {
 | 
| +      SmiTag(actual.reg());
 | 
| +      Push(actual.reg());
 | 
| +    }
 | 
| +    if (new_target.is_valid()) {
 | 
| +      Push(new_target);
 | 
| +    }
 | 
| +    Push(fun);
 | 
| +    Push(fun);
 | 
| +    CallRuntime(Runtime::kDebugPrepareStepInIfStepping, 1);
 | 
| +    Pop(fun);
 | 
| +    if (new_target.is_valid()) {
 | 
| +      Pop(new_target);
 | 
| +    }
 | 
| +    if (actual.is_reg()) {
 | 
| +      Pop(actual.reg());
 | 
| +      SmiUntag(actual.reg());
 | 
| +    }
 | 
| +    if (expected.is_reg()) {
 | 
| +      Pop(expected.reg());
 | 
| +      SmiUntag(expected.reg());
 | 
| +    }
 | 
| +  }
 | 
| +  bind(&skip_flooding);
 | 
| +}
 | 
| +
 | 
| +
 | 
| +void MacroAssembler::InvokeFunctionCode(Register function, Register new_target,
 | 
| +                                        const ParameterCount& expected,
 | 
| +                                        const ParameterCount& actual,
 | 
| +                                        InvokeFlag flag,
 | 
| +                                        const CallWrapper& call_wrapper) {
 | 
|    // You can't call a function without a valid frame.
 | 
|    DCHECK(flag == JUMP_FUNCTION || has_frame());
 | 
| -
 | 
| -  // Ensure new target is passed in the correct register. Otherwise clear the
 | 
| -  // appropriate register in case new target is not given.
 | 
| +  DCHECK(function.is(r1));
 | 
|    DCHECK_IMPLIES(new_target.is_valid(), new_target.is(r3));
 | 
| +
 | 
| +  if (call_wrapper.NeedsDebugStepCheck()) {
 | 
| +    FloodFunctionIfStepping(function, new_target, expected, actual);
 | 
| +  }
 | 
| +
 | 
| +  // Clear the new.target register if not given.
 | 
|    if (!new_target.is_valid()) {
 | 
|      LoadRoot(r3, Heap::kUndefinedValueRootIndex);
 | 
|    }
 | 
| @@ -1324,6 +1371,11 @@ void MacroAssembler::InvokeCode(Register code,
 | 
|    InvokePrologue(expected, actual, &done, &definitely_mismatches, flag,
 | 
|                   call_wrapper);
 | 
|    if (!definitely_mismatches) {
 | 
| +    // We call indirectly through the code field in the function to
 | 
| +    // allow recompilation to take effect without changing any of the
 | 
| +    // call sites.
 | 
| +    Register code = r4;
 | 
| +    ldr(code, FieldMemOperand(function, JSFunction::kCodeEntryOffset));
 | 
|      if (flag == CALL_FUNCTION) {
 | 
|        call_wrapper.BeforeCall(CallSize(code));
 | 
|        Call(code);
 | 
| @@ -1352,19 +1404,17 @@ void MacroAssembler::InvokeFunction(Register fun,
 | 
|    DCHECK(fun.is(r1));
 | 
|  
 | 
|    Register expected_reg = r2;
 | 
| -  Register code_reg = r4;
 | 
| +  Register temp_reg = r4;
 | 
|  
 | 
| -  ldr(code_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
 | 
| +  ldr(temp_reg, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset));
 | 
|    ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
 | 
|    ldr(expected_reg,
 | 
| -      FieldMemOperand(code_reg,
 | 
| +      FieldMemOperand(temp_reg,
 | 
|                        SharedFunctionInfo::kFormalParameterCountOffset));
 | 
|    SmiUntag(expected_reg);
 | 
| -  ldr(code_reg,
 | 
| -      FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
 | 
|  
 | 
|    ParameterCount expected(expected_reg);
 | 
| -  InvokeCode(code_reg, new_target, expected, actual, flag, call_wrapper);
 | 
| +  InvokeFunctionCode(fun, new_target, expected, actual, flag, call_wrapper);
 | 
|  }
 | 
|  
 | 
|  
 | 
| @@ -1382,11 +1432,7 @@ void MacroAssembler::InvokeFunction(Register function,
 | 
|    // Get the function and setup the context.
 | 
|    ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
 | 
|  
 | 
| -  // We call indirectly through the code field in the function to
 | 
| -  // allow recompilation to take effect without changing any of the
 | 
| -  // call sites.
 | 
| -  ldr(r4, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
 | 
| -  InvokeCode(r4, no_reg, expected, actual, flag, call_wrapper);
 | 
| +  InvokeFunctionCode(r1, no_reg, expected, actual, flag, call_wrapper);
 | 
|  }
 | 
|  
 | 
|  
 | 
| 
 |