| 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 928 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 try_catch_handler() : NULL; | 939 try_catch_handler() : NULL; |
| 940 | 940 |
| 941 // Set the exception being re-thrown. | 941 // Set the exception being re-thrown. |
| 942 set_pending_exception(exception); | 942 set_pending_exception(exception); |
| 943 if (exception->IsFailure()) return exception->ToFailureUnchecked(); | 943 if (exception->IsFailure()) return exception->ToFailureUnchecked(); |
| 944 return Failure::Exception(); | 944 return Failure::Exception(); |
| 945 } | 945 } |
| 946 | 946 |
| 947 | 947 |
| 948 Failure* Isolate::ThrowIllegalOperation() { | 948 Failure* Isolate::ThrowIllegalOperation() { |
| 949 #ifdef DEBUG |
| 950 PrintStack(stdout); |
| 951 #endif // DEBUG |
| 949 return Throw(heap_.illegal_access_string()); | 952 return Throw(heap_.illegal_access_string()); |
| 950 } | 953 } |
| 951 | 954 |
| 952 | 955 |
| 953 void Isolate::ScheduleThrow(Object* exception) { | 956 void Isolate::ScheduleThrow(Object* exception) { |
| 954 // When scheduling a throw we first throw the exception to get the | 957 // When scheduling a throw we first throw the exception to get the |
| 955 // error reporting if it is uncaught before rescheduling it. | 958 // error reporting if it is uncaught before rescheduling it. |
| 956 Throw(exception); | 959 Throw(exception); |
| 957 PropagatePendingExceptionToExternalTryCatch(); | 960 PropagatePendingExceptionToExternalTryCatch(); |
| 958 if (has_pending_exception()) { | 961 if (has_pending_exception()) { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1115 MessageLocation potential_computed_location; | 1118 MessageLocation potential_computed_location; |
| 1116 if (location == NULL) { | 1119 if (location == NULL) { |
| 1117 // If no location was specified we use a computed one instead. | 1120 // If no location was specified we use a computed one instead. |
| 1118 ComputeLocation(&potential_computed_location); | 1121 ComputeLocation(&potential_computed_location); |
| 1119 location = &potential_computed_location; | 1122 location = &potential_computed_location; |
| 1120 } | 1123 } |
| 1121 // It's not safe to try to make message objects or collect stack traces | 1124 // It's not safe to try to make message objects or collect stack traces |
| 1122 // while the bootstrapper is active since the infrastructure may not have | 1125 // while the bootstrapper is active since the infrastructure may not have |
| 1123 // been properly initialized. | 1126 // been properly initialized. |
| 1124 if (!bootstrapping) { | 1127 if (!bootstrapping) { |
| 1125 Handle<String> stack_trace; | |
| 1126 if (FLAG_trace_exception) stack_trace = StackTraceString(); | |
| 1127 Handle<JSArray> stack_trace_object; | 1128 Handle<JSArray> stack_trace_object; |
| 1128 if (capture_stack_trace_for_uncaught_exceptions_) { | 1129 if (capture_stack_trace_for_uncaught_exceptions_) { |
| 1129 if (IsErrorObject(exception_handle)) { | 1130 if (IsErrorObject(exception_handle)) { |
| 1130 // We fetch the stack trace that corresponds to this error object. | 1131 // We fetch the stack trace that corresponds to this error object. |
| 1131 String* key = heap()->hidden_stack_trace_string(); | 1132 String* key = heap()->hidden_stack_trace_string(); |
| 1132 Object* stack_property = | 1133 Object* stack_property = |
| 1133 JSObject::cast(*exception_handle)->GetHiddenProperty(key); | 1134 JSObject::cast(*exception_handle)->GetHiddenProperty(key); |
| 1134 // Property lookup may have failed. In this case it's probably not | 1135 // Property lookup may have failed. In this case it's probably not |
| 1135 // a valid Error object. | 1136 // a valid Error object. |
| 1136 if (stack_property->IsJSArray()) { | 1137 if (stack_property->IsJSArray()) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1156 if (failed) { | 1157 if (failed) { |
| 1157 exception_arg = factory()->InternalizeOneByteString( | 1158 exception_arg = factory()->InternalizeOneByteString( |
| 1158 STATIC_ASCII_VECTOR("exception")); | 1159 STATIC_ASCII_VECTOR("exception")); |
| 1159 } | 1160 } |
| 1160 } | 1161 } |
| 1161 Handle<Object> message_obj = MessageHandler::MakeMessageObject( | 1162 Handle<Object> message_obj = MessageHandler::MakeMessageObject( |
| 1162 this, | 1163 this, |
| 1163 "uncaught_exception", | 1164 "uncaught_exception", |
| 1164 location, | 1165 location, |
| 1165 HandleVector<Object>(&exception_arg, 1), | 1166 HandleVector<Object>(&exception_arg, 1), |
| 1166 stack_trace, | |
| 1167 stack_trace_object); | 1167 stack_trace_object); |
| 1168 thread_local_top()->pending_message_obj_ = *message_obj; | 1168 thread_local_top()->pending_message_obj_ = *message_obj; |
| 1169 if (location != NULL) { | 1169 if (location != NULL) { |
| 1170 thread_local_top()->pending_message_script_ = *location->script(); | 1170 thread_local_top()->pending_message_script_ = *location->script(); |
| 1171 thread_local_top()->pending_message_start_pos_ = location->start_pos(); | 1171 thread_local_top()->pending_message_start_pos_ = location->start_pos(); |
| 1172 thread_local_top()->pending_message_end_pos_ = location->end_pos(); | 1172 thread_local_top()->pending_message_end_pos_ = location->end_pos(); |
| 1173 } | 1173 } |
| 1174 | 1174 |
| 1175 // If the abort-on-uncaught-exception flag is specified, abort on any | 1175 // If the abort-on-uncaught-exception flag is specified, abort on any |
| 1176 // exception not caught by JavaScript, even when an external handler is | 1176 // exception not caught by JavaScript, even when an external handler is |
| (...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2312 | 2312 |
| 2313 #ifdef DEBUG | 2313 #ifdef DEBUG |
| 2314 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2314 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 2315 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2315 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
| 2316 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2316 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 2317 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2317 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 2318 #undef ISOLATE_FIELD_OFFSET | 2318 #undef ISOLATE_FIELD_OFFSET |
| 2319 #endif | 2319 #endif |
| 2320 | 2320 |
| 2321 } } // namespace v8::internal | 2321 } } // namespace v8::internal |
| OLD | NEW |