Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Side by Side Diff: src/runtime.cc

Issue 23533015: Debug: parameterize 'step over' action with a frame where the step must be performed (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 12532 matching lines...) Expand 10 before | Expand all | Expand 10 after
12543 } 12543 }
12544 12544
12545 12545
12546 // Prepare for stepping 12546 // Prepare for stepping
12547 // args[0]: break id for checking execution state 12547 // args[0]: break id for checking execution state
12548 // args[1]: step action from the enumeration StepAction 12548 // args[1]: step action from the enumeration StepAction
12549 // args[2]: number of times to perform the step, for step out it is the number 12549 // args[2]: number of times to perform the step, for step out it is the number
12550 // of frames to step down. 12550 // of frames to step down.
12551 RUNTIME_FUNCTION(MaybeObject*, Runtime_PrepareStep) { 12551 RUNTIME_FUNCTION(MaybeObject*, Runtime_PrepareStep) {
12552 HandleScope scope(isolate); 12552 HandleScope scope(isolate);
12553 ASSERT(args.length() == 3); 12553 ASSERT(args.length() == 4);
12554 // Check arguments. 12554 // Check arguments.
12555 Object* check; 12555 Object* check;
12556 { MaybeObject* maybe_check = Runtime_CheckExecutionState( 12556 { MaybeObject* maybe_check = Runtime_CheckExecutionState(
12557 RUNTIME_ARGUMENTS(isolate, args)); 12557 RUNTIME_ARGUMENTS(isolate, args));
12558 if (!maybe_check->ToObject(&check)) return maybe_check; 12558 if (!maybe_check->ToObject(&check)) return maybe_check;
12559 } 12559 }
12560 if (!args[1]->IsNumber() || !args[2]->IsNumber()) { 12560 if (!args[1]->IsNumber() || !args[2]->IsNumber()) {
12561 return isolate->Throw(isolate->heap()->illegal_argument_string()); 12561 return isolate->Throw(isolate->heap()->illegal_argument_string());
12562 } 12562 }
12563 12563
12564 CONVERT_NUMBER_CHECKED(int, wrapped_frame_id, Int32, args[3]);
12565
12566 StackFrame::Id frame_id;
12567 if (wrapped_frame_id == 0) {
12568 frame_id = StackFrame::NO_ID;
12569 } else {
12570 frame_id = UnwrapFrameId(wrapped_frame_id);
12571 }
12572
12564 // Get the step action and check validity. 12573 // Get the step action and check validity.
12565 StepAction step_action = static_cast<StepAction>(NumberToInt32(args[1])); 12574 StepAction step_action = static_cast<StepAction>(NumberToInt32(args[1]));
12566 if (step_action != StepIn && 12575 if (step_action != StepIn &&
12567 step_action != StepNext && 12576 step_action != StepNext &&
12568 step_action != StepOut && 12577 step_action != StepOut &&
12569 step_action != StepInMin && 12578 step_action != StepInMin &&
12570 step_action != StepMin) { 12579 step_action != StepMin) {
12571 return isolate->Throw(isolate->heap()->illegal_argument_string()); 12580 return isolate->Throw(isolate->heap()->illegal_argument_string());
12572 } 12581 }
12573 12582
12583 if (frame_id != 0 && step_action != StepNext && step_action != StepMin &&
Yang 2013/09/05 15:19:54 probably better to compare frame_id to StackFrame:
Peter.Rybin 2013/09/05 16:58:21 Done.
12584 step_action != StepOut) {
12585 return isolate->ThrowIllegalOperation();
12586 }
12587
12574 // Get the number of steps. 12588 // Get the number of steps.
12575 int step_count = NumberToInt32(args[2]); 12589 int step_count = NumberToInt32(args[2]);
12576 if (step_count < 1) { 12590 if (step_count < 1) {
12577 return isolate->Throw(isolate->heap()->illegal_argument_string()); 12591 return isolate->Throw(isolate->heap()->illegal_argument_string());
12578 } 12592 }
12579 12593
12580 // Clear all current stepping setup. 12594 // Clear all current stepping setup.
12581 isolate->debug()->ClearStepping(); 12595 isolate->debug()->ClearStepping();
12582 12596
12583 // Prepare step. 12597 // Prepare step.
12584 isolate->debug()->PrepareStep(static_cast<StepAction>(step_action), 12598 isolate->debug()->PrepareStep(static_cast<StepAction>(step_action),
12585 step_count); 12599 step_count, frame_id);
Yang 2013/09/05 15:19:54 put frame_id on a new line or all arguments on the
Peter.Rybin 2013/09/05 16:58:21 Done.
12586 return isolate->heap()->undefined_value(); 12600 return isolate->heap()->undefined_value();
12587 } 12601 }
12588 12602
12589 12603
12590 // Clear all stepping set by PrepareStep. 12604 // Clear all stepping set by PrepareStep.
12591 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearStepping) { 12605 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearStepping) {
12592 HandleScope scope(isolate); 12606 HandleScope scope(isolate);
12593 ASSERT(args.length() == 0); 12607 ASSERT(args.length() == 0);
12594 isolate->debug()->ClearStepping(); 12608 isolate->debug()->ClearStepping();
12595 return isolate->heap()->undefined_value(); 12609 return isolate->heap()->undefined_value();
(...skipping 2118 matching lines...) Expand 10 before | Expand all | Expand 10 after
14714 // Handle last resort GC and make sure to allow future allocations 14728 // Handle last resort GC and make sure to allow future allocations
14715 // to grow the heap without causing GCs (if possible). 14729 // to grow the heap without causing GCs (if possible).
14716 isolate->counters()->gc_last_resort_from_js()->Increment(); 14730 isolate->counters()->gc_last_resort_from_js()->Increment();
14717 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14731 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14718 "Runtime::PerformGC"); 14732 "Runtime::PerformGC");
14719 } 14733 }
14720 } 14734 }
14721 14735
14722 14736
14723 } } // namespace v8::internal 14737 } } // namespace v8::internal
OLDNEW
« src/debug-debugger.js ('K') | « src/runtime.h ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698