Debugger: remove unused JS Debugger API.

R=ulan@chromium.org

Review URL: https://codereview.chromium.org/1005053004

Cr-Commit-Position: refs/heads/master@{#27464}
This commit is contained in:
yangguo 2015-03-26 01:15:32 -07:00 committed by Commit bot
parent 2ec0f32abb
commit 46cc8740a9
9 changed files with 44 additions and 88 deletions

View File

@ -264,7 +264,7 @@ function ScriptBreakPoint(type, script_id_or_name, opt_line, opt_column,
}
//Creates a clone of script breakpoint that is linked to another script.
// Creates a clone of script breakpoint that is linked to another script.
ScriptBreakPoint.prototype.cloneForOtherScript = function (other_script) {
var copy = new ScriptBreakPoint(Debug.ScriptBreakPointType.ScriptId,
other_script.id, this.line_, this.column_, this.groupId_,
@ -499,10 +499,6 @@ Debug.setListener = function(listener, opt_data) {
};
Debug.breakExecution = function(f) {
%Break();
};
Debug.breakLocations = function(f, opt_position_aligment) {
if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.');
var position_aligment = IS_UNDEFINED(opt_position_aligment)
@ -552,25 +548,12 @@ Debug.scriptSource = function(func_or_script_name) {
return this.findScript(func_or_script_name).source;
};
Debug.source = function(f) {
if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.');
return %FunctionGetSourceCode(f);
};
Debug.disassemble = function(f) {
if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.');
return %DebugDisassembleFunction(f);
};
Debug.disassembleConstructor = function(f) {
if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.');
return %DebugDisassembleConstructor(f);
};
Debug.ExecuteInDebugContext = function(f, without_debugger) {
if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.');
return %ExecuteInDebugContext(f, !!without_debugger);
};
Debug.sourcePosition = function(f) {
if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.');
@ -2584,7 +2567,3 @@ function ValueToProtocolValue_(value, mirror_serializer) {
}
return json;
}
Debug.TestApi = {
CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_
};

View File

@ -54,7 +54,7 @@ RUNTIME_FUNCTION(Runtime_SetDebugEventListener) {
}
RUNTIME_FUNCTION(Runtime_Break) {
RUNTIME_FUNCTION(Runtime_ScheduleBreak) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 0);
isolate->stack_guard()->RequestDebugBreak();
@ -2572,40 +2572,6 @@ RUNTIME_FUNCTION(Runtime_DebugSetScriptSource) {
}
RUNTIME_FUNCTION(Runtime_DebugDisassembleFunction) {
HandleScope scope(isolate);
#ifdef DEBUG
DCHECK(args.length() == 1);
// Get the function and make sure it is compiled.
CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
if (!Compiler::EnsureCompiled(func, KEEP_EXCEPTION)) {
return isolate->heap()->exception();
}
OFStream os(stdout);
func->code()->Print(os);
os << std::endl;
#endif // DEBUG
return isolate->heap()->undefined_value();
}
RUNTIME_FUNCTION(Runtime_DebugDisassembleConstructor) {
HandleScope scope(isolate);
#ifdef DEBUG
DCHECK(args.length() == 1);
// Get the function and make sure it is compiled.
CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
if (!Compiler::EnsureCompiled(func, KEEP_EXCEPTION)) {
return isolate->heap()->exception();
}
OFStream os(stdout);
func->shared()->construct_stub()->Print(os);
os << std::endl;
#endif // DEBUG
return isolate->heap()->undefined_value();
}
RUNTIME_FUNCTION(Runtime_FunctionGetInferredName) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 1);
@ -2666,21 +2632,15 @@ RUNTIME_FUNCTION(Runtime_GetFunctionCodePositionFromSource) {
// to have a stack with C++ frame in the middle.
RUNTIME_FUNCTION(Runtime_ExecuteInDebugContext) {
HandleScope scope(isolate);
DCHECK(args.length() == 2);
DCHECK(args.length() == 1);
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
CONVERT_BOOLEAN_ARG_CHECKED(without_debugger, 1);
MaybeHandle<Object> maybe_result;
if (without_debugger) {
maybe_result = Execution::Call(isolate, function,
handle(function->global_proxy()), 0, NULL);
} else {
DebugScope debug_scope(isolate->debug());
maybe_result = Execution::Call(isolate, function,
handle(function->global_proxy()), 0, NULL);
}
DebugScope debug_scope(isolate->debug());
Handle<Object> result;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, maybe_result);
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
Execution::Call(isolate, function, handle(function->global_proxy()), 0,
NULL));
return *result;
}

View File

@ -376,6 +376,23 @@ RUNTIME_FUNCTION(Runtime_GetV8Version) {
}
RUNTIME_FUNCTION(Runtime_DisassembleFunction) {
HandleScope scope(isolate);
#ifdef DEBUG
DCHECK(args.length() == 1);
// Get the function and make sure it is compiled.
CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
if (!Compiler::EnsureCompiled(func, KEEP_EXCEPTION)) {
return isolate->heap()->exception();
}
OFStream os(stdout);
func->code()->Print(os);
os << std::endl;
#endif // DEBUG
return isolate->heap()->undefined_value();
}
static int StackSize(Isolate* isolate) {
int n = 0;
for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) n++;

View File

@ -420,6 +420,7 @@ namespace internal {
F(HasFastProperties, 1, 1) \
F(TransitionElementsKind, 2, 1) \
F(HaveSameMap, 2, 1) \
F(DisassembleFunction, 1, 1) \
F(IsJSGlobalProxy, 1, 1) \
F(ForInCacheArrayLength, 2, 1) /* TODO(turbofan): Only temporary */
@ -522,7 +523,7 @@ namespace internal {
/* Debugger support*/ \
F(DebugBreak, 0, 1) \
F(SetDebugEventListener, 2, 1) \
F(Break, 0, 1) \
F(ScheduleBreak, 0, 1) \
F(DebugGetPropertyDetails, 2, 1) \
F(DebugGetProperty, 2, 1) \
F(DebugPropertyTypeFromDetails, 1, 1) \
@ -561,8 +562,6 @@ namespace internal {
F(DebugSetScriptSource, 2, 1) \
F(DebugCallbackSupportsStepping, 1, 1) \
F(SystemBreak, 0, 1) \
F(DebugDisassembleFunction, 1, 1) \
F(DebugDisassembleConstructor, 1, 1) \
F(FunctionGetInferredName, 1, 1) \
F(FunctionGetDebugName, 1, 1) \
F(LiveEditFindSharedFunctionInfosForScript, 1, 1) \
@ -577,7 +576,7 @@ namespace internal {
F(LiveEditCompareStrings, 2, 1) \
F(LiveEditRestartFrame, 2, 1) \
F(GetFunctionCodePositionFromSource, 2, 1) \
F(ExecuteInDebugContext, 2, 1) \
F(ExecuteInDebugContext, 1, 1) \
\
F(SetFlags, 1, 1) \
F(CollectGarbage, 1, 1) \

View File

@ -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: --expose-debug-as debug
// Flags: --expose-debug-as debug --allow-natives-syntax
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug
@ -87,13 +87,13 @@ function WrapInCatcher(f, holder) {
function WrapInNativeCall(f) {
return function() {
return Debug.ExecuteInDebugContext(f, true);
return %Call(undefined, f);
};
}
function WrapInDebuggerCall(f) {
return function() {
return Debug.ExecuteInDebugContext(f, false);
return %ExecuteInDebugContext(f);
};
}

View File

@ -29,6 +29,7 @@
// Get the Debug object exposed from the debug context global object.
var Debug = debug.Debug;
var DebugCommandProcessor = debug.DebugCommandProcessor;
// Accepts a function/closure 'fun' that must have a debugger statement inside.
// A variable 'variable_name' must be initialized before debugger statement
@ -291,18 +292,18 @@ RunPauseTest(0, 5, 'p', 2012, 2012, (function Factory() {
// Test value description protocol JSON
assertEquals(true, Debug.TestApi.CommandProcessorResolveValue({value: true}));
assertEquals(true, DebugCommandProcessor.resolveValue_({value: true}));
assertSame(null, Debug.TestApi.CommandProcessorResolveValue({type: "null"}));
assertSame(null, DebugCommandProcessor.resolveValue_({type: "null"}));
assertSame(undefined,
Debug.TestApi.CommandProcessorResolveValue({type: "undefined"}));
DebugCommandProcessor.resolveValue_({type: "undefined"}));
assertSame("123", Debug.TestApi.CommandProcessorResolveValue(
assertSame("123", DebugCommandProcessor.resolveValue_(
{type: "string", stringDescription: "123"}));
assertSame(123, Debug.TestApi.CommandProcessorResolveValue(
assertSame(123, DebugCommandProcessor.resolveValue_(
{type: "number", stringDescription: "123"}));
assertSame(Number, Debug.TestApi.CommandProcessorResolveValue(
assertSame(Number, DebugCommandProcessor.resolveValue_(
{handle: Debug.MakeMirror(Number).handle()}));
assertSame(RunClosureTest, Debug.TestApi.CommandProcessorResolveValue(
assertSame(RunClosureTest, DebugCommandProcessor.resolveValue_(
{handle: Debug.MakeMirror(RunClosureTest).handle()}));

View File

@ -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: --expose-debug-as debug
// Flags: --expose-debug-as debug --allow-natives-syntax
var Debug = debug.Debug;
var LiveEdit = Debug.LiveEdit;
@ -54,7 +54,7 @@ function patch(fun, from, to) {
print("Change log: " + JSON.stringify(log) + "\n");
}
}
Debug.ExecuteInDebugContext(debug, false);
%ExecuteInDebugContext(debug);
}
// Try to edit a MakeGenerator while it's running, then again while it's

View File

@ -58,4 +58,4 @@ f(10, o3);
// The old code is already deoptimized, but f still points to it.
// Disassembling it will crash.
%DebugDisassembleFunction(f);
%DisassembleFunction(f);

View File

@ -4,7 +4,7 @@
// Flags: --stack-size=200 --allow-natives-syntax
%Break(); // Schedule an interrupt that does not go away.
%ScheduleBreak(); // Schedule an interrupt that does not go away.
function f() { f(); }
assertThrows(f, RangeError);