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 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
1177 // present. This flag is intended for use by JavaScript developers, so | 1177 // present. This flag is intended for use by JavaScript developers, so |
1178 // print a user-friendly stack trace (not an internal one). | 1178 // print a user-friendly stack trace (not an internal one). |
1179 if (fatal_exception_depth == 0 && | 1179 if (fatal_exception_depth == 0 && |
1180 FLAG_abort_on_uncaught_exception && | 1180 FLAG_abort_on_uncaught_exception && |
1181 (report_exception || can_be_caught_externally)) { | 1181 (report_exception || can_be_caught_externally)) { |
1182 fatal_exception_depth++; | 1182 fatal_exception_depth++; |
1183 PrintF(stderr, | 1183 PrintF(stderr, |
1184 "%s\n\nFROM\n", | 1184 "%s\n\nFROM\n", |
1185 *MessageHandler::GetLocalizedMessage(this, message_obj)); | 1185 MessageHandler::GetLocalizedMessage(this, message_obj).get()); |
1186 PrintCurrentStackTrace(stderr); | 1186 PrintCurrentStackTrace(stderr); |
1187 OS::Abort(); | 1187 OS::Abort(); |
1188 } | 1188 } |
1189 } else if (location != NULL && !location->script().is_null()) { | 1189 } else if (location != NULL && !location->script().is_null()) { |
1190 // We are bootstrapping and caught an error where the location is set | 1190 // We are bootstrapping and caught an error where the location is set |
1191 // and we have a script for the location. | 1191 // and we have a script for the location. |
1192 // In this case we could have an extension (or an internal error | 1192 // In this case we could have an extension (or an internal error |
1193 // somewhere) and we print out the line number at which the error occured | 1193 // somewhere) and we print out the line number at which the error occured |
1194 // to the console for easier debugging. | 1194 // to the console for easier debugging. |
1195 int line_number = GetScriptLineNumberSafe(location->script(), | 1195 int line_number = GetScriptLineNumberSafe(location->script(), |
1196 location->start_pos()); | 1196 location->start_pos()); |
1197 if (exception->IsString() && location->script()->name()->IsString()) { | 1197 if (exception->IsString() && location->script()->name()->IsString()) { |
1198 OS::PrintError( | 1198 OS::PrintError( |
1199 "Extension or internal compilation error: %s in %s at line %d.\n", | 1199 "Extension or internal compilation error: %s in %s at line %d.\n", |
1200 *String::cast(exception)->ToCString(), | 1200 String::cast(exception)->ToCString().get(), |
1201 *String::cast(location->script()->name())->ToCString(), | 1201 String::cast(location->script()->name())->ToCString().get(), |
1202 line_number + 1); | 1202 line_number + 1); |
1203 } else if (location->script()->name()->IsString()) { | 1203 } else if (location->script()->name()->IsString()) { |
1204 OS::PrintError( | 1204 OS::PrintError( |
1205 "Extension or internal compilation error in %s at line %d.\n", | 1205 "Extension or internal compilation error in %s at line %d.\n", |
1206 *String::cast(location->script()->name())->ToCString(), | 1206 String::cast(location->script()->name())->ToCString().get(), |
1207 line_number + 1); | 1207 line_number + 1); |
1208 } else { | 1208 } else { |
1209 OS::PrintError("Extension or internal compilation error.\n"); | 1209 OS::PrintError("Extension or internal compilation error.\n"); |
1210 } | 1210 } |
1211 } | 1211 } |
1212 } | 1212 } |
1213 | 1213 |
1214 // Save the message for reporting if the the exception remains uncaught. | 1214 // Save the message for reporting if the the exception remains uncaught. |
1215 thread_local_top()->has_pending_message_ = report_exception; | 1215 thread_local_top()->has_pending_message_ = report_exception; |
1216 | 1216 |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2298 | 2298 |
2299 #ifdef DEBUG | 2299 #ifdef DEBUG |
2300 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2300 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
2301 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2301 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
2302 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2302 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
2303 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2303 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
2304 #undef ISOLATE_FIELD_OFFSET | 2304 #undef ISOLATE_FIELD_OFFSET |
2305 #endif | 2305 #endif |
2306 | 2306 |
2307 } } // namespace v8::internal | 2307 } } // namespace v8::internal |
OLD | NEW |