Index: src/runtime/runtime-internal.cc |
diff --git a/src/runtime/runtime-internal.cc b/src/runtime/runtime-internal.cc |
index 446e1b368a53b3c5256a0599fc0655e223df3c1d..9f6a4fd7f15c10dc08f2c8d9bfba9c3ba5e49179 100644 |
--- a/src/runtime/runtime-internal.cc |
+++ b/src/runtime/runtime-internal.cc |
@@ -363,6 +363,26 @@ |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
isolate, result, isolate->factory()->NewRawTwoByteString(length)); |
return *result; |
+} |
+ |
+// Collect the raw data for a stack trace. Returns an array of 4 |
+// element segments each containing a receiver, function, code and |
+// native code offset. |
+RUNTIME_FUNCTION(Runtime_CollectStackTrace) { |
+ HandleScope scope(isolate); |
+ DCHECK(args.length() == 2); |
+ CONVERT_ARG_HANDLE_CHECKED(JSReceiver, error_object, 0); |
+ CONVERT_ARG_HANDLE_CHECKED(Object, caller, 1); |
+ |
+ if (!isolate->bootstrapper()->IsActive()) { |
+ // Optionally capture a more detailed stack trace for the message. |
+ RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, isolate->CaptureAndSetDetailedStackTrace(error_object)); |
+ // Capture a simple stack trace for the stack property. |
+ RETURN_FAILURE_ON_EXCEPTION( |
+ isolate, isolate->CaptureAndSetSimpleStackTrace(error_object, caller)); |
+ } |
+ return isolate->heap()->undefined_value(); |
} |