Index: src/runtime/runtime-internal.cc |
diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc |
index 79dfaced96ca90c502deb46ae23c7d1afb42745e..38f238b1cdd76e7fc90f21b7689c33b7201ac268 100644 |
--- a/src/runtime/runtime-internal.cc |
+++ b/src/runtime/runtime-internal.cc |
@@ -7,6 +7,9 @@ |
#include "src/arguments.h" |
#include "src/bootstrapper.h" |
#include "src/debug.h" |
+#include "src/messages.h" |
+#include "src/parser.h" |
+#include "src/prettyprinter.h" |
#include "src/runtime/runtime-utils.h" |
namespace v8 { |
@@ -153,6 +156,30 @@ RUNTIME_FUNCTION(Runtime_CollectStackTrace) { |
} |
+RUNTIME_FUNCTION(Runtime_RenderCallSite) { |
+ HandleScope scope(isolate); |
+ DCHECK(args.length() == 0); |
+ MessageLocation location; |
+ isolate->ComputeLocation(&location); |
+ if (location.start_pos() == -1) return isolate->heap()->empty_string(); |
+ |
+ Zone zone(isolate); |
+ if (location.function()->shared()->is_function()) { |
+ CompilationInfo info(location.function(), &zone); |
+ if (!Parser::Parse(&info)) return isolate->heap()->empty_string(); |
+ CallPrinter printer(&zone); |
+ const char* string = printer.Print(info.function(), location.start_pos()); |
+ return *isolate->factory()->NewStringFromAsciiChecked(string); |
+ } |
+ |
+ CompilationInfo info(location.script(), &zone); |
+ if (!Parser::Parse(&info)) return isolate->heap()->empty_string(); |
+ CallPrinter printer(&zone); |
+ const char* string = printer.Print(info.function(), location.start_pos()); |
+ return *isolate->factory()->NewStringFromAsciiChecked(string); |
+} |
+ |
+ |
RUNTIME_FUNCTION(Runtime_GetFromCache) { |
SealHandleScope shs(isolate); |
// This is only called from codegen, so checks might be more lax. |