Skip to content

Commit 46cc874

Browse files
hashseedCommit bot
authored andcommitted
Debugger: remove unused JS Debugger API.
R=ulan@chromium.org Review URL: https://codereview.chromium.org/1005053004 Cr-Commit-Position: refs/heads/master@{#27464}
1 parent 2ec0f32 commit 46cc874

9 files changed

Lines changed: 44 additions & 88 deletions

src/debug-debugger.js

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ function ScriptBreakPoint(type, script_id_or_name, opt_line, opt_column,
264264
}
265265

266266

267-
//Creates a clone of script breakpoint that is linked to another script.
267+
// Creates a clone of script breakpoint that is linked to another script.
268268
ScriptBreakPoint.prototype.cloneForOtherScript = function (other_script) {
269269
var copy = new ScriptBreakPoint(Debug.ScriptBreakPointType.ScriptId,
270270
other_script.id, this.line_, this.column_, this.groupId_,
@@ -499,10 +499,6 @@ Debug.setListener = function(listener, opt_data) {
499499
};
500500

501501

502-
Debug.breakExecution = function(f) {
503-
%Break();
504-
};
505-
506502
Debug.breakLocations = function(f, opt_position_aligment) {
507503
if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.');
508504
var position_aligment = IS_UNDEFINED(opt_position_aligment)
@@ -552,25 +548,12 @@ Debug.scriptSource = function(func_or_script_name) {
552548
return this.findScript(func_or_script_name).source;
553549
};
554550

551+
555552
Debug.source = function(f) {
556553
if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.');
557554
return %FunctionGetSourceCode(f);
558555
};
559556

560-
Debug.disassemble = function(f) {
561-
if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.');
562-
return %DebugDisassembleFunction(f);
563-
};
564-
565-
Debug.disassembleConstructor = function(f) {
566-
if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.');
567-
return %DebugDisassembleConstructor(f);
568-
};
569-
570-
Debug.ExecuteInDebugContext = function(f, without_debugger) {
571-
if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.');
572-
return %ExecuteInDebugContext(f, !!without_debugger);
573-
};
574557

575558
Debug.sourcePosition = function(f) {
576559
if (!IS_FUNCTION(f)) throw new Error('Parameters have wrong types.');
@@ -2584,7 +2567,3 @@ function ValueToProtocolValue_(value, mirror_serializer) {
25842567
}
25852568
return json;
25862569
}
2587-
2588-
Debug.TestApi = {
2589-
CommandProcessorResolveValue: DebugCommandProcessor.resolveValue_
2590-
};

src/runtime/runtime-debug.cc

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ RUNTIME_FUNCTION(Runtime_SetDebugEventListener) {
5454
}
5555

5656

57-
RUNTIME_FUNCTION(Runtime_Break) {
57+
RUNTIME_FUNCTION(Runtime_ScheduleBreak) {
5858
SealHandleScope shs(isolate);
5959
DCHECK(args.length() == 0);
6060
isolate->stack_guard()->RequestDebugBreak();
@@ -2572,40 +2572,6 @@ RUNTIME_FUNCTION(Runtime_DebugSetScriptSource) {
25722572
}
25732573

25742574

2575-
RUNTIME_FUNCTION(Runtime_DebugDisassembleFunction) {
2576-
HandleScope scope(isolate);
2577-
#ifdef DEBUG
2578-
DCHECK(args.length() == 1);
2579-
// Get the function and make sure it is compiled.
2580-
CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
2581-
if (!Compiler::EnsureCompiled(func, KEEP_EXCEPTION)) {
2582-
return isolate->heap()->exception();
2583-
}
2584-
OFStream os(stdout);
2585-
func->code()->Print(os);
2586-
os << std::endl;
2587-
#endif // DEBUG
2588-
return isolate->heap()->undefined_value();
2589-
}
2590-
2591-
2592-
RUNTIME_FUNCTION(Runtime_DebugDisassembleConstructor) {
2593-
HandleScope scope(isolate);
2594-
#ifdef DEBUG
2595-
DCHECK(args.length() == 1);
2596-
// Get the function and make sure it is compiled.
2597-
CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
2598-
if (!Compiler::EnsureCompiled(func, KEEP_EXCEPTION)) {
2599-
return isolate->heap()->exception();
2600-
}
2601-
OFStream os(stdout);
2602-
func->shared()->construct_stub()->Print(os);
2603-
os << std::endl;
2604-
#endif // DEBUG
2605-
return isolate->heap()->undefined_value();
2606-
}
2607-
2608-
26092575
RUNTIME_FUNCTION(Runtime_FunctionGetInferredName) {
26102576
SealHandleScope shs(isolate);
26112577
DCHECK(args.length() == 1);
@@ -2666,21 +2632,15 @@ RUNTIME_FUNCTION(Runtime_GetFunctionCodePositionFromSource) {
26662632
// to have a stack with C++ frame in the middle.
26672633
RUNTIME_FUNCTION(Runtime_ExecuteInDebugContext) {
26682634
HandleScope scope(isolate);
2669-
DCHECK(args.length() == 2);
2635+
DCHECK(args.length() == 1);
26702636
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
2671-
CONVERT_BOOLEAN_ARG_CHECKED(without_debugger, 1);
26722637

2673-
MaybeHandle<Object> maybe_result;
2674-
if (without_debugger) {
2675-
maybe_result = Execution::Call(isolate, function,
2676-
handle(function->global_proxy()), 0, NULL);
2677-
} else {
2678-
DebugScope debug_scope(isolate->debug());
2679-
maybe_result = Execution::Call(isolate, function,
2680-
handle(function->global_proxy()), 0, NULL);
2681-
}
2638+
DebugScope debug_scope(isolate->debug());
26822639
Handle<Object> result;
2683-
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, maybe_result);
2640+
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2641+
isolate, result,
2642+
Execution::Call(isolate, function, handle(function->global_proxy()), 0,
2643+
NULL));
26842644
return *result;
26852645
}
26862646

src/runtime/runtime-test.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,23 @@ RUNTIME_FUNCTION(Runtime_GetV8Version) {
376376
}
377377

378378

379+
RUNTIME_FUNCTION(Runtime_DisassembleFunction) {
380+
HandleScope scope(isolate);
381+
#ifdef DEBUG
382+
DCHECK(args.length() == 1);
383+
// Get the function and make sure it is compiled.
384+
CONVERT_ARG_HANDLE_CHECKED(JSFunction, func, 0);
385+
if (!Compiler::EnsureCompiled(func, KEEP_EXCEPTION)) {
386+
return isolate->heap()->exception();
387+
}
388+
OFStream os(stdout);
389+
func->code()->Print(os);
390+
os << std::endl;
391+
#endif // DEBUG
392+
return isolate->heap()->undefined_value();
393+
}
394+
395+
379396
static int StackSize(Isolate* isolate) {
380397
int n = 0;
381398
for (JavaScriptFrameIterator it(isolate); !it.done(); it.Advance()) n++;

src/runtime/runtime.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ namespace internal {
420420
F(HasFastProperties, 1, 1) \
421421
F(TransitionElementsKind, 2, 1) \
422422
F(HaveSameMap, 2, 1) \
423+
F(DisassembleFunction, 1, 1) \
423424
F(IsJSGlobalProxy, 1, 1) \
424425
F(ForInCacheArrayLength, 2, 1) /* TODO(turbofan): Only temporary */
425426

@@ -522,7 +523,7 @@ namespace internal {
522523
/* Debugger support*/ \
523524
F(DebugBreak, 0, 1) \
524525
F(SetDebugEventListener, 2, 1) \
525-
F(Break, 0, 1) \
526+
F(ScheduleBreak, 0, 1) \
526527
F(DebugGetPropertyDetails, 2, 1) \
527528
F(DebugGetProperty, 2, 1) \
528529
F(DebugPropertyTypeFromDetails, 1, 1) \
@@ -561,8 +562,6 @@ namespace internal {
561562
F(DebugSetScriptSource, 2, 1) \
562563
F(DebugCallbackSupportsStepping, 1, 1) \
563564
F(SystemBreak, 0, 1) \
564-
F(DebugDisassembleFunction, 1, 1) \
565-
F(DebugDisassembleConstructor, 1, 1) \
566565
F(FunctionGetInferredName, 1, 1) \
567566
F(FunctionGetDebugName, 1, 1) \
568567
F(LiveEditFindSharedFunctionInfosForScript, 1, 1) \
@@ -577,7 +576,7 @@ namespace internal {
577576
F(LiveEditCompareStrings, 2, 1) \
578577
F(LiveEditRestartFrame, 2, 1) \
579578
F(GetFunctionCodePositionFromSource, 2, 1) \
580-
F(ExecuteInDebugContext, 2, 1) \
579+
F(ExecuteInDebugContext, 1, 1) \
581580
\
582581
F(SetFlags, 1, 1) \
583582
F(CollectGarbage, 1, 1) \

test/mjsunit/debug-liveedit-check-stack.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2626
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2727

28-
// Flags: --expose-debug-as debug
28+
// Flags: --expose-debug-as debug --allow-natives-syntax
2929
// Get the Debug object exposed from the debug context global object.
3030

3131
Debug = debug.Debug
@@ -87,13 +87,13 @@ function WrapInCatcher(f, holder) {
8787

8888
function WrapInNativeCall(f) {
8989
return function() {
90-
return Debug.ExecuteInDebugContext(f, true);
90+
return %Call(undefined, f);
9191
};
9292
}
9393

9494
function WrapInDebuggerCall(f) {
9595
return function() {
96-
return Debug.ExecuteInDebugContext(f, false);
96+
return %ExecuteInDebugContext(f);
9797
};
9898
}
9999

test/mjsunit/debug-set-variable-value.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929

3030
// Get the Debug object exposed from the debug context global object.
3131
var Debug = debug.Debug;
32+
var DebugCommandProcessor = debug.DebugCommandProcessor;
3233

3334
// Accepts a function/closure 'fun' that must have a debugger statement inside.
3435
// A variable 'variable_name' must be initialized before debugger statement
@@ -291,18 +292,18 @@ RunPauseTest(0, 5, 'p', 2012, 2012, (function Factory() {
291292

292293
// Test value description protocol JSON
293294

294-
assertEquals(true, Debug.TestApi.CommandProcessorResolveValue({value: true}));
295+
assertEquals(true, DebugCommandProcessor.resolveValue_({value: true}));
295296

296-
assertSame(null, Debug.TestApi.CommandProcessorResolveValue({type: "null"}));
297+
assertSame(null, DebugCommandProcessor.resolveValue_({type: "null"}));
297298
assertSame(undefined,
298-
Debug.TestApi.CommandProcessorResolveValue({type: "undefined"}));
299+
DebugCommandProcessor.resolveValue_({type: "undefined"}));
299300

300-
assertSame("123", Debug.TestApi.CommandProcessorResolveValue(
301+
assertSame("123", DebugCommandProcessor.resolveValue_(
301302
{type: "string", stringDescription: "123"}));
302-
assertSame(123, Debug.TestApi.CommandProcessorResolveValue(
303+
assertSame(123, DebugCommandProcessor.resolveValue_(
303304
{type: "number", stringDescription: "123"}));
304305

305-
assertSame(Number, Debug.TestApi.CommandProcessorResolveValue(
306+
assertSame(Number, DebugCommandProcessor.resolveValue_(
306307
{handle: Debug.MakeMirror(Number).handle()}));
307-
assertSame(RunClosureTest, Debug.TestApi.CommandProcessorResolveValue(
308+
assertSame(RunClosureTest, DebugCommandProcessor.resolveValue_(
308309
{handle: Debug.MakeMirror(RunClosureTest).handle()}));

test/mjsunit/es6/generators-debug-liveedit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
// Flags: --expose-debug-as debug
5+
// Flags: --expose-debug-as debug --allow-natives-syntax
66

77
var Debug = debug.Debug;
88
var LiveEdit = Debug.LiveEdit;
@@ -54,7 +54,7 @@ function patch(fun, from, to) {
5454
print("Change log: " + JSON.stringify(log) + "\n");
5555
}
5656
}
57-
Debug.ExecuteInDebugContext(debug, false);
57+
%ExecuteInDebugContext(debug);
5858
}
5959

6060
// Try to edit a MakeGenerator while it's running, then again while it's

test/mjsunit/regress/regress-330046.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ f(10, o3);
5858

5959
// The old code is already deoptimized, but f still points to it.
6060
// Disassembling it will crash.
61-
%DebugDisassembleFunction(f);
61+
%DisassembleFunction(f);

test/mjsunit/regress/regress-crbug-385002.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
// Flags: --stack-size=200 --allow-natives-syntax
66

7-
%Break(); // Schedule an interrupt that does not go away.
7+
%ScheduleBreak(); // Schedule an interrupt that does not go away.
88

99
function f() { f(); }
1010
assertThrows(f, RangeError);

0 commit comments

Comments
 (0)