OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 clear_pending_message(); | 816 clear_pending_message(); |
817 } | 817 } |
818 | 818 |
819 | 819 |
820 void Top::TraceException(bool flag) { | 820 void Top::TraceException(bool flag) { |
821 FLAG_trace_exception = flag; | 821 FLAG_trace_exception = flag; |
822 } | 822 } |
823 | 823 |
824 | 824 |
825 bool Top::optional_reschedule_exception(bool is_bottom_call) { | 825 bool Top::optional_reschedule_exception(bool is_bottom_call) { |
826 // Allways reschedule out of memory exceptions. | 826 if (!is_out_of_memory() && |
827 if (!is_out_of_memory()) { | 827 (thread_local_.external_caught_exception_ || is_bottom_call)) { |
828 // Never reschedule the exception if this is the bottom call. | 828 thread_local_.external_caught_exception_ = false; |
829 bool clear_exception = is_bottom_call; | 829 clear_pending_exception(); |
830 | 830 return false; |
831 // If the exception is externally caught, clear it if there are no | 831 } else { |
832 // JavaScript frames on the way to the C++ frame that has the | 832 thread_local_.scheduled_exception_ = pending_exception(); |
833 // external handler. | 833 clear_pending_exception(); |
834 if (thread_local_.external_caught_exception_) { | 834 return true; |
835 ASSERT(thread_local_.try_catch_handler_ != NULL); | |
836 Address external_handler_address = | |
837 reinterpret_cast<Address>(thread_local_.try_catch_handler_); | |
838 JavaScriptFrameIterator it; | |
839 if (it.done() || (it.frame()->sp() > external_handler_address)) { | |
840 clear_exception = true; | |
841 } | |
842 } | |
843 | |
844 // Clear the exception if needed. | |
845 if (clear_exception) { | |
846 thread_local_.external_caught_exception_ = false; | |
847 clear_pending_exception(); | |
848 return false; | |
849 } | |
850 } | 835 } |
851 | |
852 // Reschedule the exception. | |
853 thread_local_.scheduled_exception_ = pending_exception(); | |
854 clear_pending_exception(); | |
855 return true; | |
856 } | 836 } |
857 | 837 |
858 | 838 |
859 bool Top::is_out_of_memory() { | 839 bool Top::is_out_of_memory() { |
860 if (has_pending_exception()) { | 840 if (has_pending_exception()) { |
861 Object* e = pending_exception(); | 841 Object* e = pending_exception(); |
862 if (e->IsFailure() && Failure::cast(e)->IsOutOfMemoryException()) { | 842 if (e->IsFailure() && Failure::cast(e)->IsOutOfMemoryException()) { |
863 return true; | 843 return true; |
864 } | 844 } |
865 } | 845 } |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 Top::break_access_->Lock(); | 892 Top::break_access_->Lock(); |
913 } | 893 } |
914 | 894 |
915 | 895 |
916 ExecutionAccess::~ExecutionAccess() { | 896 ExecutionAccess::~ExecutionAccess() { |
917 Top::break_access_->Unlock(); | 897 Top::break_access_->Unlock(); |
918 } | 898 } |
919 | 899 |
920 | 900 |
921 } } // namespace v8::internal | 901 } } // namespace v8::internal |
OLD | NEW |