Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Unified Diff: src/isolate.cc

Issue 2161953003: Remove stack overflow boilerplate (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/contexts.h ('k') | src/js/messages.js » ('j') | src/messages.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/contexts.h ('k') | src/js/messages.js » ('j') | src/messages.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698