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_DebugIsStepping) { |
2744 DCHECK(args.length() == 1); | 2744 DCHECK(args.length() == 0); |
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 return isolate->heap()->true_value(); |
kozy
2015/03/23 16:49:27
Why can we eliminate callback function check?
| |
2751 // We do not step into the callback if it's a builtin or not even a function. | |
2752 return isolate->heap()->ToBoolean(callback->IsJSFunction() && | |
2753 !JSFunction::cast(callback)->IsBuiltin()); | |
Yang
2015/03/24 07:27:15
Can't we make this change a lot simpler by returni
| |
2754 } | 2751 } |
2755 | 2752 |
2756 | 2753 |
2757 // Set one shot breakpoints for the callback function that is passed to a | 2754 // 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. | 2755 // built-in function such as Array.forEach to enable stepping into the callback. |
2759 RUNTIME_FUNCTION(Runtime_DebugPrepareStepInIfStepping) { | 2756 RUNTIME_FUNCTION(Runtime_DebugPrepareStepInIfStepping) { |
2760 DCHECK(args.length() == 1); | 2757 DCHECK(args.length() == 1); |
2761 Debug* debug = isolate->debug(); | 2758 Debug* debug = isolate->debug(); |
2762 if (!debug->IsStepping()) return isolate->heap()->undefined_value(); | 2759 if (!debug->IsStepping()) return isolate->heap()->undefined_value(); |
2763 | 2760 |
2764 HandleScope scope(isolate); | 2761 HandleScope scope(isolate); |
2765 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); | 2762 CONVERT_ARG_HANDLE_CHECKED(Object, object, 0); |
2766 RUNTIME_ASSERT(object->IsJSFunction() || object->IsJSGeneratorObject()); | 2763 RUNTIME_ASSERT(object->IsJSFunction() || object->IsJSGeneratorObject()); |
2767 Handle<JSFunction> fun; | 2764 Handle<JSFunction> fun; |
2768 if (object->IsJSFunction()) { | 2765 if (object->IsJSFunction()) { |
2769 fun = Handle<JSFunction>::cast(object); | 2766 fun = Handle<JSFunction>::cast(object); |
2770 } else { | 2767 } else { |
2771 fun = Handle<JSFunction>( | 2768 fun = Handle<JSFunction>( |
2772 Handle<JSGeneratorObject>::cast(object)->function(), isolate); | 2769 Handle<JSGeneratorObject>::cast(object)->function(), isolate); |
2773 } | 2770 } |
2774 // When leaving the function, step out has been activated, but not performed | 2771 // 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 | 2772 // 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. | 2773 // again, we need to clear the step out at this point. |
2777 debug->ClearStepOut(); | 2774 debug->ClearStepOut(); |
2778 debug->FloodWithOneShot(fun); | 2775 debug->FloodWithOneShotGeneric(fun); |
2779 return isolate->heap()->undefined_value(); | 2776 return isolate->heap()->undefined_value(); |
2780 } | 2777 } |
2781 | 2778 |
2782 | 2779 |
2783 RUNTIME_FUNCTION(Runtime_DebugPushPromise) { | 2780 RUNTIME_FUNCTION(Runtime_DebugPushPromise) { |
2784 DCHECK(args.length() == 1); | 2781 DCHECK(args.length() == 1); |
2785 HandleScope scope(isolate); | 2782 HandleScope scope(isolate); |
2786 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); | 2783 CONVERT_ARG_HANDLE_CHECKED(JSObject, promise, 0); |
2787 isolate->PushPromise(promise); | 2784 isolate->PushPromise(promise); |
2788 return isolate->heap()->undefined_value(); | 2785 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()); | 2817 return Smi::FromInt(isolate->debug()->is_active()); |
2821 } | 2818 } |
2822 | 2819 |
2823 | 2820 |
2824 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { | 2821 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { |
2825 UNIMPLEMENTED(); | 2822 UNIMPLEMENTED(); |
2826 return NULL; | 2823 return NULL; |
2827 } | 2824 } |
2828 } | 2825 } |
2829 } // namespace v8::internal | 2826 } // namespace v8::internal |
OLD | NEW |