Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: src/isolate.cc

Issue 15858003: Merged r14185 into 3.14 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.14
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/flag-definitions.h ('k') | src/version.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 for (Object* prototype = *obj; !prototype->IsNull(); 1073 for (Object* prototype = *obj; !prototype->IsNull();
1074 prototype = prototype->GetPrototype()) { 1074 prototype = prototype->GetPrototype()) {
1075 if (!prototype->IsJSObject()) return false; 1075 if (!prototype->IsJSObject()) return false;
1076 if (JSObject::cast(prototype)->map()->constructor() == error_constructor) { 1076 if (JSObject::cast(prototype)->map()->constructor() == error_constructor) {
1077 return true; 1077 return true;
1078 } 1078 }
1079 } 1079 }
1080 return false; 1080 return false;
1081 } 1081 }
1082 1082
1083 static int fatal_exception_depth = 0;
1083 1084
1084 void Isolate::DoThrow(Object* exception, MessageLocation* location) { 1085 void Isolate::DoThrow(Object* exception, MessageLocation* location) {
1085 ASSERT(!has_pending_exception()); 1086 ASSERT(!has_pending_exception());
1086 1087
1087 HandleScope scope; 1088 HandleScope scope;
1088 Handle<Object> exception_handle(exception); 1089 Handle<Object> exception_handle(exception);
1089 1090
1090 // Determine reporting and whether the exception is caught externally. 1091 // Determine reporting and whether the exception is caught externally.
1091 bool catchable_by_javascript = is_catchable_by_javascript(exception); 1092 bool catchable_by_javascript = is_catchable_by_javascript(exception);
1092 bool can_be_caught_externally = false; 1093 bool can_be_caught_externally = false;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 location, 1144 location,
1144 HandleVector<Object>(&exception_handle, 1), 1145 HandleVector<Object>(&exception_handle, 1),
1145 stack_trace, 1146 stack_trace,
1146 stack_trace_object); 1147 stack_trace_object);
1147 thread_local_top()->pending_message_obj_ = *message_obj; 1148 thread_local_top()->pending_message_obj_ = *message_obj;
1148 if (location != NULL) { 1149 if (location != NULL) {
1149 thread_local_top()->pending_message_script_ = *location->script(); 1150 thread_local_top()->pending_message_script_ = *location->script();
1150 thread_local_top()->pending_message_start_pos_ = location->start_pos(); 1151 thread_local_top()->pending_message_start_pos_ = location->start_pos();
1151 thread_local_top()->pending_message_end_pos_ = location->end_pos(); 1152 thread_local_top()->pending_message_end_pos_ = location->end_pos();
1152 } 1153 }
1154
1155 // If the abort-on-uncaught-exception flag is specified, abort on any
1156 // exception not caught by JavaScript, even when an external handler is
1157 // present. This flag is intended for use by JavaScript developers, so
1158 // print a user-friendly stack trace (not an internal one).
1159 if (fatal_exception_depth == 0 &&
1160 FLAG_abort_on_uncaught_exception &&
1161 (report_exception || can_be_caught_externally)) {
1162 fatal_exception_depth++;
1163 fprintf(stderr, "%s\n\nFROM\n",
1164 *MessageHandler::GetLocalizedMessage(this, message_obj));
1165 PrintCurrentStackTrace(stderr);
1166 OS::Abort();
1167 }
1153 } else if (location != NULL && !location->script().is_null()) { 1168 } else if (location != NULL && !location->script().is_null()) {
1154 // We are bootstrapping and caught an error where the location is set 1169 // We are bootstrapping and caught an error where the location is set
1155 // and we have a script for the location. 1170 // and we have a script for the location.
1156 // In this case we could have an extension (or an internal error 1171 // In this case we could have an extension (or an internal error
1157 // somewhere) and we print out the line number at which the error occured 1172 // somewhere) and we print out the line number at which the error occured
1158 // to the console for easier debugging. 1173 // to the console for easier debugging.
1159 int line_number = GetScriptLineNumberSafe(location->script(), 1174 int line_number = GetScriptLineNumberSafe(location->script(),
1160 location->start_pos()); 1175 location->start_pos());
1161 if (exception->IsString()) { 1176 if (exception->IsString()) {
1162 OS::PrintError( 1177 OS::PrintError(
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
2058 2073
2059 #ifdef DEBUG 2074 #ifdef DEBUG
2060 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 2075 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
2061 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 2076 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
2062 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 2077 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
2063 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 2078 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
2064 #undef ISOLATE_FIELD_OFFSET 2079 #undef ISOLATE_FIELD_OFFSET
2065 #endif 2080 #endif
2066 2081
2067 } } // namespace v8::internal 2082 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/flag-definitions.h ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698