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

Unified Diff: src/isolate.cc

Issue 997863003: Remove superfluous ThreadLocalTop::catcher field. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/isolate.h ('k') | no next file » | 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 c704e06338b83a0a91d9c48ddc33d5266fc258c9..841e583c8bc22be0dcb9fec28b221e35aa2c6d07 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -82,7 +82,6 @@ void ThreadLocalTop::InitializeInternal() {
external_caught_exception_ = false;
failed_access_check_callback_ = NULL;
save_context_ = NULL;
- catcher_ = NULL;
promise_on_stack_ = NULL;
// These members are re-initialized later after deserialization
@@ -252,7 +251,6 @@ void Isolate::RegisterTryCatchHandler(v8::TryCatch* that) {
void Isolate::UnregisterTryCatchHandler(v8::TryCatch* that) {
DCHECK(thread_local_top()->try_catch_handler() == that);
thread_local_top()->set_try_catch_handler(that->next_);
- thread_local_top()->catcher_ = NULL;
}
@@ -1005,11 +1003,6 @@ Object* Isolate::Throw(Object* exception, MessageLocation* location) {
// Save the message for reporting if the the exception remains uncaught.
thread_local_top()->has_pending_message_ = report_exception;
- // Do not forget to clean catcher_ if currently thrown exception cannot
- // be caught. If necessary, ReThrow will update the catcher.
- thread_local_top()->catcher_ =
- can_be_caught_externally ? try_catch_handler() : NULL;
-
// Set the exception being thrown.
set_pending_exception(*exception_handle);
return heap()->exception();
@@ -1017,12 +1010,7 @@ Object* Isolate::Throw(Object* exception, MessageLocation* location) {
Object* Isolate::ReThrow(Object* exception) {
- bool can_be_caught_externally = false;
- bool catchable_by_javascript = is_catchable_by_javascript(exception);
- ShouldReportException(&can_be_caught_externally, catchable_by_javascript);
-
- thread_local_top()->catcher_ = can_be_caught_externally ?
- try_catch_handler() : NULL;
+ DCHECK(!has_pending_exception());
// Set the exception being re-thrown.
set_pending_exception(exception);
@@ -1387,14 +1375,6 @@ Handle<JSMessageObject> Isolate::CreateMessage(Handle<Object> exception,
}
-bool Isolate::HasExternalTryCatch() {
- DCHECK(has_pending_exception());
-
- return (thread_local_top()->catcher_ != NULL) &&
- (try_catch_handler() == thread_local_top()->catcher_);
-}
-
-
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.
@@ -1954,22 +1934,23 @@ void Isolate::InitializeThreadLocal() {
bool Isolate::PropagatePendingExceptionToExternalTryCatch() {
- DCHECK(has_pending_exception());
+ Object* exception = pending_exception();
- bool has_external_try_catch = HasExternalTryCatch();
- if (!has_external_try_catch) {
+ bool can_be_caught_externally = false;
+ bool catchable_by_javascript = is_catchable_by_javascript(exception);
+ ShouldReportException(&can_be_caught_externally, catchable_by_javascript);
+ if (!can_be_caught_externally) {
thread_local_top_.external_caught_exception_ = false;
return true;
}
- bool catchable_by_js = is_catchable_by_javascript(pending_exception());
- if (catchable_by_js && IsFinallyOnTop()) {
+ if (catchable_by_javascript && IsFinallyOnTop()) {
thread_local_top_.external_caught_exception_ = false;
return false;
}
thread_local_top_.external_caught_exception_ = true;
- if (thread_local_top_.pending_exception_ == heap()->termination_exception()) {
+ if (!catchable_by_javascript) {
try_catch_handler()->can_continue_ = false;
try_catch_handler()->has_terminated_ = true;
try_catch_handler()->exception_ = heap()->null_value();
« no previous file with comments | « src/isolate.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698