Commit 1296dd1f authored by yangguo's avatar yangguo Committed by Commit bot

[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}
parent b29d6d49
...@@ -21,12 +21,10 @@ static inline bool IsDebugContext(Isolate* isolate, Context* context) { ...@@ -21,12 +21,10 @@ static inline bool IsDebugContext(Isolate* isolate, Context* context) {
return context->native_context() == *isolate->debug()->debug_context(); return context->native_context() == *isolate->debug()->debug_context();
} }
MaybeHandle<Object> DebugEvaluate::Global(Isolate* isolate,
MaybeHandle<Object> DebugEvaluate::Global( Handle<String> source) {
Isolate* isolate, Handle<String> source, bool disable_break,
Handle<HeapObject> context_extension) {
// Handle the processing of break. // 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. // Enter the top context from before the debugger was invoked.
SaveContext save(isolate); SaveContext save(isolate);
...@@ -41,19 +39,15 @@ MaybeHandle<Object> DebugEvaluate::Global( ...@@ -41,19 +39,15 @@ MaybeHandle<Object> DebugEvaluate::Global(
Handle<Context> context = isolate->native_context(); Handle<Context> context = isolate->native_context();
Handle<JSObject> receiver(context->global_proxy()); Handle<JSObject> receiver(context->global_proxy());
Handle<SharedFunctionInfo> outer_info(context->closure()->shared(), isolate); Handle<SharedFunctionInfo> outer_info(context->closure()->shared(), isolate);
return Evaluate(isolate, outer_info, context, context_extension, receiver, return Evaluate(isolate, outer_info, context, receiver, source);
source);
} }
MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate, MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate,
StackFrame::Id frame_id, StackFrame::Id frame_id,
int inlined_jsframe_index, int inlined_jsframe_index,
Handle<String> source, Handle<String> source) {
bool disable_break,
Handle<HeapObject> context_extension) {
// Handle the processing of break. // 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. // Get the frame where the debugging is performed.
StackTraceFrameIterator it(isolate, frame_id); StackTraceFrameIterator it(isolate, frame_id);
...@@ -78,9 +72,8 @@ MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate, ...@@ -78,9 +72,8 @@ MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate,
Handle<Context> context = context_builder.evaluation_context(); Handle<Context> context = context_builder.evaluation_context();
Handle<JSObject> receiver(context->global_proxy()); Handle<JSObject> receiver(context->global_proxy());
MaybeHandle<Object> maybe_result = MaybeHandle<Object> maybe_result = Evaluate(
Evaluate(isolate, context_builder.outer_info(), context, isolate, context_builder.outer_info(), context, receiver, source);
context_extension, receiver, source);
if (!maybe_result.is_null()) context_builder.UpdateValues(); if (!maybe_result.is_null()) context_builder.UpdateValues();
return maybe_result; return maybe_result;
} }
...@@ -89,20 +82,7 @@ MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate, ...@@ -89,20 +82,7 @@ MaybeHandle<Object> DebugEvaluate::Local(Isolate* isolate,
// Compile and evaluate source for the given context. // Compile and evaluate source for the given context.
MaybeHandle<Object> DebugEvaluate::Evaluate( MaybeHandle<Object> DebugEvaluate::Evaluate(
Isolate* isolate, Handle<SharedFunctionInfo> outer_info, Isolate* isolate, Handle<SharedFunctionInfo> outer_info,
Handle<Context> context, Handle<HeapObject> context_extension, Handle<Context> context, Handle<Object> receiver, Handle<String> source) {
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<JSFunction> eval_fun; Handle<JSFunction> eval_fun;
ASSIGN_RETURN_ON_EXCEPTION( ASSIGN_RETURN_ON_EXCEPTION(
isolate, eval_fun, isolate, eval_fun,
......
...@@ -13,9 +13,7 @@ namespace internal { ...@@ -13,9 +13,7 @@ namespace internal {
class DebugEvaluate : public AllStatic { class DebugEvaluate : public AllStatic {
public: public:
static MaybeHandle<Object> Global(Isolate* isolate, Handle<String> source, static MaybeHandle<Object> Global(Isolate* isolate, Handle<String> source);
bool disable_break,
Handle<HeapObject> context_extension);
// Evaluate a piece of JavaScript in the context of a stack frame for // Evaluate a piece of JavaScript in the context of a stack frame for
// debugging. Things that need special attention are: // debugging. Things that need special attention are:
...@@ -24,8 +22,7 @@ class DebugEvaluate : public AllStatic { ...@@ -24,8 +22,7 @@ class DebugEvaluate : public AllStatic {
// - The arguments object needs to materialized. // - The arguments object needs to materialized.
static MaybeHandle<Object> Local(Isolate* isolate, StackFrame::Id frame_id, static MaybeHandle<Object> Local(Isolate* isolate, StackFrame::Id frame_id,
int inlined_jsframe_index, int inlined_jsframe_index,
Handle<String> source, bool disable_break, Handle<String> source);
Handle<HeapObject> context_extension);
private: private:
// This class builds a context chain for evaluation of expressions // This class builds a context chain for evaluation of expressions
...@@ -85,7 +82,6 @@ class DebugEvaluate : public AllStatic { ...@@ -85,7 +82,6 @@ class DebugEvaluate : public AllStatic {
static MaybeHandle<Object> Evaluate(Isolate* isolate, static MaybeHandle<Object> Evaluate(Isolate* isolate,
Handle<SharedFunctionInfo> outer_info, Handle<SharedFunctionInfo> outer_info,
Handle<Context> context, Handle<Context> context,
Handle<HeapObject> context_extension,
Handle<Object> receiver, Handle<Object> receiver,
Handle<String> source); Handle<String> source);
}; };
......
...@@ -453,7 +453,7 @@ bool Debug::Load() { ...@@ -453,7 +453,7 @@ bool Debug::Load() {
// Disable breakpoints and interrupts while compiling and running the // Disable breakpoints and interrupts while compiling and running the
// debugger scripts including the context creation code. // debugger scripts including the context creation code.
DisableBreak disable(this, true); DisableBreak disable(this);
PostponeInterruptsScope postpone(isolate_); PostponeInterruptsScope postpone(isolate_);
// Create the debugger context. // Create the debugger context.
......
...@@ -753,12 +753,12 @@ class DebugScope BASE_EMBEDDED { ...@@ -753,12 +753,12 @@ class DebugScope BASE_EMBEDDED {
// Stack allocated class for disabling break. // Stack allocated class for disabling break.
class DisableBreak BASE_EMBEDDED { class DisableBreak BASE_EMBEDDED {
public: public:
explicit DisableBreak(Debug* debug, bool disable_break) explicit DisableBreak(Debug* debug)
: debug_(debug), : debug_(debug),
previous_break_disabled_(debug->break_disabled_), previous_break_disabled_(debug->break_disabled_),
previous_in_debug_event_listener_(debug->in_debug_event_listener_) { previous_in_debug_event_listener_(debug->in_debug_event_listener_) {
debug_->break_disabled_ = disable_break; debug_->break_disabled_ = true;
debug_->in_debug_event_listener_ = disable_break; debug_->in_debug_event_listener_ = true;
} }
~DisableBreak() { ~DisableBreak() {
debug_->break_disabled_ = previous_break_disabled_; debug_->break_disabled_ = previous_break_disabled_;
......
...@@ -838,11 +838,8 @@ ExecutionState.prototype.prepareStep = function(action) { ...@@ -838,11 +838,8 @@ ExecutionState.prototype.prepareStep = function(action) {
throw %make_type_error(kDebuggerType); throw %make_type_error(kDebuggerType);
}; };
ExecutionState.prototype.evaluateGlobal = function(source, disable_break, ExecutionState.prototype.evaluateGlobal = function(source) {
opt_additional_context) { return MakeMirror(%DebugEvaluateGlobal(this.break_id, source));
return MakeMirror(%DebugEvaluateGlobal(this.break_id, source,
TO_BOOLEAN(disable_break),
opt_additional_context));
}; };
ExecutionState.prototype.frameCount = function() { ExecutionState.prototype.frameCount = function() {
...@@ -1874,8 +1871,6 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { ...@@ -1874,8 +1871,6 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) {
var expression = request.arguments.expression; var expression = request.arguments.expression;
var frame = request.arguments.frame; var frame = request.arguments.frame;
var global = request.arguments.global; 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 // The expression argument could be an integer so we convert it to a
// string. // string.
...@@ -1890,35 +1885,13 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { ...@@ -1890,35 +1885,13 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) {
return response.failed('Arguments "frame" and "global" are exclusive'); 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. // Global evaluate.
if (global) { if (global) {
// Evaluate in the native context. // Evaluate in the native context.
response.body = this.exec_state_.evaluateGlobal( response.body = this.exec_state_.evaluateGlobal(expression);
expression, TO_BOOLEAN(disable_break), additional_context_object);
return; return;
} }
// Default value for disable_break is true.
if (IS_UNDEFINED(disable_break)) {
disable_break = true;
}
// No frames no evaluate in frame. // No frames no evaluate in frame.
if (this.exec_state_.frameCount() == 0) { if (this.exec_state_.frameCount() == 0) {
return response.failed('No frames'); return response.failed('No frames');
...@@ -1931,13 +1904,11 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) { ...@@ -1931,13 +1904,11 @@ DebugCommandProcessor.prototype.evaluateRequest_ = function(request, response) {
return response.failed('Invalid frame "' + frame + '"'); return response.failed('Invalid frame "' + frame + '"');
} }
// Evaluate in the specified frame. // Evaluate in the specified frame.
response.body = this.exec_state_.frame(frame_number).evaluate( response.body = this.exec_state_.frame(frame_number).evaluate(expression);
expression, TO_BOOLEAN(disable_break), additional_context_object);
return; return;
} else { } else {
// Evaluate in the selected frame. // Evaluate in the selected frame.
response.body = this.exec_state_.frame().evaluate( response.body = this.exec_state_.frame().evaluate(expression);
expression, TO_BOOLEAN(disable_break), additional_context_object);
return; return;
} }
}; };
......
...@@ -2011,14 +2011,11 @@ FrameMirror.prototype.allScopes = function(opt_ignore_nested_scopes) { ...@@ -2011,14 +2011,11 @@ FrameMirror.prototype.allScopes = function(opt_ignore_nested_scopes) {
}; };
FrameMirror.prototype.evaluate = function(source, disable_break, FrameMirror.prototype.evaluate = function(source) {
opt_context_object) {
return MakeMirror(%DebugEvaluate(this.break_id_, return MakeMirror(%DebugEvaluate(this.break_id_,
this.details_.frameId(), this.details_.frameId(),
this.details_.inlinedFrameIndex(), this.details_.inlinedFrameIndex(),
source, source));
TO_BOOLEAN(disable_break),
opt_context_object));
}; };
......
...@@ -493,7 +493,7 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror) ...@@ -493,7 +493,7 @@ DebuggerScript._frameMirrorToJSCallFrame = function(frameMirror)
*/ */
function evaluate(expression) function evaluate(expression)
{ {
return frameMirror.evaluate(expression, false).value(); return frameMirror.evaluate(expression).value();
} }
/** @return {undefined} */ /** @return {undefined} */
......
...@@ -171,10 +171,8 @@ function ExecutionState() {} ...@@ -171,10 +171,8 @@ function ExecutionState() {}
/** /**
* @param {string} source * @param {string} source
* @param {boolean} disableBreak
* @param {*=} additionalContext
*/ */
ExecutionState.prototype.evaluateGlobal = function(source, disableBreak, additionalContext) {} ExecutionState.prototype.evaluateGlobal = function(source) {}
/** @return {number} */ /** @return {number} */
ExecutionState.prototype.frameCount = function() {} ExecutionState.prototype.frameCount = function() {}
...@@ -439,9 +437,8 @@ FrameMirror.prototype.script = function() {} ...@@ -439,9 +437,8 @@ FrameMirror.prototype.script = function() {}
/** /**
* @param {string} source * @param {string} source
* @param {boolean} disableBreak
*/ */
FrameMirror.prototype.evaluate = function(source, disableBreak) {} FrameMirror.prototype.evaluate = function(source) {}
FrameMirror.prototype.restart = function() {} FrameMirror.prototype.restart = function() {}
......
...@@ -1243,21 +1243,19 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluate) { ...@@ -1243,21 +1243,19 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluate) {
// Check the execution state and decode arguments frame and source to be // Check the execution state and decode arguments frame and source to be
// evaluated. // evaluated.
DCHECK(args.length() == 6); DCHECK(args.length() == 4);
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
CHECK(isolate->debug()->CheckExecutionState(break_id)); CHECK(isolate->debug()->CheckExecutionState(break_id));
CONVERT_SMI_ARG_CHECKED(wrapped_id, 1); CONVERT_SMI_ARG_CHECKED(wrapped_id, 1);
CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]); CONVERT_NUMBER_CHECKED(int, inlined_jsframe_index, Int32, args[2]);
CONVERT_ARG_HANDLE_CHECKED(String, source, 3); 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); StackFrame::Id id = DebugFrameHelper::UnwrapFrameId(wrapped_id);
RETURN_RESULT_OR_FAILURE( RETURN_RESULT_OR_FAILURE(
isolate, DebugEvaluate::Local(isolate, id, inlined_jsframe_index, source, isolate,
disable_break, context_extension)); DebugEvaluate::Local(isolate, id, inlined_jsframe_index, source));
} }
...@@ -1266,17 +1264,13 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluateGlobal) { ...@@ -1266,17 +1264,13 @@ RUNTIME_FUNCTION(Runtime_DebugEvaluateGlobal) {
// Check the execution state and decode arguments frame and source to be // Check the execution state and decode arguments frame and source to be
// evaluated. // evaluated.
DCHECK(args.length() == 4); DCHECK(args.length() == 2);
CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]); CONVERT_NUMBER_CHECKED(int, break_id, Int32, args[0]);
CHECK(isolate->debug()->CheckExecutionState(break_id)); CHECK(isolate->debug()->CheckExecutionState(break_id));
CONVERT_ARG_HANDLE_CHECKED(String, source, 1); 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( RETURN_RESULT_OR_FAILURE(isolate, DebugEvaluate::Global(isolate, source));
isolate,
DebugEvaluate::Global(isolate, source, disable_break, context_extension));
} }
......
...@@ -173,8 +173,8 @@ namespace internal { ...@@ -173,8 +173,8 @@ namespace internal {
F(PrepareStep, 2, 1) \ F(PrepareStep, 2, 1) \
F(PrepareStepFrame, 0, 1) \ F(PrepareStepFrame, 0, 1) \
F(ClearStepping, 0, 1) \ F(ClearStepping, 0, 1) \
F(DebugEvaluate, 6, 1) \ F(DebugEvaluate, 4, 1) \
F(DebugEvaluateGlobal, 4, 1) \ F(DebugEvaluateGlobal, 2, 1) \
F(DebugGetLoadedScripts, 0, 1) \ F(DebugGetLoadedScripts, 0, 1) \
F(DebugReferencedBy, 3, 1) \ F(DebugReferencedBy, 3, 1) \
F(DebugConstructedBy, 2, 1) \ F(DebugConstructedBy, 2, 1) \
......
...@@ -4037,7 +4037,7 @@ TEST(DisableBreak) { ...@@ -4037,7 +4037,7 @@ TEST(DisableBreak) {
{ {
v8::Debug::DebugBreak(env->GetIsolate()); v8::Debug::DebugBreak(env->GetIsolate());
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(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(); f->Call(context, env->Global(), 0, NULL).ToLocalChecked();
CHECK_EQ(1, break_point_hit_count); CHECK_EQ(1, break_point_hit_count);
} }
......
...@@ -252,7 +252,7 @@ TEST(FlagsRemoveIncomplete) { ...@@ -252,7 +252,7 @@ TEST(FlagsRemoveIncomplete) {
// if the list of arguments ends unexpectedly. // if the list of arguments ends unexpectedly.
SetFlagsToDefault(); SetFlagsToDefault();
int argc = 3; int argc = 3;
const char* argv[] = { "", "--crankshaft", "--expose-debug-as" }; const char* argv[] = {"", "--crankshaft", "--expose-natives-as"};
CHECK_EQ(2, FlagList::SetFlagsFromCommandLine(&argc, CHECK_EQ(2, FlagList::SetFlagsFromCommandLine(&argc,
const_cast<char **>(argv), const_cast<char **>(argv),
true)); true));
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // 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 = {}; var __v_33 = {};
__v_4 = 70000; __v_4 = 70000;
......
// 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 @@ ...@@ -25,7 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // 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. // Get the Debug object exposed from the debug context global object.
Debug = debug.Debug Debug = debug.Debug
var exception = false; var exception = false;
...@@ -48,11 +47,11 @@ function listener(event, exec_state, event_data, data) { ...@@ -48,11 +47,11 @@ function listener(event, exec_state, event_data, data) {
// debugger code. // debugger code.
exec_state.frame(0).evaluate( exec_state.frame(0).evaluate(
"print('A');\n" + "print('A');\n" +
"debugger; // BREAK\n" + "debugger;\n" +
"print('B'); // BREAK"); "print('B');");
break; break;
case 1: case 1:
exec_state.prepareStep(Debug.StepAction.StepNext); assertUnreachable();
break; break;
} }
} }
......
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