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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 thread_local_.c_entry_fp_ = 0; | 94 thread_local_.c_entry_fp_ = 0; |
95 thread_local_.handler_ = 0; | 95 thread_local_.handler_ = 0; |
96 thread_local_.stack_is_cooked_ = false; | 96 thread_local_.stack_is_cooked_ = false; |
97 thread_local_.try_catch_handler_ = NULL; | 97 thread_local_.try_catch_handler_ = NULL; |
98 thread_local_.context_ = NULL; | 98 thread_local_.context_ = NULL; |
99 thread_local_.external_caught_exception_ = false; | 99 thread_local_.external_caught_exception_ = false; |
100 thread_local_.failed_access_check_callback_ = NULL; | 100 thread_local_.failed_access_check_callback_ = NULL; |
101 clear_pending_exception(); | 101 clear_pending_exception(); |
102 clear_scheduled_exception(); | 102 clear_scheduled_exception(); |
103 thread_local_.save_context_ = NULL; | 103 thread_local_.save_context_ = NULL; |
104 thread_local_.pending_external_caught_exception_ = false; | 104 thread_local_.catcher_ = NULL; |
105 } | 105 } |
106 | 106 |
107 | 107 |
108 // Create a dummy thread that will wait forever on a semaphore. The only | 108 // Create a dummy thread that will wait forever on a semaphore. The only |
109 // purpose for this thread is to have some stack area to save essential data | 109 // purpose for this thread is to have some stack area to save essential data |
110 // into for use by a stacks only core dump (aka minidump). | 110 // into for use by a stacks only core dump (aka minidump). |
111 class PreallocatedMemoryThread: public Thread { | 111 class PreallocatedMemoryThread: public Thread { |
112 public: | 112 public: |
113 PreallocatedMemoryThread() : keep_running_(true) { | 113 PreallocatedMemoryThread() : keep_running_(true) { |
114 wait_for_ever_semaphore_ = OS::CreateSemaphore(0); | 114 wait_for_ever_semaphore_ = OS::CreateSemaphore(0); |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 } | 600 } |
601 | 601 |
602 | 602 |
603 Failure* Top::Throw(Object* exception, MessageLocation* location) { | 603 Failure* Top::Throw(Object* exception, MessageLocation* location) { |
604 DoThrow(exception, location, NULL); | 604 DoThrow(exception, location, NULL); |
605 return Failure::Exception(); | 605 return Failure::Exception(); |
606 } | 606 } |
607 | 607 |
608 | 608 |
609 Failure* Top::ReThrow(Object* exception, MessageLocation* location) { | 609 Failure* Top::ReThrow(Object* exception, MessageLocation* location) { |
610 // Set the exception being re-thrown. | 610 // Set the exception beeing re-thrown. |
611 set_pending_exception(exception); | 611 set_pending_exception(exception); |
612 return Failure::Exception(); | 612 return Failure::Exception(); |
613 } | 613 } |
614 | 614 |
615 | 615 |
616 void Top::ScheduleThrow(Object* exception) { | 616 void Top::ScheduleThrow(Object* exception) { |
617 // When scheduling a throw we first throw the exception to get the | 617 // When scheduling a throw we first throw the exception to get the |
618 // error reporting if it is uncaught before rescheduling it. | 618 // error reporting if it is uncaught before rescheduling it. |
619 Throw(exception); | 619 Throw(exception); |
620 thread_local_.scheduled_exception_ = pending_exception(); | 620 thread_local_.scheduled_exception_ = pending_exception(); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 } | 782 } |
783 Handle<String> stack_trace; | 783 Handle<String> stack_trace; |
784 if (FLAG_trace_exception) stack_trace = StackTrace(); | 784 if (FLAG_trace_exception) stack_trace = StackTrace(); |
785 message_obj = MessageHandler::MakeMessageObject("uncaught_exception", | 785 message_obj = MessageHandler::MakeMessageObject("uncaught_exception", |
786 location, HandleVector<Object>(&exception_handle, 1), stack_trace); | 786 location, HandleVector<Object>(&exception_handle, 1), stack_trace); |
787 } | 787 } |
788 | 788 |
789 // If the exception is caught externally, we store it in the | 789 // If the exception is caught externally, we store it in the |
790 // try/catch handler. The C code can find it later and process it if | 790 // try/catch handler. The C code can find it later and process it if |
791 // necessary. | 791 // necessary. |
792 thread_local_.pending_external_caught_exception_ = is_caught_externally; | 792 thread_local_.catcher_ = NULL; |
793 if (is_caught_externally) { | 793 if (is_caught_externally) { |
| 794 thread_local_.catcher_ = thread_local_.try_catch_handler_; |
794 thread_local_.try_catch_handler_->exception_ = | 795 thread_local_.try_catch_handler_->exception_ = |
795 reinterpret_cast<void*>(*exception_handle); | 796 reinterpret_cast<void*>(*exception_handle); |
796 if (!message_obj.is_null()) { | 797 if (!message_obj.is_null()) { |
797 thread_local_.try_catch_handler_->message_ = | 798 thread_local_.try_catch_handler_->message_ = |
798 reinterpret_cast<void*>(*message_obj); | 799 reinterpret_cast<void*>(*message_obj); |
799 } | 800 } |
800 } | 801 } |
801 | 802 |
802 // Notify debugger of exception. | 803 // Notify debugger of exception. |
803 Debugger::OnException(exception_handle, report_exception); | 804 Debugger::OnException(exception_handle, report_exception); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 Top::break_access_->Lock(); | 893 Top::break_access_->Lock(); |
893 } | 894 } |
894 | 895 |
895 | 896 |
896 ExecutionAccess::~ExecutionAccess() { | 897 ExecutionAccess::~ExecutionAccess() { |
897 Top::break_access_->Unlock(); | 898 Top::break_access_->Unlock(); |
898 } | 899 } |
899 | 900 |
900 | 901 |
901 } } // namespace v8::internal | 902 } } // namespace v8::internal |
OLD | NEW |