Commit 72dcfab2 authored by yangguo@chromium.org's avatar yangguo@chromium.org

Simplify stack trace getter wrt prototype chain walk.

R=dslomov@chromium.org

Review URL: https://codereview.chromium.org/595253002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24170 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ab045400
......@@ -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);
}
while (holder) {
var formatted_stack_trace =
GET_PRIVATE(holder, formatted_stack_trace_symbol);
if (IS_UNDEFINED(formatted_stack_trace)) {
holder = this;
while (!HAS_DEFINED_PRIVATE(holder, stack_trace_symbol)) {
// 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);
if (!holder) return UNDEFINED;
continue;
}
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 UNDEFINED;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment