| OLD | NEW | 
|     1 // Copyright 2014 the V8 project authors. All rights reserved. |     1 // Copyright 2014 the V8 project authors. All rights reserved. | 
|     2 // Use of this source code is governed by a BSD-style license that can be |     2 // Use of this source code is governed by a BSD-style license that can be | 
|     3 // found in the LICENSE file. |     3 // found in the LICENSE file. | 
|     4  |     4  | 
|     5 #include "src/v8.h" |     5 #include "src/v8.h" | 
|     6  |     6  | 
|     7 #include "src/accessors.h" |     7 #include "src/accessors.h" | 
|     8 #include "src/arguments.h" |     8 #include "src/arguments.h" | 
|     9 #include "src/compiler.h" |     9 #include "src/compiler.h" | 
|    10 #include "src/debug.h" |    10 #include "src/debug.h" | 
| (...skipping 2720 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2731         break; |  2731         break; | 
|  2732       } |  2732       } | 
|  2733     } |  2733     } | 
|  2734   } |  2734   } | 
|  2735  |  2735  | 
|  2736   if (found.is_null()) return heap->undefined_value(); |  2736   if (found.is_null()) return heap->undefined_value(); | 
|  2737   return *Script::GetWrapper(found); |  2737   return *Script::GetWrapper(found); | 
|  2738 } |  2738 } | 
|  2739  |  2739  | 
|  2740  |  2740  | 
|  2741 // Check whether debugger and is about to step into the callback that is passed |  2741 // Check whether debugger is about to step into the callback that is passed | 
|  2742 // to a built-in function such as Array.forEach. |  2742 // to a built-in function such as Array.forEach. | 
|  2743 RUNTIME_FUNCTION(Runtime_DebugCallbackSupportsStepping) { |  2743 RUNTIME_FUNCTION(Runtime_DebugCallbackSupportsStepping) { | 
|  2744   DCHECK(args.length() == 1); |  2744   DCHECK(args.length() == 1); | 
|  2745   Debug* debug = isolate->debug(); |  2745   Debug* debug = isolate->debug(); | 
|  2746   if (!debug->is_active() || !debug->IsStepping() || |  2746   if (!debug->is_active() || !debug->IsStepping() || | 
|  2747       debug->last_step_action() != StepIn) { |  2747       debug->last_step_action() != StepIn) { | 
|  2748     return isolate->heap()->false_value(); |  2748     return isolate->heap()->false_value(); | 
|  2749   } |  2749   } | 
|  2750   CONVERT_ARG_CHECKED(Object, callback, 0); |  2750   CONVERT_ARG_CHECKED(Object, callback, 0); | 
|  2751   // We do not step into the callback if it's a builtin or not even a function. |  2751   // We do not step into the callback if it's a builtin other than a bound, | 
|  2752   return isolate->heap()->ToBoolean(callback->IsJSFunction() && |  2752   // or not even a function. | 
|  2753                                     !JSFunction::cast(callback)->IsBuiltin()); |  2753   return isolate->heap()->ToBoolean( | 
 |  2754       callback->IsJSFunction() && | 
 |  2755       (!JSFunction::cast(callback)->IsBuiltin() || | 
 |  2756        JSFunction::cast(callback)->shared()->bound())); | 
|  2754 } |  2757 } | 
|  2755  |  2758  | 
|  2756  |  2759  | 
|  2757 // Set one shot breakpoints for the callback function that is passed to a |  2760 // Set one shot breakpoints for the callback function that is passed to a | 
|  2758 // built-in function such as Array.forEach to enable stepping into the callback. |  2761 // built-in function such as Array.forEach to enable stepping into the callback. | 
|  2759 RUNTIME_FUNCTION(Runtime_DebugPrepareStepInIfStepping) { |  2762 RUNTIME_FUNCTION(Runtime_DebugPrepareStepInIfStepping) { | 
|  2760   DCHECK(args.length() == 1); |  2763   DCHECK(args.length() == 1); | 
|  2761   Debug* debug = isolate->debug(); |  2764   Debug* debug = isolate->debug(); | 
|  2762   if (!debug->IsStepping()) return isolate->heap()->undefined_value(); |  2765   if (!debug->IsStepping()) return isolate->heap()->undefined_value(); | 
|  2763  |  2766  | 
|  2764   HandleScope scope(isolate); |  2767   HandleScope scope(isolate); | 
|  2765   CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |  2768   CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 
|  2766   RUNTIME_ASSERT(object->IsJSFunction() || object->IsJSGeneratorObject()); |  2769   RUNTIME_ASSERT(object->IsJSFunction() || object->IsJSGeneratorObject()); | 
|  2767   Handle<JSFunction> fun; |  2770   Handle<JSFunction> fun; | 
|  2768   if (object->IsJSFunction()) { |  2771   if (object->IsJSFunction()) { | 
|  2769     fun = Handle<JSFunction>::cast(object); |  2772     fun = Handle<JSFunction>::cast(object); | 
|  2770   } else { |  2773   } else { | 
|  2771     fun = Handle<JSFunction>( |  2774     fun = Handle<JSFunction>( | 
|  2772         Handle<JSGeneratorObject>::cast(object)->function(), isolate); |  2775         Handle<JSGeneratorObject>::cast(object)->function(), isolate); | 
|  2773   } |  2776   } | 
|  2774   // When leaving the function, step out has been activated, but not performed |  2777   // When leaving the function, step out has been activated, but not performed | 
|  2775   // if we do not leave the builtin.  To be able to step into the function |  2778   // if we do not leave the builtin.  To be able to step into the function | 
|  2776   // again, we need to clear the step out at this point. |  2779   // again, we need to clear the step out at this point. | 
|  2777   debug->ClearStepOut(); |  2780   debug->ClearStepOut(); | 
|  2778   debug->FloodWithOneShot(fun); |  2781   debug->FloodWithOneShotGeneric(fun); | 
|  2779   return isolate->heap()->undefined_value(); |  2782   return isolate->heap()->undefined_value(); | 
|  2780 } |  2783 } | 
|  2781  |  2784  | 
|  2782  |  2785  | 
|  2783 RUNTIME_FUNCTION(Runtime_DebugPushPromise) { |  2786 RUNTIME_FUNCTION(Runtime_DebugPushPromise) { | 
|  2784   DCHECK(args.length() == 1); |  2787   DCHECK(args.length() == 1); | 
|  2785   HandleScope scope(isolate); |  2788   HandleScope scope(isolate); | 
|  2786   CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); |  2789   CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); | 
|  2787   isolate->PushPromise(promise); |  2790   isolate->PushPromise(promise); | 
|  2788   return isolate->heap()->undefined_value(); |  2791   return isolate->heap()->undefined_value(); | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2820   return Smi::FromInt(isolate->debug()->is_active()); |  2823   return Smi::FromInt(isolate->debug()->is_active()); | 
|  2821 } |  2824 } | 
|  2822  |  2825  | 
|  2823  |  2826  | 
|  2824 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |  2827 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 
|  2825   UNIMPLEMENTED(); |  2828   UNIMPLEMENTED(); | 
|  2826   return NULL; |  2829   return NULL; | 
|  2827 } |  2830 } | 
|  2828 } |  2831 } | 
|  2829 }  // namespace v8::internal |  2832 }  // namespace v8::internal | 
| OLD | NEW |