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

Unified Diff: src/top.cc

Issue 43070: Fix exception propagation problem where undefined was returned instead... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 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
« src/top.h ('K') | « src/top.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/top.cc
===================================================================
--- src/top.cc (revision 1483)
+++ src/top.cc (working copy)
@@ -823,16 +823,36 @@
bool Top::optional_reschedule_exception(bool is_bottom_call) {
- if (!is_out_of_memory() &&
- (thread_local_.external_caught_exception_ || is_bottom_call)) {
- thread_local_.external_caught_exception_ = false;
- clear_pending_exception();
- return false;
- } else {
- thread_local_.scheduled_exception_ = pending_exception();
- clear_pending_exception();
- return true;
+ // Allways reschedule out of memory exceptions.
+ if (!is_out_of_memory()) {
+ // Never reschedule the exception if this is the bottom call.
+ bool clear_exception = is_bottom_call;
+
+ // If the exception is externally caught, clear it if there are no
+ // JavaScript frames on the way to the C++ frame that has the
+ // external handler.
+ if (thread_local_.external_caught_exception_) {
+ ASSERT(thread_local_.try_catch_handler_ != NULL);
+ Address external_handler_address =
+ reinterpret_cast<Address>(thread_local_.try_catch_handler_);
+ JavaScriptFrameIterator it;
+ if (it.done() || (it.frame()->sp() > external_handler_address)) {
+ clear_exception = true;
+ }
+ }
+
+ // Clear the exception if needed.
+ if (clear_exception) {
+ thread_local_.external_caught_exception_ = false;
+ clear_pending_exception();
+ return false;
+ }
}
+
+ // Reschedule the exception.
+ thread_local_.scheduled_exception_ = pending_exception();
+ clear_pending_exception();
+ return true;
}
« src/top.h ('K') | « src/top.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698