Index: src/isolate.cc |
diff --git a/src/isolate.cc b/src/isolate.cc |
index 6099b3f1263d051e31b1b30dfa9c99db16fc3149..9bf56cb7f87069b1d8c52cfd45a70a8292e68b14 100644 |
--- a/src/isolate.cc |
+++ b/src/isolate.cc |
@@ -960,19 +960,22 @@ bool Isolate::MayAccess(Handle<Context> accessing_context, |
Object* Isolate::StackOverflow() { |
DisallowJavascriptExecution no_js(this); |
HandleScope scope(this); |
- // At this point we cannot create an Error object using its javascript |
- // constructor. Instead, we copy the pre-constructed boilerplate and |
- // attach the stack trace as a hidden property. |
Handle<Object> exception; |
if (bootstrapper()->IsActive()) { |
- // There is no boilerplate to use during bootstrapping. |
exception = factory()->NewStringFromAsciiChecked( |
Yang
2016/07/19 15:06:46
I wonder whether we could remove this special case
jgruber
2016/07/20 14:48:39
Done. Will update the other sites that check for b
|
MessageTemplate::TemplateString(MessageTemplate::kStackOverflow)); |
} else { |
- Handle<JSObject> boilerplate = stack_overflow_boilerplate(); |
- Handle<JSObject> copy = factory()->CopyJSObject(boilerplate); |
- CaptureAndSetSimpleStackTrace(copy, factory()->undefined_value()); |
- exception = copy; |
+ // Disable detailed stack trace collection while generating the stack |
+ // overflow error. |
+ bool old_detailed_enabled = capture_stack_trace_for_uncaught_exceptions_; |
+ capture_stack_trace_for_uncaught_exceptions_ = false; |
+ |
+ Handle<JSFunction> fun = range_error_function(); |
+ Handle<Object> msg = factory()->NewStringFromAsciiChecked( |
+ MessageTemplate::TemplateString(MessageTemplate::kStackOverflow)); |
+ exception = handle(ConstructError(this, fun, fun, msg), this); |
Yang
2016/07/19 15:06:46
What if we have an exception in ConstructError? We
jgruber
2016/07/20 14:48:39
Good catch. Done.
|
+ |
+ capture_stack_trace_for_uncaught_exceptions_ = old_detailed_enabled; |
} |
Throw(*exception, nullptr); |