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 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 Failure* Top::Throw(Object* exception, MessageLocation* location) { | 728 Failure* Top::Throw(Object* exception, MessageLocation* location) { |
729 DoThrow(exception, location, NULL); | 729 DoThrow(exception, location, NULL); |
730 return Failure::Exception(); | 730 return Failure::Exception(); |
731 } | 731 } |
732 | 732 |
733 | 733 |
734 Failure* Top::ReThrow(MaybeObject* exception, MessageLocation* location) { | 734 Failure* Top::ReThrow(MaybeObject* exception, MessageLocation* location) { |
735 bool can_be_caught_externally = false; | 735 bool can_be_caught_externally = false; |
736 ShouldReportException(&can_be_caught_externally, | 736 ShouldReportException(&can_be_caught_externally, |
737 is_catchable_by_javascript(exception)); | 737 is_catchable_by_javascript(exception)); |
738 if (can_be_caught_externally) { | 738 thread_local_.catcher_ = can_be_caught_externally ? |
739 thread_local_.catcher_ = try_catch_handler(); | 739 try_catch_handler() : NULL; |
740 } | |
741 | 740 |
742 // Set the exception being re-thrown. | 741 // Set the exception being re-thrown. |
743 set_pending_exception(exception); | 742 set_pending_exception(exception); |
744 return Failure::Exception(); | 743 return Failure::Exception(); |
745 } | 744 } |
746 | 745 |
747 | 746 |
748 Failure* Top::ThrowIllegalOperation() { | 747 Failure* Top::ThrowIllegalOperation() { |
749 return Throw(Heap::illegal_access_symbol()); | 748 return Throw(Heap::illegal_access_symbol()); |
750 } | 749 } |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 thread_local_.pending_message_ = message; | 905 thread_local_.pending_message_ = message; |
907 if (!message_obj.is_null()) { | 906 if (!message_obj.is_null()) { |
908 thread_local_.pending_message_obj_ = *message_obj; | 907 thread_local_.pending_message_obj_ = *message_obj; |
909 if (location != NULL) { | 908 if (location != NULL) { |
910 thread_local_.pending_message_script_ = *location->script(); | 909 thread_local_.pending_message_script_ = *location->script(); |
911 thread_local_.pending_message_start_pos_ = location->start_pos(); | 910 thread_local_.pending_message_start_pos_ = location->start_pos(); |
912 thread_local_.pending_message_end_pos_ = location->end_pos(); | 911 thread_local_.pending_message_end_pos_ = location->end_pos(); |
913 } | 912 } |
914 } | 913 } |
915 | 914 |
916 if (can_be_caught_externally) { | 915 // Do not forget to clean catcher_ if currently thrown exception cannot |
917 thread_local_.catcher_ = try_catch_handler(); | 916 // be caught. If necessary, ReThrow will update the catcher. |
918 } | 917 thread_local_.catcher_ = can_be_caught_externally ? |
| 918 try_catch_handler() : NULL; |
919 | 919 |
920 // NOTE: Notifying the debugger or generating the message | 920 // NOTE: Notifying the debugger or generating the message |
921 // may have caused new exceptions. For now, we just ignore | 921 // may have caused new exceptions. For now, we just ignore |
922 // that and set the pending exception to the original one. | 922 // that and set the pending exception to the original one. |
923 if (is_object) { | 923 if (is_object) { |
924 set_pending_exception(*exception_handle); | 924 set_pending_exception(*exception_handle); |
925 } else { | 925 } else { |
926 // Failures are not on the heap so they neither need nor work with handles. | 926 // Failures are not on the heap so they neither need nor work with handles. |
927 ASSERT(exception_handle->IsFailure()); | 927 ASSERT(exception_handle->IsFailure()); |
928 set_pending_exception(exception); | 928 set_pending_exception(exception); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 #ifdef V8_TARGET_ARCH_ARM | 1143 #ifdef V8_TARGET_ARCH_ARM |
1144 thread_local_.simulator_ = Simulator::current(); | 1144 thread_local_.simulator_ = Simulator::current(); |
1145 #elif V8_TARGET_ARCH_MIPS | 1145 #elif V8_TARGET_ARCH_MIPS |
1146 thread_local_.simulator_ = assembler::mips::Simulator::current(); | 1146 thread_local_.simulator_ = assembler::mips::Simulator::current(); |
1147 #endif | 1147 #endif |
1148 #endif | 1148 #endif |
1149 return from + sizeof(thread_local_); | 1149 return from + sizeof(thread_local_); |
1150 } | 1150 } |
1151 | 1151 |
1152 } } // namespace v8::internal | 1152 } } // namespace v8::internal |
OLD | NEW |