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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1021 return Failure::Exception(); | 1021 return Failure::Exception(); |
1022 } | 1022 } |
1023 | 1023 |
1024 | 1024 |
1025 Failure* Isolate::TerminateExecution() { | 1025 Failure* Isolate::TerminateExecution() { |
1026 DoThrow(heap_.termination_exception(), NULL); | 1026 DoThrow(heap_.termination_exception(), NULL); |
1027 return Failure::Exception(); | 1027 return Failure::Exception(); |
1028 } | 1028 } |
1029 | 1029 |
1030 | 1030 |
1031 void Isolate::ResumeExecution() { | |
1032 if (has_pending_exception() && | |
1033 pending_exception() == heap_.termination_exception()) { | |
1034 thread_local_top()->external_caught_exception_ = false; | |
1035 clear_pending_exception(); | |
1036 } | |
1037 if (has_scheduled_exception() && | |
1038 scheduled_exception() == heap_.termination_exception()) { | |
1039 clear_scheduled_exception(); | |
1040 } | |
1041 } | |
1042 | |
1043 | |
1044 Failure* Isolate::Throw(Object* exception, MessageLocation* location) { | 1031 Failure* Isolate::Throw(Object* exception, MessageLocation* location) { |
1045 DoThrow(exception, location); | 1032 DoThrow(exception, location); |
1046 return Failure::Exception(); | 1033 return Failure::Exception(); |
1047 } | 1034 } |
1048 | 1035 |
1049 | 1036 |
1050 Failure* Isolate::ReThrow(MaybeObject* exception) { | 1037 Failure* Isolate::ReThrow(MaybeObject* exception) { |
1051 bool can_be_caught_externally = false; | 1038 bool can_be_caught_externally = false; |
1052 bool catchable_by_javascript = is_catchable_by_javascript(exception); | 1039 bool catchable_by_javascript = is_catchable_by_javascript(exception); |
1053 ShouldReportException(&can_be_caught_externally, catchable_by_javascript); | 1040 ShouldReportException(&can_be_caught_externally, catchable_by_javascript); |
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1889 bool external_caught = IsExternallyCaught(); | 1876 bool external_caught = IsExternallyCaught(); |
1890 thread_local_top_.external_caught_exception_ = external_caught; | 1877 thread_local_top_.external_caught_exception_ = external_caught; |
1891 | 1878 |
1892 if (!external_caught) return; | 1879 if (!external_caught) return; |
1893 | 1880 |
1894 if (thread_local_top_.pending_exception_ == Failure::OutOfMemoryException()) { | 1881 if (thread_local_top_.pending_exception_ == Failure::OutOfMemoryException()) { |
1895 // Do not propagate OOM exception: we should kill VM asap. | 1882 // Do not propagate OOM exception: we should kill VM asap. |
1896 } else if (thread_local_top_.pending_exception_ == | 1883 } else if (thread_local_top_.pending_exception_ == |
1897 heap()->termination_exception()) { | 1884 heap()->termination_exception()) { |
1898 try_catch_handler()->can_continue_ = false; | 1885 try_catch_handler()->can_continue_ = false; |
1899 try_catch_handler()->has_terminated_ = true; | |
1900 try_catch_handler()->exception_ = heap()->null_value(); | 1886 try_catch_handler()->exception_ = heap()->null_value(); |
1901 } else { | 1887 } else { |
1902 // At this point all non-object (failure) exceptions have | 1888 // At this point all non-object (failure) exceptions have |
1903 // been dealt with so this shouldn't fail. | 1889 // been dealt with so this shouldn't fail. |
1904 ASSERT(!pending_exception()->IsFailure()); | 1890 ASSERT(!pending_exception()->IsFailure()); |
1905 try_catch_handler()->can_continue_ = true; | 1891 try_catch_handler()->can_continue_ = true; |
1906 try_catch_handler()->has_terminated_ = false; | |
1907 try_catch_handler()->exception_ = pending_exception(); | 1892 try_catch_handler()->exception_ = pending_exception(); |
1908 if (!thread_local_top_.pending_message_obj_->IsTheHole()) { | 1893 if (!thread_local_top_.pending_message_obj_->IsTheHole()) { |
1909 try_catch_handler()->message_ = thread_local_top_.pending_message_obj_; | 1894 try_catch_handler()->message_ = thread_local_top_.pending_message_obj_; |
1910 } | 1895 } |
1911 } | 1896 } |
1912 } | 1897 } |
1913 | 1898 |
1914 | 1899 |
1915 void Isolate::InitializeLoggingAndCounters() { | 1900 void Isolate::InitializeLoggingAndCounters() { |
1916 if (logger_ == NULL) { | 1901 if (logger_ == NULL) { |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2192 | 2177 |
2193 #ifdef DEBUG | 2178 #ifdef DEBUG |
2194 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2179 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
2195 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2180 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
2196 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2181 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
2197 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2182 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
2198 #undef ISOLATE_FIELD_OFFSET | 2183 #undef ISOLATE_FIELD_OFFSET |
2199 #endif | 2184 #endif |
2200 | 2185 |
2201 } } // namespace v8::internal | 2186 } } // namespace v8::internal |
OLD | NEW |