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

Side by Side Diff: src/isolate.cc

Issue 11142013: Add methods to allow resuming execution after calling TerminateExecution(). (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 924 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 return Failure::Exception(); 935 return Failure::Exception();
936 } 936 }
937 937
938 938
939 Failure* Isolate::TerminateExecution() { 939 Failure* Isolate::TerminateExecution() {
940 DoThrow(heap_.termination_exception(), NULL); 940 DoThrow(heap_.termination_exception(), NULL);
941 return Failure::Exception(); 941 return Failure::Exception();
942 } 942 }
943 943
944 944
945 void Isolate::ResumeExecution() {
946 if (has_pending_exception()
947 && pending_exception() == heap_.termination_exception()) {
Yang 2012/12/07 15:03:48 Please put the && at the end of the line and align
948 thread_local_top()->external_caught_exception_ = false;
949 clear_pending_exception();
950 }
951 if (has_scheduled_exception()
952 && scheduled_exception() == heap_.termination_exception()) {
Yang 2012/12/07 15:03:48 Ditto.
953 clear_scheduled_exception();
954 }
955 }
956
957
945 Failure* Isolate::Throw(Object* exception, MessageLocation* location) { 958 Failure* Isolate::Throw(Object* exception, MessageLocation* location) {
946 DoThrow(exception, location); 959 DoThrow(exception, location);
947 return Failure::Exception(); 960 return Failure::Exception();
948 } 961 }
949 962
950 963
951 Failure* Isolate::ReThrow(MaybeObject* exception) { 964 Failure* Isolate::ReThrow(MaybeObject* exception) {
952 bool can_be_caught_externally = false; 965 bool can_be_caught_externally = false;
953 bool catchable_by_javascript = is_catchable_by_javascript(exception); 966 bool catchable_by_javascript = is_catchable_by_javascript(exception);
954 ShouldReportException(&can_be_caught_externally, catchable_by_javascript); 967 ShouldReportException(&can_be_caught_externally, catchable_by_javascript);
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 bool external_caught = IsExternallyCaught(); 1770 bool external_caught = IsExternallyCaught();
1758 thread_local_top_.external_caught_exception_ = external_caught; 1771 thread_local_top_.external_caught_exception_ = external_caught;
1759 1772
1760 if (!external_caught) return; 1773 if (!external_caught) return;
1761 1774
1762 if (thread_local_top_.pending_exception_ == Failure::OutOfMemoryException()) { 1775 if (thread_local_top_.pending_exception_ == Failure::OutOfMemoryException()) {
1763 // Do not propagate OOM exception: we should kill VM asap. 1776 // Do not propagate OOM exception: we should kill VM asap.
1764 } else if (thread_local_top_.pending_exception_ == 1777 } else if (thread_local_top_.pending_exception_ ==
1765 heap()->termination_exception()) { 1778 heap()->termination_exception()) {
1766 try_catch_handler()->can_continue_ = false; 1779 try_catch_handler()->can_continue_ = false;
1780 try_catch_handler()->has_terminated_ = true;
1767 try_catch_handler()->exception_ = heap()->null_value(); 1781 try_catch_handler()->exception_ = heap()->null_value();
1768 } else { 1782 } else {
1769 // At this point all non-object (failure) exceptions have 1783 // At this point all non-object (failure) exceptions have
1770 // been dealt with so this shouldn't fail. 1784 // been dealt with so this shouldn't fail.
1771 ASSERT(!pending_exception()->IsFailure()); 1785 ASSERT(!pending_exception()->IsFailure());
1772 try_catch_handler()->can_continue_ = true; 1786 try_catch_handler()->can_continue_ = true;
1787 try_catch_handler()->has_terminated_ = false;
1773 try_catch_handler()->exception_ = pending_exception(); 1788 try_catch_handler()->exception_ = pending_exception();
1774 if (!thread_local_top_.pending_message_obj_->IsTheHole()) { 1789 if (!thread_local_top_.pending_message_obj_->IsTheHole()) {
1775 try_catch_handler()->message_ = thread_local_top_.pending_message_obj_; 1790 try_catch_handler()->message_ = thread_local_top_.pending_message_obj_;
1776 } 1791 }
1777 } 1792 }
1778 } 1793 }
1779 1794
1780 1795
1781 void Isolate::InitializeLoggingAndCounters() { 1796 void Isolate::InitializeLoggingAndCounters() {
1782 if (logger_ == NULL) { 1797 if (logger_ == NULL) {
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 2073
2059 #ifdef DEBUG 2074 #ifdef DEBUG
2060 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 2075 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
2061 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 2076 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
2062 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 2077 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
2063 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 2078 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
2064 #undef ISOLATE_FIELD_OFFSET 2079 #undef ISOLATE_FIELD_OFFSET
2065 #endif 2080 #endif
2066 2081
2067 } } // namespace v8::internal 2082 } } // namespace v8::internal
OLDNEW
« src/execution.cc ('K') | « src/isolate.h ('k') | test/cctest/test-thread-termination.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698