diff options
Diffstat (limited to 'deps/v8/src/runtime/runtime-internal.cc')
-rw-r--r-- | deps/v8/src/runtime/runtime-internal.cc | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/deps/v8/src/runtime/runtime-internal.cc b/deps/v8/src/runtime/runtime-internal.cc index 79dfaced96..50b61921f5 100644 --- a/deps/v8/src/runtime/runtime-internal.cc +++ b/deps/v8/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,36 @@ 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; + if (location.function()->shared()->is_function()) { + CompilationInfo info(location.function(), &zone); + if (!Parser::ParseStatic(&info)) { + isolate->clear_pending_exception(); + return isolate->heap()->empty_string(); + } + CallPrinter printer(isolate, &zone); + const char* string = printer.Print(info.function(), location.start_pos()); + return *isolate->factory()->NewStringFromAsciiChecked(string); + } + + CompilationInfo info(location.script(), &zone); + if (!Parser::ParseStatic(&info)) { + isolate->clear_pending_exception(); + return isolate->heap()->empty_string(); + } + CallPrinter printer(isolate, &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. |