Commit 8194ff05 authored by bjaideep's avatar bjaideep Committed by Commit bot

PPC/s390: [debugger] infrastructure for side-effect-free debug-evaluate.

Port aa75904e

R=yangguo@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=v8:5821
LOG=N

Review-Url: https://codereview.chromium.org/2632513002
Cr-Commit-Position: refs/heads/master@{#42292}
parent 5d85e8cc
...@@ -755,14 +755,13 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { ...@@ -755,14 +755,13 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
// Flood function if we are stepping. // Flood function if we are stepping.
Label prepare_step_in_if_stepping, prepare_step_in_suspended_generator; Label prepare_step_in_if_stepping, prepare_step_in_suspended_generator;
Label stepping_prepared; Label stepping_prepared;
ExternalReference last_step_action = ExternalReference debug_hook =
ExternalReference::debug_last_step_action_address(masm->isolate()); ExternalReference::debug_hook_on_function_call_address(masm->isolate());
STATIC_ASSERT(StepFrame > StepIn); __ mov(ip, Operand(debug_hook));
__ mov(ip, Operand(last_step_action));
__ LoadByte(ip, MemOperand(ip), r0); __ LoadByte(ip, MemOperand(ip), r0);
__ extsb(ip, ip); __ extsb(ip, ip);
__ cmpi(ip, Operand(StepIn)); __ CmpSmiLiteral(ip, Smi::kZero, r0);
__ bge(&prepare_step_in_if_stepping); __ bne(&prepare_step_in_if_stepping);
// Flood function if we need to continue stepping in the suspended generator. // Flood function if we need to continue stepping in the suspended generator.
...@@ -834,7 +833,7 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { ...@@ -834,7 +833,7 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
{ {
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
__ Push(r4, r5, r7); __ Push(r4, r5, r7);
__ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); __ CallRuntime(Runtime::kDebugOnFunctionCall);
__ Pop(r4, r5); __ Pop(r4, r5);
__ LoadP(r7, FieldMemOperand(r4, JSGeneratorObject::kFunctionOffset)); __ LoadP(r7, FieldMemOperand(r4, JSGeneratorObject::kFunctionOffset));
} }
......
...@@ -754,13 +754,12 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { ...@@ -754,13 +754,12 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
// Flood function if we are stepping. // Flood function if we are stepping.
Label prepare_step_in_if_stepping, prepare_step_in_suspended_generator; Label prepare_step_in_if_stepping, prepare_step_in_suspended_generator;
Label stepping_prepared; Label stepping_prepared;
ExternalReference last_step_action = ExternalReference debug_hook =
ExternalReference::debug_last_step_action_address(masm->isolate()); ExternalReference::debug_hook_on_function_call_address(masm->isolate());
STATIC_ASSERT(StepFrame > StepIn); __ mov(ip, Operand(debug_hook));
__ mov(ip, Operand(last_step_action));
__ LoadB(ip, MemOperand(ip)); __ LoadB(ip, MemOperand(ip));
__ CmpP(ip, Operand(StepIn)); __ CmpSmiLiteral(ip, Smi::kZero, r0);
__ bge(&prepare_step_in_if_stepping); __ bne(&prepare_step_in_if_stepping);
// Flood function if we need to continue stepping in the suspended generator. // Flood function if we need to continue stepping in the suspended generator.
...@@ -833,7 +832,7 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) { ...@@ -833,7 +832,7 @@ void Builtins::Generate_ResumeGeneratorTrampoline(MacroAssembler* masm) {
{ {
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
__ Push(r3, r4, r6); __ Push(r3, r4, r6);
__ CallRuntime(Runtime::kDebugPrepareStepInIfStepping); __ CallRuntime(Runtime::kDebugOnFunctionCall);
__ Pop(r3, r4); __ Pop(r3, r4);
__ LoadP(r6, FieldMemOperand(r3, JSGeneratorObject::kFunctionOffset)); __ LoadP(r6, FieldMemOperand(r3, JSGeneratorObject::kFunctionOffset));
} }
......
...@@ -137,7 +137,7 @@ void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { ...@@ -137,7 +137,7 @@ void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) {
__ LeaveFrame(StackFrame::INTERNAL); __ LeaveFrame(StackFrame::INTERNAL);
ParameterCount dummy(0); ParameterCount dummy(0);
__ FloodFunctionIfStepping(r4, no_reg, dummy, dummy); __ CheckDebugHook(r4, no_reg, dummy, dummy);
// Load context from the function. // Load context from the function.
__ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset)); __ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset));
......
...@@ -141,7 +141,7 @@ void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) { ...@@ -141,7 +141,7 @@ void DebugCodegen::GenerateFrameDropperLiveEdit(MacroAssembler* masm) {
__ LeaveFrame(StackFrame::INTERNAL); __ LeaveFrame(StackFrame::INTERNAL);
ParameterCount dummy(0); ParameterCount dummy(0);
__ FloodFunctionIfStepping(r3, no_reg, dummy, dummy); __ CheckDebugHook(r3, no_reg, dummy, dummy);
// Load context from the function. // Load context from the function.
__ LoadP(cp, FieldMemOperand(r3, JSFunction::kContextOffset)); __ LoadP(cp, FieldMemOperand(r3, JSFunction::kContextOffset));
......
...@@ -1403,19 +1403,17 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, ...@@ -1403,19 +1403,17 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
} }
} }
void MacroAssembler::CheckDebugHook(Register fun, Register new_target,
void MacroAssembler::FloodFunctionIfStepping(Register fun, Register new_target, const ParameterCount& expected,
const ParameterCount& expected, const ParameterCount& actual) {
const ParameterCount& actual) { Label skip_hook;
Label skip_flooding; ExternalReference debug_hook_avtive =
ExternalReference last_step_action = ExternalReference::debug_hook_on_function_call_address(isolate());
ExternalReference::debug_last_step_action_address(isolate()); mov(r7, Operand(debug_hook_avtive));
STATIC_ASSERT(StepFrame > StepIn);
mov(r7, Operand(last_step_action));
LoadByte(r7, MemOperand(r7), r0); LoadByte(r7, MemOperand(r7), r0);
extsb(r7, r7); extsb(r7, r7);
cmpi(r7, Operand(StepIn)); CmpSmiLiteral(r7, Smi::kZero, r0);
blt(&skip_flooding); beq(&skip_hook);
{ {
FrameScope frame(this, FrameScope frame(this,
has_frame() ? StackFrame::NONE : StackFrame::INTERNAL); has_frame() ? StackFrame::NONE : StackFrame::INTERNAL);
...@@ -1431,7 +1429,7 @@ void MacroAssembler::FloodFunctionIfStepping(Register fun, Register new_target, ...@@ -1431,7 +1429,7 @@ void MacroAssembler::FloodFunctionIfStepping(Register fun, Register new_target,
Push(new_target); Push(new_target);
} }
Push(fun, fun); Push(fun, fun);
CallRuntime(Runtime::kDebugPrepareStepInIfStepping); CallRuntime(Runtime::kDebugOnFunctionCall);
Pop(fun); Pop(fun);
if (new_target.is_valid()) { if (new_target.is_valid()) {
Pop(new_target); Pop(new_target);
...@@ -1445,7 +1443,7 @@ void MacroAssembler::FloodFunctionIfStepping(Register fun, Register new_target, ...@@ -1445,7 +1443,7 @@ void MacroAssembler::FloodFunctionIfStepping(Register fun, Register new_target,
SmiUntag(expected.reg()); SmiUntag(expected.reg());
} }
} }
bind(&skip_flooding); bind(&skip_hook);
} }
...@@ -1459,8 +1457,8 @@ void MacroAssembler::InvokeFunctionCode(Register function, Register new_target, ...@@ -1459,8 +1457,8 @@ void MacroAssembler::InvokeFunctionCode(Register function, Register new_target,
DCHECK(function.is(r4)); DCHECK(function.is(r4));
DCHECK_IMPLIES(new_target.is_valid(), new_target.is(r6)); DCHECK_IMPLIES(new_target.is_valid(), new_target.is(r6));
if (call_wrapper.NeedsDebugStepCheck()) { if (call_wrapper.NeedsDebugHookCheck()) {
FloodFunctionIfStepping(function, new_target, expected, actual); CheckDebugHook(function, new_target, expected, actual);
} }
// Clear the new.target register if not given. // Clear the new.target register if not given.
......
...@@ -611,9 +611,10 @@ class MacroAssembler : public Assembler { ...@@ -611,9 +611,10 @@ class MacroAssembler : public Assembler {
const ParameterCount& actual, InvokeFlag flag, const ParameterCount& actual, InvokeFlag flag,
const CallWrapper& call_wrapper); const CallWrapper& call_wrapper);
void FloodFunctionIfStepping(Register fun, Register new_target, // On function call, call into the debugger if necessary.
const ParameterCount& expected, void CheckDebugHook(Register fun, Register new_target,
const ParameterCount& actual); const ParameterCount& expected,
const ParameterCount& actual);
// Invoke the JavaScript function in the given register. Changes the // Invoke the JavaScript function in the given register. Changes the
// current context to the context in the function before invoking. // current context to the context in the function before invoking.
......
...@@ -1306,17 +1306,16 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected, ...@@ -1306,17 +1306,16 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
} }
} }
void MacroAssembler::FloodFunctionIfStepping(Register fun, Register new_target, void MacroAssembler::CheckDebugHook(Register fun, Register new_target,
const ParameterCount& expected, const ParameterCount& expected,
const ParameterCount& actual) { const ParameterCount& actual) {
Label skip_flooding; Label skip_hook;
ExternalReference last_step_action = ExternalReference debug_hook_avtive =
ExternalReference::debug_last_step_action_address(isolate()); ExternalReference::debug_hook_on_function_call_address(isolate());
STATIC_ASSERT(StepFrame > StepIn); mov(r6, Operand(debug_hook_avtive));
mov(r6, Operand(last_step_action));
LoadB(r6, MemOperand(r6)); LoadB(r6, MemOperand(r6));
CmpP(r6, Operand(StepIn)); CmpSmiLiteral(r6, Smi::kZero, r0);
blt(&skip_flooding); beq(&skip_hook);
{ {
FrameScope frame(this, FrameScope frame(this,
has_frame() ? StackFrame::NONE : StackFrame::INTERNAL); has_frame() ? StackFrame::NONE : StackFrame::INTERNAL);
...@@ -1332,7 +1331,7 @@ void MacroAssembler::FloodFunctionIfStepping(Register fun, Register new_target, ...@@ -1332,7 +1331,7 @@ void MacroAssembler::FloodFunctionIfStepping(Register fun, Register new_target,
Push(new_target); Push(new_target);
} }
Push(fun, fun); Push(fun, fun);
CallRuntime(Runtime::kDebugPrepareStepInIfStepping); CallRuntime(Runtime::kDebugOnFunctionCall);
Pop(fun); Pop(fun);
if (new_target.is_valid()) { if (new_target.is_valid()) {
Pop(new_target); Pop(new_target);
...@@ -1346,7 +1345,7 @@ void MacroAssembler::FloodFunctionIfStepping(Register fun, Register new_target, ...@@ -1346,7 +1345,7 @@ void MacroAssembler::FloodFunctionIfStepping(Register fun, Register new_target,
SmiUntag(expected.reg()); SmiUntag(expected.reg());
} }
} }
bind(&skip_flooding); bind(&skip_hook);
} }
void MacroAssembler::InvokeFunctionCode(Register function, Register new_target, void MacroAssembler::InvokeFunctionCode(Register function, Register new_target,
...@@ -1360,8 +1359,8 @@ void MacroAssembler::InvokeFunctionCode(Register function, Register new_target, ...@@ -1360,8 +1359,8 @@ void MacroAssembler::InvokeFunctionCode(Register function, Register new_target,
DCHECK(function.is(r3)); DCHECK(function.is(r3));
DCHECK_IMPLIES(new_target.is_valid(), new_target.is(r5)); DCHECK_IMPLIES(new_target.is_valid(), new_target.is(r5));
if (call_wrapper.NeedsDebugStepCheck()) { if (call_wrapper.NeedsDebugHookCheck()) {
FloodFunctionIfStepping(function, new_target, expected, actual); CheckDebugHook(function, new_target, expected, actual);
} }
// Clear the new.target register if not given. // Clear the new.target register if not given.
......
...@@ -890,9 +890,10 @@ class MacroAssembler : public Assembler { ...@@ -890,9 +890,10 @@ class MacroAssembler : public Assembler {
const ParameterCount& actual, InvokeFlag flag, const ParameterCount& actual, InvokeFlag flag,
const CallWrapper& call_wrapper); const CallWrapper& call_wrapper);
void FloodFunctionIfStepping(Register fun, Register new_target, // On function call, call into the debugger if necessary.
const ParameterCount& expected, void CheckDebugHook(Register fun, Register new_target,
const ParameterCount& actual); const ParameterCount& expected,
const ParameterCount& actual);
// Invoke the JavaScript function in the given register. Changes the // Invoke the JavaScript function in the given register. Changes the
// current context to the context in the function before invoking. // current context to the context in the function before invoking.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment