OLD | NEW |
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 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1131 stack_trace_object = Handle<JSArray>(JSArray::cast(stack_property)); | 1131 stack_trace_object = Handle<JSArray>(JSArray::cast(stack_property)); |
1132 } | 1132 } |
1133 } | 1133 } |
1134 if (stack_trace_object.is_null()) { | 1134 if (stack_trace_object.is_null()) { |
1135 // Not an error object, we capture at throw site. | 1135 // Not an error object, we capture at throw site. |
1136 stack_trace_object = CaptureCurrentStackTrace( | 1136 stack_trace_object = CaptureCurrentStackTrace( |
1137 stack_trace_for_uncaught_exceptions_frame_limit_, | 1137 stack_trace_for_uncaught_exceptions_frame_limit_, |
1138 stack_trace_for_uncaught_exceptions_options_); | 1138 stack_trace_for_uncaught_exceptions_options_); |
1139 } | 1139 } |
1140 } | 1140 } |
| 1141 // Stringify custom error objects for the message object. |
| 1142 if (exception_handle->IsJSObject() && !IsErrorObject(exception_handle)) { |
| 1143 bool failed = false; |
| 1144 exception_handle = Execution::ToString(exception_handle, &failed); |
| 1145 if (failed) { |
| 1146 exception_handle = factory()->LookupAsciiSymbol("exception"); |
| 1147 } |
| 1148 } |
1141 Handle<Object> message_obj = MessageHandler::MakeMessageObject( | 1149 Handle<Object> message_obj = MessageHandler::MakeMessageObject( |
1142 "uncaught_exception", | 1150 "uncaught_exception", |
1143 location, | 1151 location, |
1144 HandleVector<Object>(&exception_handle, 1), | 1152 HandleVector<Object>(&exception_handle, 1), |
1145 stack_trace, | 1153 stack_trace, |
1146 stack_trace_object); | 1154 stack_trace_object); |
1147 thread_local_top()->pending_message_obj_ = *message_obj; | 1155 thread_local_top()->pending_message_obj_ = *message_obj; |
1148 if (location != NULL) { | 1156 if (location != NULL) { |
1149 thread_local_top()->pending_message_script_ = *location->script(); | 1157 thread_local_top()->pending_message_script_ = *location->script(); |
1150 thread_local_top()->pending_message_start_pos_ = location->start_pos(); | 1158 thread_local_top()->pending_message_start_pos_ = location->start_pos(); |
(...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2058 | 2066 |
2059 #ifdef DEBUG | 2067 #ifdef DEBUG |
2060 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2068 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
2061 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2069 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
2062 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2070 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
2063 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2071 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
2064 #undef ISOLATE_FIELD_OFFSET | 2072 #undef ISOLATE_FIELD_OFFSET |
2065 #endif | 2073 #endif |
2066 | 2074 |
2067 } } // namespace v8::internal | 2075 } } // namespace v8::internal |
OLD | NEW |