OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 return Failure::Exception(); | 1070 return Failure::Exception(); |
1071 } | 1071 } |
1072 | 1072 |
1073 | 1073 |
1074 Failure* Isolate::TerminateExecution() { | 1074 Failure* Isolate::TerminateExecution() { |
1075 DoThrow(heap_.termination_exception(), NULL); | 1075 DoThrow(heap_.termination_exception(), NULL); |
1076 return Failure::Exception(); | 1076 return Failure::Exception(); |
1077 } | 1077 } |
1078 | 1078 |
1079 | 1079 |
| 1080 void Isolate::CancelTerminateExecution() { |
| 1081 if (try_catch_handler()) { |
| 1082 try_catch_handler()->has_terminated_ = false; |
| 1083 } |
| 1084 if (has_pending_exception() && |
| 1085 pending_exception() == heap_.termination_exception()) { |
| 1086 thread_local_top()->external_caught_exception_ = false; |
| 1087 clear_pending_exception(); |
| 1088 } |
| 1089 if (has_scheduled_exception() && |
| 1090 scheduled_exception() == heap_.termination_exception()) { |
| 1091 thread_local_top()->external_caught_exception_ = false; |
| 1092 clear_scheduled_exception(); |
| 1093 } |
| 1094 } |
| 1095 |
| 1096 |
1080 Failure* Isolate::Throw(Object* exception, MessageLocation* location) { | 1097 Failure* Isolate::Throw(Object* exception, MessageLocation* location) { |
1081 DoThrow(exception, location); | 1098 DoThrow(exception, location); |
1082 return Failure::Exception(); | 1099 return Failure::Exception(); |
1083 } | 1100 } |
1084 | 1101 |
1085 | 1102 |
1086 Failure* Isolate::ReThrow(MaybeObject* exception) { | 1103 Failure* Isolate::ReThrow(MaybeObject* exception) { |
1087 bool can_be_caught_externally = false; | 1104 bool can_be_caught_externally = false; |
1088 bool catchable_by_javascript = is_catchable_by_javascript(exception); | 1105 bool catchable_by_javascript = is_catchable_by_javascript(exception); |
1089 ShouldReportException(&can_be_caught_externally, catchable_by_javascript); | 1106 ShouldReportException(&can_be_caught_externally, catchable_by_javascript); |
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1983 bool external_caught = IsExternallyCaught(); | 2000 bool external_caught = IsExternallyCaught(); |
1984 thread_local_top_.external_caught_exception_ = external_caught; | 2001 thread_local_top_.external_caught_exception_ = external_caught; |
1985 | 2002 |
1986 if (!external_caught) return; | 2003 if (!external_caught) return; |
1987 | 2004 |
1988 if (thread_local_top_.pending_exception_->IsOutOfMemory()) { | 2005 if (thread_local_top_.pending_exception_->IsOutOfMemory()) { |
1989 // Do not propagate OOM exception: we should kill VM asap. | 2006 // Do not propagate OOM exception: we should kill VM asap. |
1990 } else if (thread_local_top_.pending_exception_ == | 2007 } else if (thread_local_top_.pending_exception_ == |
1991 heap()->termination_exception()) { | 2008 heap()->termination_exception()) { |
1992 try_catch_handler()->can_continue_ = false; | 2009 try_catch_handler()->can_continue_ = false; |
| 2010 try_catch_handler()->has_terminated_ = true; |
1993 try_catch_handler()->exception_ = heap()->null_value(); | 2011 try_catch_handler()->exception_ = heap()->null_value(); |
1994 } else { | 2012 } else { |
1995 // At this point all non-object (failure) exceptions have | 2013 // At this point all non-object (failure) exceptions have |
1996 // been dealt with so this shouldn't fail. | 2014 // been dealt with so this shouldn't fail. |
1997 ASSERT(!pending_exception()->IsFailure()); | 2015 ASSERT(!pending_exception()->IsFailure()); |
1998 try_catch_handler()->can_continue_ = true; | 2016 try_catch_handler()->can_continue_ = true; |
| 2017 try_catch_handler()->has_terminated_ = false; |
1999 try_catch_handler()->exception_ = pending_exception(); | 2018 try_catch_handler()->exception_ = pending_exception(); |
2000 if (!thread_local_top_.pending_message_obj_->IsTheHole()) { | 2019 if (!thread_local_top_.pending_message_obj_->IsTheHole()) { |
2001 try_catch_handler()->message_ = thread_local_top_.pending_message_obj_; | 2020 try_catch_handler()->message_ = thread_local_top_.pending_message_obj_; |
2002 } | 2021 } |
2003 } | 2022 } |
2004 } | 2023 } |
2005 | 2024 |
2006 | 2025 |
2007 void Isolate::InitializeLoggingAndCounters() { | 2026 void Isolate::InitializeLoggingAndCounters() { |
2008 if (logger_ == NULL) { | 2027 if (logger_ == NULL) { |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2406 | 2425 |
2407 #ifdef DEBUG | 2426 #ifdef DEBUG |
2408 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2427 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
2409 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2428 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
2410 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2429 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
2411 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2430 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
2412 #undef ISOLATE_FIELD_OFFSET | 2431 #undef ISOLATE_FIELD_OFFSET |
2413 #endif | 2432 #endif |
2414 | 2433 |
2415 } } // namespace v8::internal | 2434 } } // namespace v8::internal |
OLD | NEW |