 Chromium Code Reviews
 Chromium Code Reviews Issue 10078014:
  Enable stepping into callback passed to builtins (e.g. Array.forEach).  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
    
  
    Issue 10078014:
  Enable stepping into callback passed to builtins (e.g. Array.forEach).  (Closed) 
  Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge| Index: src/runtime.cc | 
| diff --git a/src/runtime.cc b/src/runtime.cc | 
| index d8da56ced5a4bc7c9f6e9b2f23226f3f5e1bc155..60779388443b3003ee4a52371cad344e1501c5ac 100644 | 
| --- a/src/runtime.cc | 
| +++ b/src/runtime.cc | 
| @@ -4696,6 +4696,36 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreArrayLiteralElement) { | 
| } | 
| +// Check whether debugger and is about to step into the callback that is passed | 
| +// to a built-in function such as Array.forEach. | 
| +RUNTIME_FUNCTION(MaybeObject*, Runtime_DebugStepIntoBuiltinCallback) { | 
| + if (!isolate->IsDebuggerActive()) return isolate->heap()->false_value(); | 
| + CONVERT_ARG_CHECKED(Object, callback, 0); | 
| + // We do not step into the callback if it's a builtin or not even a function. | 
| + if (!callback->IsJSFunction() || JSFunction::cast(callback)->IsBuiltin()) { | 
| + return isolate->heap()->false_value(); | 
| + } | 
| + return isolate->heap()->true_value(); | 
| +} | 
| + | 
| + | 
| +// Set break slots for the callback function that is passed to a buil-tin | 
| 
Søren Gjesse
2012/04/20 08:33:25
"break slots" -> "one shot breakpoints"
 
Yang
2012/04/20 11:06:54
Done.
 | 
| +// function such as Array.forEach to enables stepping into callback functions. | 
| +RUNTIME_FUNCTION(MaybeObject*, Runtime_PrepareBreakSlotsForCallback) { | 
| + Debug* debug = isolate->debug(); | 
| + if (!debug->IsStepping()) return NULL; | 
| + CONVERT_ARG_CHECKED(Object, callback, 0); | 
| + HandleScope scope(isolate); | 
| + Handle<SharedFunctionInfo> shared_info(JSFunction::cast(callback)->shared()); | 
| + // When leaving the callback, step out has been activated, but not performed | 
| + // if we do not leave the builtin. To be able to step into the callback | 
| + // again, we need to clear the step out at this point. | 
| + debug->ClearStepOut(); | 
| + debug->FloodWithOneShot(shared_info); | 
| + return NULL; | 
| +} | 
| + | 
| + | 
| // Set a local property, even if it is READ_ONLY. If the property does not | 
| // exist, it will be added with attributes NONE. | 
| RUNTIME_FUNCTION(MaybeObject*, Runtime_IgnoreAttributesAndSetProperty) { |