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

Unified Diff: src/messages.js

Issue 11377158: Fire 'stack' getter of error objects after GC. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments. Created 8 years, 1 month 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
Index: src/messages.js
diff --git a/src/messages.js b/src/messages.js
index 0a50ae7861e5e6f1032c4673dfb4aed904db2611..a3cdba620d8bf7121d5a47d3e9d0b0a22d46ae3e 100644
--- a/src/messages.js
+++ b/src/messages.js
@@ -1085,6 +1085,13 @@ function captureStackTrace(obj, cons_opt) {
var raw_stack = %CollectStackTrace(obj,
cons_opt ? cons_opt : captureStackTrace,
stackTraceLimit);
+
+ // Don't be lazy if the error stack formatting is custom (observable).
+ if (IS_FUNCTION($Error.prepareStackTrace)) {
+ obj.stack = FormatRawStackTrace(obj, raw_stack);
+ return;
+ }
+
// Note that 'obj' and 'this' maybe different when called on objects that
// have the error object on its prototype chain. The getter replaces itself
// with a data property as soon as the stack trace has been formatted.
@@ -1099,6 +1106,7 @@ function captureStackTrace(obj, cons_opt) {
%DefineOrRedefineDataProperty(this, 'stack', v, NONE);
};
+ %SetNativeFlag(getter);
%DefineOrRedefineAccessorProperty(obj, 'stack', getter, setter, DONT_ENUM);
}
@@ -1258,6 +1266,8 @@ function SetUpStackOverflowBoilerplate() {
%DefineOrRedefineDataProperty(this, 'stack', v, NONE);
}
+ %SetNativeFlag(getter);
+
%DefineOrRedefineAccessorProperty(
boilerplate, 'stack', getter, setter, DONT_ENUM);
« src/heap.cc ('K') | « src/mark-compact.cc ('k') | test/cctest/test-decls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698