Commit a680b260 authored by yangguo's avatar yangguo Committed by Commit bot

Revert of [inspector] gracefully handle stack overflows in the inspector....

Revert of [inspector] gracefully handle stack overflows in the inspector. (patchset #13 id:240001 of https://codereview.chromium.org/2510093002/ )

Reason for revert:
asan failure: https://build.chromium.org/p/client.v8/builders/V8%20Mac64%20ASAN/builds/10047/steps/Ignition%20-%20turbofan/logs/regress-2318

Original issue's description:
> [inspector] gracefully handle stack overflows in the inspector.
>
> Hopefully we can avoid going through JS at all, so we can avoid this issue.
>
> R=jgruber@chromium.org, kozyatinskiy@chromium.org
> BUG=v8:5654
>
> Review-Url: https://codereview.chromium.org/2510093002
> Cr-Commit-Position: refs/heads/master@{#41802}
> Committed: https://chromium.googlesource.com/v8/v8/+/3ab3b6261a4299d14bdc109f0abc914961735b1e

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

Review-Url: https://codereview.chromium.org/2583173002
Cr-Commit-Position: refs/heads/master@{#41805}
parent c0282f60
......@@ -1931,8 +1931,9 @@ class InspectorFrontend final : public v8_inspector::V8Inspector::Channel {
"Maximum call stack size exceeded",
v8::NewStringType::kNormal)
.ToLocalChecked();
Local<Value> value = exception->Get(context, key).ToLocalChecked();
CHECK(value->StrictEquals(expected));
CHECK(exception->Get(context, key)
.ToLocalChecked()
->StrictEquals(expected));
}
#endif
}
......
......@@ -91,7 +91,7 @@ bool JavaScriptCallFrame::isAtReturn() const {
return result.As<v8::Boolean>()->BooleanValue(context).FromMaybe(false);
}
v8::MaybeLocal<v8::Object> JavaScriptCallFrame::details() const {
v8::Local<v8::Object> JavaScriptCallFrame::details() const {
v8::MicrotasksScope microtasks(m_isolate,
v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::Local<v8::Context> context =
......@@ -101,12 +101,8 @@ v8::MaybeLocal<v8::Object> JavaScriptCallFrame::details() const {
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(
callFrame->Get(context, toV8StringInternalized(m_isolate, "details"))
.ToLocalChecked());
v8::TryCatch try_catch(m_isolate);
v8::Local<v8::Value> details;
if (func->Call(context, callFrame, 0, nullptr).ToLocal(&details)) {
return v8::Local<v8::Object>::Cast(details);
}
return v8::MaybeLocal<v8::Object>();
return v8::Local<v8::Object>::Cast(
func->Call(context, callFrame, 0, nullptr).ToLocalChecked());
}
v8::MaybeLocal<v8::Value> JavaScriptCallFrame::evaluate(
......@@ -133,7 +129,6 @@ v8::MaybeLocal<v8::Value> JavaScriptCallFrame::restart() {
v8::Local<v8::Function> restartFunction = v8::Local<v8::Function>::Cast(
callFrame->Get(context, toV8StringInternalized(m_isolate, "restart"))
.ToLocalChecked());
v8::TryCatch try_catch(m_isolate);
v8::debug::SetLiveEditEnabled(m_isolate, true);
v8::MaybeLocal<v8::Value> result = restartFunction->Call(
m_debuggerContext.Get(m_isolate), callFrame, 0, nullptr);
......@@ -159,7 +154,6 @@ v8::MaybeLocal<v8::Value> JavaScriptCallFrame::setVariableValue(
v8::Local<v8::Value> argv[] = {
v8::Local<v8::Value>(v8::Integer::New(m_isolate, scopeNumber)),
variableName, newValue};
v8::TryCatch try_catch(m_isolate);
return setVariableValueFunction->Call(context, callFrame, arraysize(argv),
argv);
}
......
......@@ -55,7 +55,7 @@ class JavaScriptCallFrame {
int contextId() const;
bool isAtReturn() const;
v8::MaybeLocal<v8::Object> details() const;
v8::Local<v8::Object> details() const;
v8::MaybeLocal<v8::Value> evaluate(v8::Local<v8::Value> expression);
v8::MaybeLocal<v8::Value> restart();
......
......@@ -944,9 +944,8 @@ Response V8DebuggerAgentImpl::currentCallFrames(
const std::unique_ptr<JavaScriptCallFrame>& currentCallFrame =
m_pausedCallFrames[frameOrdinal];
v8::Local<v8::Object> details;
if (!currentCallFrame->details().ToLocal(&details))
return Response::InternalError();
v8::Local<v8::Object> details = currentCallFrame->details();
if (details.IsEmpty()) return Response::InternalError();
int contextId = currentCallFrame->contextId();
......
......@@ -50,7 +50,6 @@ v8::MaybeLocal<v8::Value> V8Debugger::callDebuggerMethod(
debuggerScript
->Get(context, toV8StringInternalized(m_isolate, functionName))
.ToLocalChecked());
v8::TryCatch try_catch(m_isolate);
return function->Call(context, debuggerScript, argc, argv);
}
......@@ -410,16 +409,16 @@ JavaScriptCallFrames V8Debugger::currentCallFrames(int limit) {
->Get(debuggerContext(),
toV8StringInternalized(m_isolate, "currentCallFrames"))
.ToLocalChecked());
if (!v8::debug::Call(debuggerContext(), currentCallFramesFunction,
v8::Integer::New(m_isolate, limit))
.ToLocal(&currentCallFramesV8))
return JavaScriptCallFrames();
currentCallFramesV8 =
v8::debug::Call(debuggerContext(), currentCallFramesFunction,
v8::Integer::New(m_isolate, limit))
.ToLocalChecked();
} else {
v8::Local<v8::Value> argv[] = {m_executionState,
v8::Integer::New(m_isolate, limit)};
if (!callDebuggerMethod("currentCallFrames", arraysize(argv), argv)
.ToLocal(&currentCallFramesV8))
return JavaScriptCallFrames();
currentCallFramesV8 =
callDebuggerMethod("currentCallFrames", arraysize(argv), argv)
.ToLocalChecked();
}
DCHECK(!currentCallFramesV8.IsEmpty());
if (!currentCallFramesV8->IsArray()) return JavaScriptCallFrames();
......@@ -589,10 +588,8 @@ void V8Debugger::handleV8DebugEvent(
isUncaught);
} else if (event == v8::Break) {
v8::Local<v8::Value> argv[] = {eventDetails.GetEventData()};
v8::Local<v8::Value> hitBreakpoints;
if (!callDebuggerMethod("getBreakpointNumbers", 1, argv)
.ToLocal(&hitBreakpoints))
return;
v8::Local<v8::Value> hitBreakpoints =
callDebuggerMethod("getBreakpointNumbers", 1, argv).ToLocalChecked();
DCHECK(hitBreakpoints->IsArray());
handleProgramBreak(eventContext, eventDetails.GetExecutionState(),
v8::Local<v8::Value>(), hitBreakpoints.As<v8::Array>());
......@@ -780,11 +777,9 @@ v8::Local<v8::Value> V8Debugger::collectionEntries(
return v8::Undefined(m_isolate);
}
v8::Local<v8::Value> argv[] = {object};
v8::Local<v8::Value> entriesValue;
if (!callDebuggerMethod("getCollectionEntries", 1, argv)
.ToLocal(&entriesValue) ||
!entriesValue->IsArray())
return v8::Undefined(m_isolate);
v8::Local<v8::Value> entriesValue =
callDebuggerMethod("getCollectionEntries", 1, argv).ToLocalChecked();
if (!entriesValue->IsArray()) return v8::Undefined(m_isolate);
v8::Local<v8::Array> entries = entriesValue.As<v8::Array>();
v8::Local<v8::Array> copiedArray =
......@@ -817,11 +812,11 @@ v8::Local<v8::Value> V8Debugger::generatorObjectLocation(
return v8::Null(m_isolate);
}
v8::Local<v8::Value> argv[] = {object};
v8::Local<v8::Value> location;
v8::Local<v8::Value> location =
callDebuggerMethod("getGeneratorObjectLocation", 1, argv)
.ToLocalChecked();
v8::Local<v8::Value> copied;
if (!callDebuggerMethod("getGeneratorObjectLocation", 1, argv)
.ToLocal(&location) ||
!copyValueFromDebuggerContext(m_isolate, debuggerContext(), context,
if (!copyValueFromDebuggerContext(m_isolate, debuggerContext(), context,
location)
.ToLocal(&copied) ||
!copied->IsObject())
......
......@@ -27,9 +27,6 @@
# Slow test
'debug/debug-scopes': [PASS, SLOW],
# Too slow in debug mode with --stress-opt mode.
'regress/regress-2318': [PASS, ['mode == debug or (arch != ia32 and arch != x64)', SKIP]],
}], # ALWAYS
##############################################################################
......
......@@ -819,8 +819,6 @@ class DebugWrapper {
break;
}
if (!params.callFrames[0]) return;
// Skip break events in this file.
if (params.callFrames[0].location.scriptId == this.thisScriptId) return;
......
......@@ -55,6 +55,7 @@
##############################################################################
# Too slow in debug mode with --stress-opt mode.
'regress/regress-2318': [PASS, ['mode == debug', SKIP]],
'regress/regress-create-exception': [PASS, ['mode == debug', SKIP]],
##############################################################################
......
......@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --stack-size=70
// Flags: --expose-debug-as debug --stack-size=150
function f() {
var i = 0;
......
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