Revert of [inspector] migrate stepping related methods to debug-interface (patchset #3 id:40001 of https://chromiumcodereview.appspot.com/2423153002/ )

Reason for revert:
https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064/builds/10808

https://github.com/v8/v8/wiki/Blink-layout-tests

Original issue's description:
> [inspector] migrate stepping related methods to debug-interface
>
> * introduced DebugInterface::PrepareStep and DebugInterface::ClearStepping method.
> Inspector calls these methods only on pause and not interseted in calling this for not current break_id so we don't need to expose debug interface with break_id argument and can only check that current break_id is valid.
>
> BUG=chromium:652939,v8:5510
> R=yangguo@chromium.org,dgozman@chromium.org

TBR=yangguo@chromium.org,dgozman@chromium.org,kozyatinskiy@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=chromium:652939,v8:5510

Review-Url: https://chromiumcodereview.appspot.com/2441583002
Cr-Commit-Position: refs/heads/master@{#40455}
This commit is contained in:
machenbach 2016-10-20 01:31:52 -07:00 committed by Commit bot
parent 3cc949e3be
commit 5006df44c3
6 changed files with 66 additions and 41 deletions

View File

@ -8811,24 +8811,6 @@ void DebugInterface::ChangeBreakOnException(Isolate* isolate,
type != NoBreakOnException);
}
void DebugInterface::PrepareStep(Isolate* v8_isolate, StepAction action) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
ENTER_V8(isolate);
CHECK(isolate->debug()->CheckExecutionState());
// Clear all current stepping setup.
isolate->debug()->ClearStepping();
// Prepare step.
isolate->debug()->PrepareStep(static_cast<i::StepAction>(action));
}
void DebugInterface::ClearStepping(Isolate* v8_isolate) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
ENTER_V8(isolate);
CHECK(isolate->debug()->CheckExecutionState());
// Clear all current stepping setup.
isolate->debug()->ClearStepping();
}
Local<String> CpuProfileNode::GetFunctionName() const {
const i::ProfileNode* node = reinterpret_cast<const i::ProfileNode*>(this);
i::Isolate* isolate = node->isolate();

View File

@ -127,17 +127,6 @@ class DebugInterface {
*/
static void ChangeBreakOnException(Isolate* isolate,
ExceptionBreakState state);
enum StepAction {
StepOut = 0, // Step out of the current function.
StepNext = 1, // Step to the next statement in the current function.
StepIn = 2, // Step into new functions invoked or the next statement
// in the current function.
StepFrame = 3 // Step into a new frame or return to previous frame.
};
static void PrepareStep(Isolate* isolate, StepAction action);
static void ClearStepping(Isolate* isolate);
};
} // namespace v8

View File

@ -501,11 +501,8 @@ class Debug {
void Iterate(ObjectVisitor* v);
bool CheckExecutionState(int id) {
return CheckExecutionState() && break_id() == id;
}
bool CheckExecutionState() {
return is_active() && !debug_context().is_null() && break_id() != 0;
return is_active() && !debug_context().is_null() && break_id() != 0 &&
break_id() == id;
}
// Flags and states.

View File

@ -253,6 +253,43 @@ DebuggerScript.currentCallFrames = function(execState, limit)
return frames;
}
/**
* @param {!ExecutionState} execState
*/
DebuggerScript.stepIntoStatement = function(execState)
{
execState.prepareStep(Debug.StepAction.StepIn);
}
/**
* @param {!ExecutionState} execState
*/
DebuggerScript.stepFrameStatement = function(execState)
{
execState.prepareStep(Debug.StepAction.StepFrame);
}
/**
* @param {!ExecutionState} execState
*/
DebuggerScript.stepOverStatement = function(execState)
{
execState.prepareStep(Debug.StepAction.StepNext);
}
/**
* @param {!ExecutionState} execState
*/
DebuggerScript.stepOutOfFunction = function(execState)
{
execState.prepareStep(Debug.StepAction.StepOut);
}
DebuggerScript.clearStepping = function()
{
Debug.clearStepping();
}
// Returns array in form:
// [ 0, <v8_result_report> ] in case of success
// or [ 1, <general_error_message>, <compiler_message>, <line_number>, <column_number> ] in case of compile error, numbers are 1-based.

View File

@ -61,6 +61,8 @@ var JavaScriptCallFrame;
*/
var Debug = {};
Debug.clearStepping = function() {}
Debug.clearAllBreakPoints = function() {}
/** @return {!Array<!Script>} */
@ -190,6 +192,9 @@ BreakEvent.prototype.breakPointsHit = function() {}
/** @interface */
function ExecutionState() {}
/** @param {!Debug.StepAction} action */
ExecutionState.prototype.prepareStep = function(action) {}
/**
* @param {string} source
* @param {boolean} disableBreak

View File

@ -17,6 +17,8 @@
namespace v8_inspector {
namespace {
const char stepIntoV8MethodName[] = "stepIntoStatement";
const char stepOutV8MethodName[] = "stepOutOfFunction";
static const char v8AsyncTaskEventEnqueue[] = "enqueue";
static const char v8AsyncTaskEventEnqueueRecurring[] = "enqueueRecurring";
static const char v8AsyncTaskEventWillHandle[] = "willHandle";
@ -313,27 +315,37 @@ void V8Debugger::continueProgram() {
void V8Debugger::stepIntoStatement() {
DCHECK(isPaused());
DCHECK(!m_executionState.IsEmpty());
v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepIn);
v8::HandleScope handleScope(m_isolate);
v8::Local<v8::Value> argv[] = {m_executionState};
callDebuggerMethod(stepIntoV8MethodName, 1, argv);
continueProgram();
}
void V8Debugger::stepOverStatement() {
DCHECK(isPaused());
DCHECK(!m_executionState.IsEmpty());
v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepNext);
v8::HandleScope handleScope(m_isolate);
v8::Local<v8::Value> argv[] = {m_executionState};
callDebuggerMethod("stepOverStatement", 1, argv);
continueProgram();
}
void V8Debugger::stepOutOfFunction() {
DCHECK(isPaused());
DCHECK(!m_executionState.IsEmpty());
v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepOut);
v8::HandleScope handleScope(m_isolate);
v8::Local<v8::Value> argv[] = {m_executionState};
callDebuggerMethod(stepOutV8MethodName, 1, argv);
continueProgram();
}
void V8Debugger::clearStepping() {
DCHECK(enabled());
v8::DebugInterface::ClearStepping(m_isolate);
v8::HandleScope scope(m_isolate);
v8::Context::Scope contextScope(debuggerContext());
v8::Local<v8::Value> argv[] = {v8::Undefined(m_isolate)};
callDebuggerMethod("clearStepping", 0, argv);
}
bool V8Debugger::setScriptSource(
@ -532,11 +544,14 @@ void V8Debugger::handleProgramBreak(v8::Local<v8::Context> pausedContext,
m_executionState.Clear();
if (result == V8DebuggerAgentImpl::RequestStepFrame) {
v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepFrame);
v8::Local<v8::Value> argv[] = {executionState};
callDebuggerMethod("stepFrameStatement", 1, argv);
} else if (result == V8DebuggerAgentImpl::RequestStepInto) {
v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepIn);
v8::Local<v8::Value> argv[] = {executionState};
callDebuggerMethod(stepIntoV8MethodName, 1, argv);
} else if (result == V8DebuggerAgentImpl::RequestStepOut) {
v8::DebugInterface::PrepareStep(m_isolate, v8::DebugInterface::StepOut);
v8::Local<v8::Value> argv[] = {executionState};
callDebuggerMethod(stepOutV8MethodName, 1, argv);
}
}