| Index: src/ppc/macro-assembler-ppc.cc
|
| diff --git a/src/ppc/macro-assembler-ppc.cc b/src/ppc/macro-assembler-ppc.cc
|
| index a1866d2fd439c747fee219c008798acbe47abad6..6f5c5293b322a1b3174db279970ed955b32c7438 100644
|
| --- a/src/ppc/macro-assembler-ppc.cc
|
| +++ b/src/ppc/macro-assembler-ppc.cc
|
| @@ -1086,16 +1086,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());
|
| + mov(r7, Operand(debug_step_action));
|
| + lbz(r7, MemOperand(r7));
|
| + cmpi(r7, Operand(StepIn));
|
| + bne(&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, 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(r4));
|
| DCHECK_IMPLIES(new_target.is_valid(), new_target.is(r6));
|
| +
|
| + if (call_wrapper.NeedsDebugStepCheck()) {
|
| + FloodFunctionIfStepping(function, new_target, expected, actual);
|
| + }
|
| +
|
| + // Clear the new.target register if not given.
|
| if (!new_target.is_valid()) {
|
| LoadRoot(r6, Heap::kUndefinedValueRootIndex);
|
| }
|
| @@ -1105,6 +1153,11 @@ void MacroAssembler::InvokeCode(Register code, Register new_target,
|
| 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 = ip;
|
| + LoadP(code, FieldMemOperand(function, JSFunction::kCodeEntryOffset));
|
| if (flag == CALL_FUNCTION) {
|
| call_wrapper.BeforeCall(CallSize(code));
|
| CallJSEntry(code);
|
| @@ -1132,20 +1185,19 @@ void MacroAssembler::InvokeFunction(Register fun, Register new_target,
|
| DCHECK(fun.is(r4));
|
|
|
| Register expected_reg = r5;
|
| - Register code_reg = ip;
|
| + Register temp_reg = r7;
|
|
|
| - LoadP(code_reg, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
|
| + LoadP(temp_reg, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
|
| LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset));
|
| LoadWordArith(expected_reg,
|
| FieldMemOperand(
|
| - code_reg, SharedFunctionInfo::kFormalParameterCountOffset));
|
| + temp_reg, SharedFunctionInfo::kFormalParameterCountOffset));
|
| #if !defined(V8_TARGET_ARCH_PPC64)
|
| SmiUntag(expected_reg);
|
| #endif
|
| - LoadP(code_reg, FieldMemOperand(r4, 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);
|
| }
|
|
|
|
|
| @@ -1163,11 +1215,7 @@ void MacroAssembler::InvokeFunction(Register function,
|
| // Get the function and setup the context.
|
| LoadP(cp, FieldMemOperand(r4, 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.
|
| - LoadP(ip, FieldMemOperand(r4, JSFunction::kCodeEntryOffset));
|
| - InvokeCode(ip, no_reg, expected, actual, flag, call_wrapper);
|
| + InvokeFunctionCode(r4, no_reg, expected, actual, flag, call_wrapper);
|
| }
|
|
|
|
|
|
|