Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 0a2f459437c2ef89b9e59d473937323292327915..f341d144377b61cb4becec099cfd51c86aacc519 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -14428,15 +14428,30 @@ RUNTIME_FUNCTION(Runtime_GetScript) { |
// native code offset. |
RUNTIME_FUNCTION(Runtime_CollectStackTrace) { |
HandleScope scope(isolate); |
- ASSERT(args.length() == 2); |
+ ASSERT(args.length() == 3); |
CONVERT_ARG_HANDLE_CHECKED(JSObject, error_object, 0); |
CONVERT_ARG_HANDLE_CHECKED(Object, caller, 1); |
+ CONVERT_NUMBER_CHECKED(int32_t, limit, Int32, args[2]); |
// Optionally capture a more detailed stack trace for the message. |
isolate->CaptureAndSetDetailedStackTrace(error_object); |
// Capture a simple stack trace for the stack property. |
- isolate->CaptureAndSetSimpleStackTrace(error_object, caller); |
- return isolate->heap()->undefined_value(); |
+ return *isolate->CaptureSimpleStackTrace(error_object, caller, limit); |
+} |
+ |
+ |
+// Retrieve the stack trace. This is the raw stack trace that yet has to |
+// be formatted. Since we only need this once, clear it afterwards. |
+RUNTIME_FUNCTION(Runtime_GetAndClearOverflowedStackTrace) { |
+ HandleScope scope(isolate); |
+ ASSERT(args.length() == 1); |
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, error_object, 0); |
+ Handle<String> key = isolate->factory()->hidden_stack_trace_string(); |
+ Handle<Object> result(error_object->GetHiddenProperty(key), isolate); |
+ if (result->IsTheHole()) return isolate->heap()->undefined_value(); |
+ RUNTIME_ASSERT(result->IsJSArray() || result->IsUndefined()); |
+ JSObject::DeleteHiddenProperty(error_object, key); |
+ return *result; |
} |