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

Unified Diff: src/top.cc

Issue 6709028: Revert r7258 and r7260. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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
« no previous file with comments | « 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
diff --git a/src/top.cc b/src/top.cc
index 315f5806c4b37eec89dc147d2567557ce7558582..78db26a50973975caeed7d114c5e48d5c5b130a6 100644
--- a/src/top.cc
+++ b/src/top.cc
@@ -971,55 +971,41 @@ bool Top::IsExternallyCaught() {
}
-void Top::PropagatePendingExceptionToExternalTryCatch() {
- ASSERT(has_pending_exception());
-
- bool external_caught = IsExternallyCaught();
- thread_local_.external_caught_exception_ = external_caught;
-
- if (!external_caught) return;
-
- if (thread_local_.pending_exception_ == Failure::OutOfMemoryException()) {
- // Do not propagate OOM exception: we should kill VM asap.
- } else if (thread_local_.pending_exception_ ==
- Heap::termination_exception()) {
- try_catch_handler()->can_continue_ = false;
- try_catch_handler()->exception_ = Heap::null_value();
- } else {
- // At this point all non-object (failure) exceptions have
- // been dealt with so this shouldn't fail.
- ASSERT(!pending_exception()->IsFailure());
- try_catch_handler()->can_continue_ = true;
- try_catch_handler()->exception_ = pending_exception();
- if (!thread_local_.pending_message_obj_->IsTheHole()) {
- try_catch_handler()->message_ = thread_local_.pending_message_obj_;
- }
- }
-}
-
-
void Top::ReportPendingMessages() {
ASSERT(has_pending_exception());
- PropagatePendingExceptionToExternalTryCatch();
-
// If the pending exception is OutOfMemoryException set out_of_memory in
// the global context. Note: We have to mark the global context here
// since the GenerateThrowOutOfMemory stub cannot make a RuntimeCall to
// set it.
+ bool external_caught = IsExternallyCaught();
+ thread_local_.external_caught_exception_ = external_caught;
HandleScope scope;
if (thread_local_.pending_exception_ == Failure::OutOfMemoryException()) {
context()->mark_out_of_memory();
} else if (thread_local_.pending_exception_ ==
Heap::termination_exception()) {
- // Do nothing: if needed, the exception has been already propagated to
- // v8::TryCatch.
+ if (external_caught) {
+ try_catch_handler()->can_continue_ = false;
+ try_catch_handler()->exception_ = Heap::null_value();
+ }
} else {
+ // At this point all non-object (failure) exceptions have
+ // been dealt with so this shouldn't fail.
+ Object* pending_exception_object = pending_exception()->ToObjectUnchecked();
+ Handle<Object> exception(pending_exception_object);
+ thread_local_.external_caught_exception_ = false;
+ if (external_caught) {
+ try_catch_handler()->can_continue_ = true;
+ try_catch_handler()->exception_ = thread_local_.pending_exception_;
+ if (!thread_local_.pending_message_obj_->IsTheHole()) {
+ try_catch_handler()->message_ = thread_local_.pending_message_obj_;
+ }
+ }
if (thread_local_.has_pending_message_) {
thread_local_.has_pending_message_ = false;
if (thread_local_.pending_message_ != NULL) {
MessageHandler::ReportMessage(thread_local_.pending_message_);
} else if (!thread_local_.pending_message_obj_->IsTheHole()) {
- HandleScope scope;
Handle<Object> message_obj(thread_local_.pending_message_obj_);
if (thread_local_.pending_message_script_ != NULL) {
Handle<Script> script(thread_local_.pending_message_script_);
@@ -1032,6 +1018,8 @@ void Top::ReportPendingMessages() {
}
}
}
+ thread_local_.external_caught_exception_ = external_caught;
+ set_pending_exception(*exception);
}
clear_pending_message();
}
@@ -1043,9 +1031,6 @@ void Top::TraceException(bool flag) {
bool Top::OptionalRescheduleException(bool is_bottom_call) {
- ASSERT(has_pending_exception());
- PropagatePendingExceptionToExternalTryCatch();
-
// Allways reschedule out of memory exceptions.
if (!is_out_of_memory()) {
bool is_termination_exception =
« no previous file with comments | « src/top.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698