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

Unified Diff: src/messages.cc

Issue 2175603003: Omit frames up to new target in Error constructor (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 | « no previous file | test/mjsunit/regress/regress-5216.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.cc
diff --git a/src/messages.cc b/src/messages.cc
index 02c42eaa66c9b15a4b923a492fd9190683b258c3..aa453ed50eb55c00bfd1d2db12160e58a70e809e 100644
--- a/src/messages.cc
+++ b/src/messages.cc
@@ -502,9 +502,19 @@ MaybeHandle<Object> ConstructError(Isolate* isolate, Handle<JSFunction> target,
RETURN_ON_EXCEPTION(isolate, isolate->CaptureAndSetDetailedStackTrace(err),
Object);
}
+
+ // When we're passed a JSFunction as new target, we can skip frames until that
+ // specific function is seen instead of unconditionally skipping the first
+ // frame.
+ Handle<Object> caller;
+ if (mode == SKIP_FIRST && new_target->IsJSFunction()) {
+ mode = SKIP_UNTIL_SEEN;
+ caller = new_target;
+ }
+
// Capture a simple stack trace for the stack property.
- RETURN_ON_EXCEPTION(isolate, isolate->CaptureAndSetSimpleStackTrace(
- err, mode, Handle<Object>()),
+ RETURN_ON_EXCEPTION(isolate,
+ isolate->CaptureAndSetSimpleStackTrace(err, mode, caller),
Object);
return err;
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-5216.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698