Index: src/mips64/macro-assembler-mips64.cc |
diff --git a/src/mips64/macro-assembler-mips64.cc b/src/mips64/macro-assembler-mips64.cc |
index cbaa756be6657247373aed6d4c66502e11361251..212a39608bc0e873776b0df4ff8e6a53a974aee1 100644 |
--- a/src/mips64/macro-assembler-mips64.cc |
+++ b/src/mips64/macro-assembler-mips64.cc |
@@ -4222,18 +4222,64 @@ 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()); |
+ li(t0, Operand(debug_step_action)); |
+ lb(t0, MemOperand(t0)); |
+ Branch(&skip_flooding, ne, t0, Operand(StepIn)); |
+ { |
+ 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(a1)); |
DCHECK_IMPLIES(new_target.is_valid(), new_target.is(a3)); |
+ |
+ if (call_wrapper.NeedsDebugStepCheck()) { |
+ FloodFunctionIfStepping(function, new_target, expected, actual); |
+ } |
+ |
+ // Clear the new.target register if not given. |
if (!new_target.is_valid()) { |
LoadRoot(a3, Heap::kUndefinedValueRootIndex); |
} |
@@ -4243,6 +4289,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 = t0; |
+ ld(code, FieldMemOperand(function, JSFunction::kCodeEntryOffset)); |
if (flag == CALL_FUNCTION) { |
call_wrapper.BeforeCall(CallSize(code)); |
Call(code); |
@@ -4269,17 +4320,16 @@ void MacroAssembler::InvokeFunction(Register function, |
// Contract with called JS functions requires that function is passed in a1. |
DCHECK(function.is(a1)); |
Register expected_reg = a2; |
- Register code_reg = t0; |
- ld(code_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
+ Register temp_reg = t0; |
+ ld(temp_reg, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); |
ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset)); |
// The argument count is stored as int32_t on 64-bit platforms. |
// TODO(plind): Smi on 32-bit platforms. |
lw(expected_reg, |
- FieldMemOperand(code_reg, |
- SharedFunctionInfo::kFormalParameterCountOffset)); |
- ld(code_reg, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
+ FieldMemOperand(temp_reg, |
+ SharedFunctionInfo::kFormalParameterCountOffset)); |
ParameterCount expected(expected_reg); |
- InvokeCode(code_reg, new_target, expected, actual, flag, call_wrapper); |
+ InvokeFunctionCode(a1, new_target, expected, actual, flag, call_wrapper); |
} |
@@ -4297,11 +4347,7 @@ void MacroAssembler::InvokeFunction(Register function, |
// Get the function and setup the context. |
ld(cp, FieldMemOperand(a1, 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. |
- ld(t0, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); |
- InvokeCode(t0, no_reg, expected, actual, flag, call_wrapper); |
+ InvokeFunctionCode(a1, no_reg, expected, actual, flag, call_wrapper); |
} |