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

Side by Side Diff: src/runtime/runtime-debug.cc

Issue 861623002: Add a pretty printer to improve the error message non-function calls (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update test expectations Created 5 years, 11 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
OLDNEW
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/debug.h" 9 #include "src/debug.h"
10 #include "src/deoptimizer.h" 10 #include "src/deoptimizer.h"
11 #include "src/isolate-inl.h" 11 #include "src/isolate-inl.h"
12 #include "src/messages.h"
12 #include "src/parser.h" 13 #include "src/parser.h"
14 #include "src/prettyprinter.h"
13 #include "src/runtime/runtime.h" 15 #include "src/runtime/runtime.h"
14 #include "src/runtime/runtime-utils.h" 16 #include "src/runtime/runtime-utils.h"
15 17
16 namespace v8 { 18 namespace v8 {
17 namespace internal { 19 namespace internal {
18 20
19 RUNTIME_FUNCTION(Runtime_DebugBreak) { 21 RUNTIME_FUNCTION(Runtime_DebugBreak) {
20 SealHandleScope shs(isolate); 22 SealHandleScope shs(isolate);
21 DCHECK(args.length() == 0); 23 DCHECK(args.length() == 0);
22 isolate->debug()->HandleDebugBreak(); 24 isolate->debug()->HandleDebugBreak();
(...skipping 2697 matching lines...) Expand 10 before | Expand all | Expand 10 after
2720 break; 2722 break;
2721 } 2723 }
2722 } 2724 }
2723 } 2725 }
2724 2726
2725 if (found.is_null()) return heap->undefined_value(); 2727 if (found.is_null()) return heap->undefined_value();
2726 return *Script::GetWrapper(found); 2728 return *Script::GetWrapper(found);
2727 } 2729 }
2728 2730
2729 2731
2732 RUNTIME_FUNCTION(Runtime_RenderCallSite) {
Yang 2015/01/20 08:19:07 Nit: runtime-debug.cc is used for debugger related
2733 HandleScope scope(isolate);
2734 DCHECK(args.length() == 0);
2735 MessageLocation location;
2736 isolate->ComputeLocation(&location);
2737 if (location.start_pos() == -1) return isolate->heap()->empty_string();
2738 CompilationInfoWithZone info(location.script());
Yang 2015/01/20 08:19:07 If you could get the JSFunction from within Comput
2739 if (!Parser::Parse(&info)) return isolate->heap()->empty_string();
2740 Zone zone(isolate);
2741 CallPrinter printer(&zone);
2742 const char* string = printer.Print(info.function(), location.start_pos());
2743 return *isolate->factory()->NewStringFromAsciiChecked(string);
2744 }
2745
2746
2730 // Check whether debugger and is about to step into the callback that is passed 2747 // Check whether debugger and is about to step into the callback that is passed
2731 // to a built-in function such as Array.forEach. 2748 // to a built-in function such as Array.forEach.
2732 RUNTIME_FUNCTION(Runtime_DebugCallbackSupportsStepping) { 2749 RUNTIME_FUNCTION(Runtime_DebugCallbackSupportsStepping) {
2733 DCHECK(args.length() == 1); 2750 DCHECK(args.length() == 1);
2734 Debug* debug = isolate->debug(); 2751 Debug* debug = isolate->debug();
2735 if (!debug->is_active() || !debug->IsStepping() || 2752 if (!debug->is_active() || !debug->IsStepping() ||
2736 debug->last_step_action() != StepIn) { 2753 debug->last_step_action() != StepIn) {
2737 return isolate->heap()->false_value(); 2754 return isolate->heap()->false_value();
2738 } 2755 }
2739 CONVERT_ARG_CHECKED(Object, callback, 0); 2756 CONVERT_ARG_CHECKED(Object, callback, 0);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
2809 return Smi::FromInt(isolate->debug()->is_active()); 2826 return Smi::FromInt(isolate->debug()->is_active());
2810 } 2827 }
2811 2828
2812 2829
2813 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) { 2830 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) {
2814 UNIMPLEMENTED(); 2831 UNIMPLEMENTED();
2815 return NULL; 2832 return NULL;
2816 } 2833 }
2817 } 2834 }
2818 } // namespace v8::internal 2835 } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698