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

Unified Diff: src/messages.js

Issue 595253002: Simplify stack trace getter wrt prototype chain walk. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/messages.js
diff --git a/src/messages.js b/src/messages.js
index 4d64d1e1319a1501dc4ae2357c33131e4036ebda..4a71a61f5c9a21c589faad4be6a3ac4391a26087 100644
--- a/src/messages.js
+++ b/src/messages.js
@@ -1123,23 +1123,25 @@ var formatted_stack_trace_symbol = NEW_PRIVATE_OWN("formatted stack trace");
var StackTraceGetter = function() {
var formatted_stack_trace = UNDEFINED;
var holder = this;
- while (holder && IS_UNDEFINED(formatted_stack_trace)) {
- formatted_stack_trace = GET_PRIVATE(holder, formatted_stack_trace_symbol);
- holder = %GetPrototype(holder);
- }
- if (IS_UNDEFINED(formatted_stack_trace)) {
- holder = this;
- while (!HAS_DEFINED_PRIVATE(holder, stack_trace_symbol)) {
- holder = %GetPrototype(holder);
- if (!holder) return UNDEFINED;
+ while (holder) {
+ var formatted_stack_trace =
+ GET_PRIVATE(holder, formatted_stack_trace_symbol);
arv (Not doing code reviews) 2014/09/24 14:15:17 wrong indent
+ if (IS_UNDEFINED(formatted_stack_trace)) {
+ // No formatted stack trace available.
+ var stack_trace = GET_PRIVATE(holder, stack_trace_symbol);
+ if (IS_UNDEFINED(stack_trace)) {
+ // Neither formatted nor structured stack trace available.
+ // Look further up the prototype chain.
+ holder = %GetPrototype(holder);
+ continue;
+ }
+ formatted_stack_trace = FormatStackTrace(holder, stack_trace);
+ SET_PRIVATE(holder, stack_trace_symbol, UNDEFINED);
+ SET_PRIVATE(holder, formatted_stack_trace_symbol, formatted_stack_trace);
}
- var stack_trace = GET_PRIVATE(holder, stack_trace_symbol);
- if (IS_UNDEFINED(stack_trace)) return UNDEFINED;
- formatted_stack_trace = FormatStackTrace(holder, stack_trace);
- SET_PRIVATE(holder, stack_trace_symbol, UNDEFINED);
- SET_PRIVATE(holder, formatted_stack_trace_symbol, formatted_stack_trace);
+ return formatted_stack_trace;
}
- return formatted_stack_trace;
+ return UNDEFINED;
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698