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

Side by Side Diff: src/runtime.cc

Issue 200041: Support stepping out for recursive functions (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 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/debug.cc ('k') | test/mjsunit/debug-stepout-recursive-function.js » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 6915 matching lines...) Expand 10 before | Expand all | Expand 10 after
6926 static_cast<ExceptionBreakType>(NumberToUint32(args[0])); 6926 static_cast<ExceptionBreakType>(NumberToUint32(args[0]));
6927 bool enable = args[1]->ToBoolean()->IsTrue(); 6927 bool enable = args[1]->ToBoolean()->IsTrue();
6928 Debug::ChangeBreakOnException(type, enable); 6928 Debug::ChangeBreakOnException(type, enable);
6929 return Heap::undefined_value(); 6929 return Heap::undefined_value();
6930 } 6930 }
6931 6931
6932 6932
6933 // Prepare for stepping 6933 // Prepare for stepping
6934 // args[0]: break id for checking execution state 6934 // args[0]: break id for checking execution state
6935 // args[1]: step action from the enumeration StepAction 6935 // args[1]: step action from the enumeration StepAction
6936 // args[2]: number of times to perform the step 6936 // args[2]: number of times to perform the step, for step out it is the number
6937 // of frames to step down.
6937 static Object* Runtime_PrepareStep(Arguments args) { 6938 static Object* Runtime_PrepareStep(Arguments args) {
6938 HandleScope scope; 6939 HandleScope scope;
6939 ASSERT(args.length() == 3); 6940 ASSERT(args.length() == 3);
6940 // Check arguments. 6941 // Check arguments.
6941 Object* check = Runtime_CheckExecutionState(args); 6942 Object* check = Runtime_CheckExecutionState(args);
6942 if (check->IsFailure()) return check; 6943 if (check->IsFailure()) return check;
6943 if (!args[1]->IsNumber() || !args[2]->IsNumber()) { 6944 if (!args[1]->IsNumber() || !args[2]->IsNumber()) {
6944 return Top::Throw(Heap::illegal_argument_symbol()); 6945 return Top::Throw(Heap::illegal_argument_symbol());
6945 } 6946 }
6946 6947
6947 // Get the step action and check validity. 6948 // Get the step action and check validity.
6948 StepAction step_action = static_cast<StepAction>(NumberToInt32(args[1])); 6949 StepAction step_action = static_cast<StepAction>(NumberToInt32(args[1]));
6949 if (step_action != StepIn && 6950 if (step_action != StepIn &&
6950 step_action != StepNext && 6951 step_action != StepNext &&
6951 step_action != StepOut && 6952 step_action != StepOut &&
6952 step_action != StepInMin && 6953 step_action != StepInMin &&
6953 step_action != StepMin) { 6954 step_action != StepMin) {
6954 return Top::Throw(Heap::illegal_argument_symbol()); 6955 return Top::Throw(Heap::illegal_argument_symbol());
6955 } 6956 }
6956 6957
6957 // Get the number of steps. 6958 // Get the number of steps.
6958 int step_count = NumberToInt32(args[2]); 6959 int step_count = NumberToInt32(args[2]);
6959 if (step_count < 1) { 6960 if (step_count < 1) {
6960 return Top::Throw(Heap::illegal_argument_symbol()); 6961 return Top::Throw(Heap::illegal_argument_symbol());
6961 } 6962 }
6962 6963
6964 // Clear all current stepping setup.
6965 Debug::ClearStepping();
6966
6963 // Prepare step. 6967 // Prepare step.
6964 Debug::PrepareStep(static_cast<StepAction>(step_action), step_count); 6968 Debug::PrepareStep(static_cast<StepAction>(step_action), step_count);
6965 return Heap::undefined_value(); 6969 return Heap::undefined_value();
6966 } 6970 }
6967 6971
6968 6972
6969 // Clear all stepping set by PrepareStep. 6973 // Clear all stepping set by PrepareStep.
6970 static Object* Runtime_ClearStepping(Arguments args) { 6974 static Object* Runtime_ClearStepping(Arguments args) {
6971 HandleScope scope; 6975 HandleScope scope;
6972 ASSERT(args.length() == 0); 6976 ASSERT(args.length() == 0);
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
7692 } else { 7696 } else {
7693 // Handle last resort GC and make sure to allow future allocations 7697 // Handle last resort GC and make sure to allow future allocations
7694 // to grow the heap without causing GCs (if possible). 7698 // to grow the heap without causing GCs (if possible).
7695 Counters::gc_last_resort_from_js.Increment(); 7699 Counters::gc_last_resort_from_js.Increment();
7696 Heap::CollectAllGarbage(false); 7700 Heap::CollectAllGarbage(false);
7697 } 7701 }
7698 } 7702 }
7699 7703
7700 7704
7701 } } // namespace v8::internal 7705 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.cc ('k') | test/mjsunit/debug-stepout-recursive-function.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698