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

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: follow code review 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
« no previous file with comments | « src/runtime.h ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 12466 matching lines...) Expand 10 before | Expand all | Expand 10 after
12477 } 12477 }
12478 12478
12479 12479
12480 // Prepare for stepping 12480 // Prepare for stepping
12481 // args[0]: break id for checking execution state 12481 // args[0]: break id for checking execution state
12482 // args[1]: step action from the enumeration StepAction 12482 // args[1]: step action from the enumeration StepAction
12483 // args[2]: number of times to perform the step, for step out it is the number 12483 // args[2]: number of times to perform the step, for step out it is the number
12484 // of frames to step down. 12484 // of frames to step down.
12485 RUNTIME_FUNCTION(MaybeObject*, Runtime_PrepareStep) { 12485 RUNTIME_FUNCTION(MaybeObject*, Runtime_PrepareStep) {
12486 HandleScope scope(isolate); 12486 HandleScope scope(isolate);
12487 ASSERT(args.length() == 3); 12487 ASSERT(args.length() == 4);
12488 // Check arguments. 12488 // Check arguments.
12489 Object* check; 12489 Object* check;
12490 { MaybeObject* maybe_check = Runtime_CheckExecutionState( 12490 { MaybeObject* maybe_check = Runtime_CheckExecutionState(
12491 RUNTIME_ARGUMENTS(isolate, args)); 12491 RUNTIME_ARGUMENTS(isolate, args));
12492 if (!maybe_check->ToObject(&check)) return maybe_check; 12492 if (!maybe_check->ToObject(&check)) return maybe_check;
12493 } 12493 }
12494 if (!args[1]->IsNumber() || !args[2]->IsNumber()) { 12494 if (!args[1]->IsNumber() || !args[2]->IsNumber()) {
12495 return isolate->Throw(isolate->heap()->illegal_argument_string()); 12495 return isolate->Throw(isolate->heap()->illegal_argument_string());
12496 } 12496 }
12497 12497
12498 CONVERT_NUMBER_CHECKED(int, wrapped_frame_id, Int32, args[3]);
12499
12500 StackFrame::Id frame_id;
12501 if (wrapped_frame_id == 0) {
12502 frame_id = StackFrame::NO_ID;
12503 } else {
12504 frame_id = UnwrapFrameId(wrapped_frame_id);
12505 }
12506
12498 // Get the step action and check validity. 12507 // Get the step action and check validity.
12499 StepAction step_action = static_cast<StepAction>(NumberToInt32(args[1])); 12508 StepAction step_action = static_cast<StepAction>(NumberToInt32(args[1]));
12500 if (step_action != StepIn && 12509 if (step_action != StepIn &&
12501 step_action != StepNext && 12510 step_action != StepNext &&
12502 step_action != StepOut && 12511 step_action != StepOut &&
12503 step_action != StepInMin && 12512 step_action != StepInMin &&
12504 step_action != StepMin) { 12513 step_action != StepMin) {
12505 return isolate->Throw(isolate->heap()->illegal_argument_string()); 12514 return isolate->Throw(isolate->heap()->illegal_argument_string());
12506 } 12515 }
12507 12516
12517 if (frame_id != StackFrame::NO_ID && step_action != StepNext &&
12518 step_action != StepMin && step_action != StepOut) {
12519 return isolate->ThrowIllegalOperation();
12520 }
12521
12508 // Get the number of steps. 12522 // Get the number of steps.
12509 int step_count = NumberToInt32(args[2]); 12523 int step_count = NumberToInt32(args[2]);
12510 if (step_count < 1) { 12524 if (step_count < 1) {
12511 return isolate->Throw(isolate->heap()->illegal_argument_string()); 12525 return isolate->Throw(isolate->heap()->illegal_argument_string());
12512 } 12526 }
12513 12527
12514 // Clear all current stepping setup. 12528 // Clear all current stepping setup.
12515 isolate->debug()->ClearStepping(); 12529 isolate->debug()->ClearStepping();
12516 12530
12517 // Prepare step. 12531 // Prepare step.
12518 isolate->debug()->PrepareStep(static_cast<StepAction>(step_action), 12532 isolate->debug()->PrepareStep(static_cast<StepAction>(step_action),
12519 step_count); 12533 step_count,
12534 frame_id);
12520 return isolate->heap()->undefined_value(); 12535 return isolate->heap()->undefined_value();
12521 } 12536 }
12522 12537
12523 12538
12524 // Clear all stepping set by PrepareStep. 12539 // Clear all stepping set by PrepareStep.
12525 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearStepping) { 12540 RUNTIME_FUNCTION(MaybeObject*, Runtime_ClearStepping) {
12526 HandleScope scope(isolate); 12541 HandleScope scope(isolate);
12527 ASSERT(args.length() == 0); 12542 ASSERT(args.length() == 0);
12528 isolate->debug()->ClearStepping(); 12543 isolate->debug()->ClearStepping();
12529 return isolate->heap()->undefined_value(); 12544 return isolate->heap()->undefined_value();
(...skipping 2129 matching lines...) Expand 10 before | Expand all | Expand 10 after
14659 // Handle last resort GC and make sure to allow future allocations 14674 // Handle last resort GC and make sure to allow future allocations
14660 // to grow the heap without causing GCs (if possible). 14675 // to grow the heap without causing GCs (if possible).
14661 isolate->counters()->gc_last_resort_from_js()->Increment(); 14676 isolate->counters()->gc_last_resort_from_js()->Increment();
14662 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14677 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14663 "Runtime::PerformGC"); 14678 "Runtime::PerformGC");
14664 } 14679 }
14665 } 14680 }
14666 14681
14667 14682
14668 } } // namespace v8::internal 14683 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/runtime.h ('k') | test/cctest/test-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698