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

Unified Diff: src/top.cc

Issue 13283: Simplify the logic determining whether to report an exception. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years 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/top.cc
===================================================================
--- src/top.cc (revision 945)
+++ src/top.cc (working copy)
@@ -749,46 +749,31 @@
bool Top::ShouldReportException(bool* is_caught_externally) {
+ // Find the top-most try-catch handler.
StackHandler* handler =
StackHandler::FromAddress(Top::handler(Top::GetCurrentThread()));
-
- // Determine if we have an external exception handler and get the
- // address of the external handler so we can compare the address to
- // determine which one is closer to the top of the stack.
- bool has_external_handler = (thread_local_.try_catch_handler_ != NULL);
- v8::TryCatch* try_catch = thread_local_.try_catch_handler_;
-
- // NOTE: The stack is assumed to grown towards lower addresses. If
- // the handler is at a higher address than the external address it
- // means that it is below it on the stack.
-
- // Find the top-most try-catch handler.
while (handler != NULL && !handler->is_try_catch()) {
handler = handler->next();
}
+ // Get the address of the external handler so we can compare the address to
+ // determine which one is closer to the top of the stack.
+ v8::TryCatch* try_catch = thread_local_.try_catch_handler_;
+
// The exception has been externally caught if and only if there is
// an external handler which is on top of the top-most try-catch
// handler.
//
// See comments in RegisterTryCatchHandler for details.
- *is_caught_externally = has_external_handler &&
+ *is_caught_externally = try_catch != NULL &&
(handler == NULL || handler == try_catch->js_handler_);
- // If we have a try-catch handler then the exception is caught in
- // JavaScript code.
- bool is_uncaught_by_js = (handler == NULL);
-
- // If there is no external try-catch handler, we report the
- // exception if it isn't caught by JavaScript code.
- if (!has_external_handler) return is_uncaught_by_js;
-
- if (is_uncaught_by_js || handler == try_catch->js_handler_) {
+ if (*is_caught_externally) {
// Only report the exception if the external handler is verbose.
return thread_local_.try_catch_handler_->is_verbose_;
} else {
// Report the exception if it isn't caught by JavaScript code.
- return is_uncaught_by_js;
+ return handler == NULL;
}
}
« 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