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

Unified Diff: src/isolate.cc

Issue 318773006: Revert "V8 can clear exception pending message, when should not do this." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | « src/isolate.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/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index eb139499f24f9d225ab5cfbaca55e3b2e7218c32..1e0b0947acb6f454f02e2bbeef48b292d6a9d06b 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -1166,15 +1166,20 @@ void Isolate::DoThrow(Object* exception, MessageLocation* location) {
}
-bool Isolate::HasExternalTryCatch() {
+bool Isolate::IsExternallyCaught() {
ASSERT(has_pending_exception());
- return (thread_local_top()->catcher_ != NULL) &&
- (try_catch_handler() == thread_local_top()->catcher_);
-}
+ if ((thread_local_top()->catcher_ == NULL) ||
+ (try_catch_handler() != thread_local_top()->catcher_)) {
+ // When throwing the exception, we found no v8::TryCatch
+ // which should care about this exception.
+ return false;
+ }
+ if (!is_catchable_by_javascript(pending_exception())) {
+ return true;
+ }
-bool Isolate::IsFinallyOnTop() {
// 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.
Address external_handler_address =
@@ -1194,18 +1199,18 @@ bool Isolate::IsFinallyOnTop() {
StackHandler::FromAddress(Isolate::handler(thread_local_top()));
while (handler != NULL && handler->address() < external_handler_address) {
ASSERT(!handler->is_catch());
- if (handler->is_finally()) return true;
+ if (handler->is_finally()) return false;
handler = handler->next();
}
- return false;
+ return true;
}
void Isolate::ReportPendingMessages() {
ASSERT(has_pending_exception());
- bool can_clear_message = PropagatePendingExceptionToExternalTryCatch();
+ PropagatePendingExceptionToExternalTryCatch();
HandleScope scope(this);
if (thread_local_top_.pending_exception_ ==
@@ -1232,7 +1237,7 @@ void Isolate::ReportPendingMessages() {
}
}
}
- if (can_clear_message) clear_pending_message();
+ clear_pending_message();
}
@@ -1737,18 +1742,13 @@ void Isolate::InitializeThreadLocal() {
}
-bool Isolate::PropagatePendingExceptionToExternalTryCatch() {
+void Isolate::PropagatePendingExceptionToExternalTryCatch() {
ASSERT(has_pending_exception());
- bool has_external_try_catch = HasExternalTryCatch();
- bool is_catchable_by_js = is_catchable_by_javascript(pending_exception());
- bool is_finally_on_top = IsFinallyOnTop();
+ bool external_caught = IsExternallyCaught();
+ thread_local_top_.external_caught_exception_ = external_caught;
- bool should_propagate_now = has_external_try_catch &&
- (!is_catchable_by_js || !is_finally_on_top);
- thread_local_top_.external_caught_exception_ = should_propagate_now;
-
- if (!should_propagate_now) return !has_external_try_catch;
+ if (!external_caught) return;
if (thread_local_top_.pending_exception_ ==
heap()->termination_exception()) {
@@ -1765,14 +1765,13 @@ bool Isolate::PropagatePendingExceptionToExternalTryCatch() {
handler->has_terminated_ = false;
handler->exception_ = pending_exception();
// Propagate to the external try-catch only if we got an actual message.
- if (thread_local_top_.pending_message_obj_->IsTheHole()) return true;
+ if (thread_local_top_.pending_message_obj_->IsTheHole()) return;
handler->message_obj_ = thread_local_top_.pending_message_obj_;
handler->message_script_ = thread_local_top_.pending_message_script_;
handler->message_start_pos_ = thread_local_top_.pending_message_start_pos_;
handler->message_end_pos_ = thread_local_top_.pending_message_end_pos_;
}
- return true;
}
« no previous file with comments | « src/isolate.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698