[debug-wrapper] remove last uses of --expose-debug-as
The inspector cannot deal with breaking inside of debug-evaluate. There is therefore no point in supporting that in the debugger. The optional additional context parameter for debug-evaluate also can be removed since it's not being used. R=jgruber@chromium.org BUG=v8:5530 Review-Url: https://codereview.chromium.org/2580323002 Cr-Commit-Position: refs/heads/master@{#41791}
This commit is contained in:
parent
b29d6d4968
commit
1296dd1f5a
@ -21,12 +21,10 @@ static inline bool IsDebugContext(Isolate* isolate, Context* context) {
|
||||
return context->native_context() == *isolate->debug()->debug_context();
|
||||
}
|
||||
|
||||
|
||||
MaybeHandle<Object> DebugEvaluate::Global(
|
||||
Isolate* isolate, Handle<String> source, bool disable_break,
|
||||
Handle<HeapObject> context_extension) {
|
||||
MaybeHandle<Object> DebugEvaluate::Global(Isolate* isolate,
|
||||
Handle<String> source) {
|
||||
// Handle the processing of break.
|
||||
DisableBreak disable_break_scope(isolate->debug(), disable_break);
|
||||
DisableBreak disable_break_scope(isolate->debug());
|
||||
|
||||
// Enter the top context from before the debugger was invoked.
|
||||
SaveContext save(isolate);
|
||||
@ -41,19 +39,15 @@ MaybeHandle<Object> DebugEvaluate::Global(
|
||||
Handle<Context> context = isolate->native_context();
|
||||
Handle<JSObject> receiver(context->global_proxy());
|
||||
Handle<SharedFunctionInfo> outer_info(context->closure()->shared(), isolate);
|
||||
return Evaluate(isolate, outer_info, context, context_extension, receiver,
|
||||
source);
|
||||
return Evaluate(isolate, outer_info, context, receiver, source);
|
||||
}
|
||||
|
||||
|
||||
MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate,
|
||||
StackFrame::Id frame_id,
|
||||
int inlined_jsframe_index,
|
||||
Handle<String> source,
|
||||
bool disable_break,
|
||||
Handle<HeapObject> context_extension) {
|
||||
Handle<String> source) {
|
||||
// Handle the processing of break.
|
||||
DisableBreak disable_break_scope(isolate->debug(), disable_break);
|
||||
DisableBreak disable_break_scope(isolate->debug());
|
||||
|
||||
// Get the frame where the debugging is performed.
|
||||
StackTraceFrameIterator it(isolate, frame_id);
|
||||
@ -78,9 +72,8 @@ MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate,
|
||||
|
||||
Handle<Context> context = context_builder.evaluation_context();
|
||||
Handle<JSObject> receiver(context->global_proxy());
|
||||
MaybeHandle<Object> maybe_result =
|
||||
Evaluate(isolate, context_builder.outer_info(), context,
|
||||
context_extension, receiver, source);
|
||||
MaybeHandle<Object> maybe_result = Evaluate(
|
||||
isolate, context_builder.outer_info(), context, receiver, source);
|
||||
if (!maybe_result.is_null()) context_builder.UpdateValues();
|
||||
return maybe_result;
|
||||
}
|
||||
@ -89,20 +82,7 @@ MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate,
|
||||
// Compile and evaluate source for the given context.
|
||||
MaybeHandle<Object> DebugEvaluate::Evaluate(
|
||||
Isolate* isolate, Handle<SharedFunctionInfo> outer_info,
|
||||
Handle<Context> context, Handle<HeapObject> context_extension,
|
||||
Handle<Object> receiver, Handle<String> source) {
|
||||
if (context_extension->IsJSObject()) {
|
||||
Handle<JSObject> extension = Handle<JSObject>::cast(context_extension);
|
||||
Handle<JSFunction> closure(context->closure(), isolate);
|
||||
context = isolate->factory()->NewWithContext(
|
||||
closure, context,
|
||||
ScopeInfo::CreateForWithScope(
|
||||
isolate, context->IsNativeContext()
|
||||
? Handle<ScopeInfo>::null()
|
||||
: Handle<ScopeInfo>(context->scope_info())),
|
||||
extension);
|
||||
}
|
||||
|
||||
Handle<Context> context, Handle<Object> receiver, Handle<String> source) {
|
||||
Handle<JSFunction> eval_fun;
|
||||
ASSIGN_RETURN_ON_EXCEPTION(
|
||||
isolate, eval_fun,
|
||||
|
@ -13,9 +13,7 @@ namespace internal {
|
||||
|
||||
class DebugEvaluate : public AllStatic {
|
||||
public:
|
||||
static MaybeHandle<Object> Global(Isolate* isolate, Handle<String> source,
|
||||
bool disable_break,
|
||||
Handle<HeapObject> context_extension);
|
||||
static MaybeHandle<Object> Global(Isolate* isolate, Handle<String> source);
|
||||
|
||||
// Evaluate a piece of JavaScript in the context of a stack frame for
|
||||
// debugging. Things that need special attention are:
|
||||
@ -24,8 +22,7 @@ class DebugEvaluate : public AllStatic {
|
||||
// - The arguments object needs to materialized.
|
||||
static MaybeHandle<Object> Local(Isolate* isolate, StackFrame::Id frame_id,
|
||||
int inlined_jsframe_index,
|
||||
Handle<String> source, bool disable_break,
|
||||
Handle<HeapObject> context_extension);
|
||||
Handle<String> source);
|
||||
|
||||
private:
|
||||
// This class builds a context chain for evaluation of expressions
|
||||
@ -85,7 +82,6 @@ class DebugEvaluate : public AllStatic {
|
||||
static MaybeHandle<Object> Evaluate(Isolate* isolate,
|
||||
Handle<SharedFunctionInfo> outer_info,
|
||||
Handle<Context> context,
|
||||
Handle<HeapObject> context_extension,
|
||||
Handle<Object> receiver,
|
||||
Handle<String> source);
|
||||
};
|
||||
|
@ -453,7 +453,7 @@ bool Debug::Load() {
|
||||
|
||||
// Disable breakpoints and interrupts while compiling and running the
|
||||
// debugger scripts including the context creation code.
|
||||
DisableBreak disable(this, true);
|
||||
DisableBreak disable(this);
|
||||
PostponeInterruptsScope postpone(isolate_);
|
||||
|
||||
// Create the debugger context.
|
||||
|
@ -753,12 +753,12 @@ class DebugScope BASE_EMBEDDED {
|
||||
// Stack allocated class for disabling break.
|
||||
class DisableBreak BASE_EMBEDDED {
|
||||
public:
|
||||
explicit DisableBreak(Debug* debug, bool disable_break)
|
||||
explicit DisableBreak(Debug* debug)
|
||||
: debug_(debug),
|
||||
previous_break_disabled_(debug->break_disabled_),
|
||||
previous_in_debug_event_listener_(debug->in_debug_event_listener_) {
|
||||
debug_->break_disabled_ = disable_break;
|
||||
debug_->in_debug_event_listener_ = disable_break;
|
||||
debug_->break_disabled_ = true;
|
||||
debug_->in_debug_event_listener_ = true;
|
||||
}
|
||||
~DisableBreak() {
|
||||
debug_->break_disabled_ = previous_break_disabled_;
|
||||
|
@ -838,11 +838,8 @@ ExecutionState.prototype.prepareStep = function(action) {
|
||||
throw %make_type_error(kDebuggerType);
|
||||
};
|
||||
|
||||
ExecutionState.prototype.evaluateGlobal = function(source, disable_break,
|
||||
opt_additional_context) {
|
||||
return MakeMirror(%DebugEvaluateGlobal(this.break_id, source,
|
||||
TO_BOOLEAN(disable_break),
|
||||
opt_additional_context));
|
||||
ExecutionState.prototype.evaluateGlobal = function(source) {
|
||||
return MakeMirror(%DebugEvaluateGlobal(this.break_id, source));
|
||||
};
|
||||
|
||||
ExecutionState.prototype.frameCount = function() {
|
||||
@ -1874,8 +1871,6 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) {
|
||||
var expression = request.arguments.expression;
|
||||
var frame = request.arguments.frame;
|
||||
var global = request.arguments.global;
|
||||
var disable_break = request.arguments.disable_break;
|
||||
var additional_context = request.arguments.additional_context;
|
||||
|
||||
// The expression argument could be an integer so we convert it to a
|
||||
// string.
|
||||
@ -1890,35 +1885,13 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) {
|
||||
return response.failed('Arguments "frame" and "global" are exclusive');
|
||||
}
|
||||
|
||||
var additional_context_object;
|
||||
if (additional_context) {
|
||||
additional_context_object = {};
|
||||
for (var i = 0; i < additional_context.length; i++) {
|
||||
var mapping = additional_context[i];
|
||||
|
||||
if (!IS_STRING(mapping.name)) {
|
||||
return response.failed("Context element #" + i +
|
||||
" doesn't contain name:string property");
|
||||
}
|
||||
|
||||
var raw_value = DebugCommandProcessor.resolveValue_(mapping);
|
||||
additional_context_object[mapping.name] = raw_value;
|
||||
}
|
||||
}
|
||||
|
||||
// Global evaluate.
|
||||
if (global) {
|
||||
// Evaluate in the native context.
|
||||
response.body = this.exec_state_.evaluateGlobal(
|
||||
expression, TO_BOOLEAN(disable_break), additional_context_object);
|
||||
response.body = this.exec_state_.evaluateGlobal(expression);
|
||||
return;
|
||||
}
|
||||
|
||||
// Default value for disable_break is true.
|
||||
if (IS_UNDEFINED(disable_break)) {
|
||||
disable_break = true;
|
||||
}
|
||||
|
||||
// No frames no evaluate in frame.
|
||||
if (this.exec_state_.frameCount() == 0) {
|
||||
return response.failed('No frames');
|
||||
@ -1931,13 +1904,11 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) {
|
||||
return response.failed('Invalid frame "' + frame + '"');
|
||||
}
|
||||
// Evaluate in the specified frame.
|
||||
response.body = this.exec_state_.frame(frame_number).evaluate(
|
||||
expression, TO_BOOLEAN(disable_break), additional_context_object);
|
||||
response.body = this.exec_state_.frame(frame_number).evaluate(expression);
|
||||
return;
|
||||
} else {
|
||||
// Evaluate in the selected frame.
|
||||
response.body = this.exec_state_.frame().evaluate(
|
||||
expression, TO_BOOLEAN(disable_break), additional_context_object);
|
||||
response.body = this.exec_state_.frame().evaluate(expression);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
@ -2011,14 +2011,11 @@ FrameMirror.prototype.allScopes = function(opt_ignore_nested_scopes) {
|
||||
};
|
||||
|
||||
|
||||
FrameMirror.prototype.evaluate = function(source, disable_break,
|
||||
opt_context_object) {
|
||||
FrameMirror.prototype.evaluate = function(source) {
|
||||
return MakeMirror(%DebugEvaluate(this.break_id_,
|
||||
this.details_.frameId(),
|
||||
this.details_.inlinedFrameIndex(),
|
||||
source,
|
||||
TO_BOOLEAN(disable_break),
|
||||
opt_context_object));
|
||||
source));
|
||||
};
|
||||
|
||||
|
||||
|
@ -493,7 +493,7 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror)
|
||||
*/
|
||||
function evaluate(expression)
|
||||
{
|
||||
return frameMirror.evaluate(expression, false).value();
|
||||
return frameMirror.evaluate(expression).value();
|
||||
}
|
||||
|
||||
/** @return {undefined} */
|
||||
|
@ -171,10 +171,8 @@ function ExecutionState() {}
|
||||
|
||||
/**
|
||||
* @param {string} source
|
||||
* @param {boolean} disableBreak
|
||||
* @param {*=} additionalContext
|
||||
*/
|
||||
ExecutionState.prototype.evaluateGlobal = function(source, disableBreak, additionalContext) {}
|
||||
ExecutionState.prototype.evaluateGlobal = function(source) {}
|
||||
|
||||
/** @return {number} */
|
||||
ExecutionState.prototype.frameCount = function() {}
|
||||
@ -439,9 +437,8 @@ FrameMirror.prototype.script = function() {}
|
||||
|
||||
/**
|
||||
* @param {string} source
|
||||
* @param {boolean} disableBreak
|
||||
*/
|
||||
FrameMirror.prototype.evaluate = function(source, disableBreak) {}
|
||||
FrameMirror.prototype.evaluate = function(source) {}
|
||||
|
||||
FrameMirror.prototype.restart = function() {}
|
||||
|
||||
|
@ -1243,21 +1243,19 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluate) {
|
||||
|
||||
// Check the execution state and decode arguments frame and source to be
|
||||
// evaluated.
|
||||
DCHECK(args.length() == 6);
|
||||
DCHECK(args.length() == 4);
|
||||
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
|
||||
CHECK(isolate->debug()->CheckExecutionState(break_id));
|
||||
|
||||
CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
|
||||
CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, source, 3);
|
||||
CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 4);
|
||||
CONVERT_ARG_HANDLE_CHECKED(HeapObject, context_extension, 5);
|
||||
|
||||
StackFrame::Id id = DebugFrameHelper::UnwrapFrameId(wrapped_id);
|
||||
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate, DebugEvaluate::Local(isolate, id, inlined_jsframe_index, source,
|
||||
disable_break, context_extension));
|
||||
isolate,
|
||||
DebugEvaluate::Local(isolate, id, inlined_jsframe_index, source));
|
||||
}
|
||||
|
||||
|
||||
@ -1266,17 +1264,13 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluateGlobal) {
|
||||
|
||||
// Check the execution state and decode arguments frame and source to be
|
||||
// evaluated.
|
||||
DCHECK(args.length() == 4);
|
||||
DCHECK(args.length() == 2);
|
||||
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
|
||||
CHECK(isolate->debug()->CheckExecutionState(break_id));
|
||||
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, source, 1);
|
||||
CONVERT_BOOLEAN_ARG_CHECKED(disable_break, 2);
|
||||
CONVERT_ARG_HANDLE_CHECKED(HeapObject, context_extension, 3);
|
||||
|
||||
RETURN_RESULT_OR_FAILURE(
|
||||
isolate,
|
||||
DebugEvaluate::Global(isolate, source, disable_break, context_extension));
|
||||
RETURN_RESULT_OR_FAILURE(isolate, DebugEvaluate::Global(isolate, source));
|
||||
}
|
||||
|
||||
|
||||
|
@ -173,8 +173,8 @@ namespace internal {
|
||||
F(PrepareStep, 2, 1) \
|
||||
F(PrepareStepFrame, 0, 1) \
|
||||
F(ClearStepping, 0, 1) \
|
||||
F(DebugEvaluate, 6, 1) \
|
||||
F(DebugEvaluateGlobal, 4, 1) \
|
||||
F(DebugEvaluate, 4, 1) \
|
||||
F(DebugEvaluateGlobal, 2, 1) \
|
||||
F(DebugGetLoadedScripts, 0, 1) \
|
||||
F(DebugReferencedBy, 3, 1) \
|
||||
F(DebugConstructedBy, 2, 1) \
|
||||
|
@ -4037,7 +4037,7 @@ TEST(DisableBreak) {
|
||||
{
|
||||
v8::Debug::DebugBreak(env->GetIsolate());
|
||||
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(env->GetIsolate());
|
||||
v8::internal::DisableBreak disable_break(isolate->debug(), true);
|
||||
v8::internal::DisableBreak disable_break(isolate->debug());
|
||||
f->Call(context, env->Global(), 0, NULL).ToLocalChecked();
|
||||
CHECK_EQ(1, break_point_hit_count);
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ TEST(FlagsRemoveIncomplete) {
|
||||
// if the list of arguments ends unexpectedly.
|
||||
SetFlagsToDefault();
|
||||
int argc = 3;
|
||||
const char* argv[] = { "", "--crankshaft", "--expose-debug-as" };
|
||||
const char* argv[] = {"", "--crankshaft", "--expose-natives-as"};
|
||||
CHECK_EQ(2, FlagList::SetFlagsFromCommandLine(&argc,
|
||||
const_cast<char **>(argv),
|
||||
true));
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --invoke-weak-callbacks --omit-quit --gc-interval=355 --expose-debug-as=debug
|
||||
// Flags: --invoke-weak-callbacks --omit-quit --gc-interval=355
|
||||
|
||||
var __v_33 = {};
|
||||
__v_4 = 70000;
|
||||
|
@ -1,5 +0,0 @@
|
||||
// Copyright 2014 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-debug-as 1
|
@ -25,7 +25,6 @@
|
||||
// (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: --expose-debug-as debug
|
||||
// Get the Debug object exposed from the debug context global object.
|
||||
Debug = debug.Debug
|
||||
var exception = false;
|
||||
@ -48,11 +47,11 @@ function listener(event, exec_state, event_data, data) {
|
||||
// debugger code.
|
||||
exec_state.frame(0).evaluate(
|
||||
"print('A');\n" +
|
||||
"debugger; // BREAK\n" +
|
||||
"print('B'); // BREAK");
|
||||
"debugger;\n" +
|
||||
"print('B');");
|
||||
break;
|
||||
case 1:
|
||||
exec_state.prepareStep(Debug.StepAction.StepNext);
|
||||
assertUnreachable();
|
||||
break;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user