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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 !(Script::cast(script)->source()->IsUndefined())) { | 799 !(Script::cast(script)->source()->IsUndefined())) { |
800 int pos = frame->code()->SourcePosition(frame->pc()); | 800 int pos = frame->code()->SourcePosition(frame->pc()); |
801 // Compute the location from the function and the reloc info. | 801 // Compute the location from the function and the reloc info. |
802 Handle<Script> casted_script(Script::cast(script)); | 802 Handle<Script> casted_script(Script::cast(script)); |
803 *target = MessageLocation(casted_script, pos, pos + 1); | 803 *target = MessageLocation(casted_script, pos, pos + 1); |
804 } | 804 } |
805 } | 805 } |
806 } | 806 } |
807 | 807 |
808 | 808 |
809 bool Top::ShouldReturnException(bool* is_caught_externally, | 809 bool Top::ShouldReportException(bool* is_caught_externally, |
810 bool catchable_by_javascript) { | 810 bool catchable_by_javascript) { |
811 // Find the top-most try-catch handler. | 811 // Find the top-most try-catch handler. |
812 StackHandler* handler = | 812 StackHandler* handler = |
813 StackHandler::FromAddress(Top::handler(Top::GetCurrentThread())); | 813 StackHandler::FromAddress(Top::handler(Top::GetCurrentThread())); |
814 while (handler != NULL && !handler->is_try_catch()) { | 814 while (handler != NULL && !handler->is_try_catch()) { |
815 handler = handler->next(); | 815 handler = handler->next(); |
816 } | 816 } |
817 | 817 |
818 // Get the address of the external handler so we can compare the address to | 818 // Get the address of the external handler so we can compare the address to |
819 // determine which one is closer to the top of the stack. | 819 // determine which one is closer to the top of the stack. |
(...skipping 20 matching lines...) Expand all Loading... |
840 MessageLocation* location, | 840 MessageLocation* location, |
841 const char* message) { | 841 const char* message) { |
842 ASSERT(!has_pending_exception()); | 842 ASSERT(!has_pending_exception()); |
843 | 843 |
844 HandleScope scope; | 844 HandleScope scope; |
845 Object* exception_object = Smi::FromInt(0); | 845 Object* exception_object = Smi::FromInt(0); |
846 bool is_object = exception->ToObject(&exception_object); | 846 bool is_object = exception->ToObject(&exception_object); |
847 Handle<Object> exception_handle(exception_object); | 847 Handle<Object> exception_handle(exception_object); |
848 | 848 |
849 // Determine reporting and whether the exception is caught externally. | 849 // Determine reporting and whether the exception is caught externally. |
850 bool is_caught_externally = false; | |
851 bool is_out_of_memory = exception == Failure::OutOfMemoryException(); | 850 bool is_out_of_memory = exception == Failure::OutOfMemoryException(); |
852 bool is_termination_exception = exception == Heap::termination_exception(); | 851 bool is_termination_exception = exception == Heap::termination_exception(); |
853 bool catchable_by_javascript = !is_termination_exception && !is_out_of_memory; | 852 bool catchable_by_javascript = !is_termination_exception && !is_out_of_memory; |
854 // Only real objects can be caught by JS. | 853 // Only real objects can be caught by JS. |
855 ASSERT(!catchable_by_javascript || is_object); | 854 ASSERT(!catchable_by_javascript || is_object); |
856 bool should_return_exception = | 855 bool is_caught_externally = false; |
857 ShouldReturnException(&is_caught_externally, catchable_by_javascript); | 856 bool should_report_exception = |
858 bool report_exception = catchable_by_javascript && should_return_exception; | 857 ShouldReportException(&is_caught_externally, catchable_by_javascript); |
| 858 bool report_exception = catchable_by_javascript && should_report_exception; |
859 | 859 |
860 #ifdef ENABLE_DEBUGGER_SUPPORT | 860 #ifdef ENABLE_DEBUGGER_SUPPORT |
861 // Notify debugger of exception. | 861 // Notify debugger of exception. |
862 if (catchable_by_javascript) { | 862 if (catchable_by_javascript) { |
863 Debugger::OnException(exception_handle, report_exception); | 863 Debugger::OnException(exception_handle, report_exception); |
864 } | 864 } |
865 #endif | 865 #endif |
866 | 866 |
867 // Generate the message. | 867 // Generate the message. |
868 Handle<Object> message_obj; | 868 Handle<Object> message_obj; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1097 #ifdef V8_TARGET_ARCH_ARM | 1097 #ifdef V8_TARGET_ARCH_ARM |
1098 thread_local_.simulator_ = Simulator::current(); | 1098 thread_local_.simulator_ = Simulator::current(); |
1099 #elif V8_TARGET_ARCH_MIPS | 1099 #elif V8_TARGET_ARCH_MIPS |
1100 thread_local_.simulator_ = assembler::mips::Simulator::current(); | 1100 thread_local_.simulator_ = assembler::mips::Simulator::current(); |
1101 #endif | 1101 #endif |
1102 #endif | 1102 #endif |
1103 return from + sizeof(thread_local_); | 1103 return from + sizeof(thread_local_); |
1104 } | 1104 } |
1105 | 1105 |
1106 } } // namespace v8::internal | 1106 } } // namespace v8::internal |
OLD | NEW |