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 1326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1337 | 1337 |
1338 void Isolate::ReportPendingMessages() { | 1338 void Isolate::ReportPendingMessages() { |
1339 ASSERT(has_pending_exception()); | 1339 ASSERT(has_pending_exception()); |
1340 PropagatePendingExceptionToExternalTryCatch(); | 1340 PropagatePendingExceptionToExternalTryCatch(); |
1341 | 1341 |
1342 // If the pending exception is OutOfMemoryException set out_of_memory in | 1342 // If the pending exception is OutOfMemoryException set out_of_memory in |
1343 // the native context. Note: We have to mark the native context here | 1343 // the native context. Note: We have to mark the native context here |
1344 // since the GenerateThrowOutOfMemory stub cannot make a RuntimeCall to | 1344 // since the GenerateThrowOutOfMemory stub cannot make a RuntimeCall to |
1345 // set it. | 1345 // set it. |
1346 HandleScope scope; | 1346 HandleScope scope; |
1347 if (thread_local_top_.pending_exception_ == Failure::OutOfMemoryException()) { | 1347 if (thread_local_top_.pending_exception_->IsOutOfMemory()) { |
1348 context()->mark_out_of_memory(); | 1348 context()->mark_out_of_memory(); |
1349 } else if (thread_local_top_.pending_exception_ == | 1349 } else if (thread_local_top_.pending_exception_ == |
1350 heap()->termination_exception()) { | 1350 heap()->termination_exception()) { |
1351 // Do nothing: if needed, the exception has been already propagated to | 1351 // Do nothing: if needed, the exception has been already propagated to |
1352 // v8::TryCatch. | 1352 // v8::TryCatch. |
1353 } else { | 1353 } else { |
1354 if (thread_local_top_.has_pending_message_) { | 1354 if (thread_local_top_.has_pending_message_) { |
1355 thread_local_top_.has_pending_message_ = false; | 1355 thread_local_top_.has_pending_message_ = false; |
1356 if (!thread_local_top_.pending_message_obj_->IsTheHole()) { | 1356 if (!thread_local_top_.pending_message_obj_->IsTheHole()) { |
1357 HandleScope scope; | 1357 HandleScope scope; |
(...skipping 10 matching lines...) Expand all Loading... |
1368 } | 1368 } |
1369 } | 1369 } |
1370 } | 1370 } |
1371 clear_pending_message(); | 1371 clear_pending_message(); |
1372 } | 1372 } |
1373 | 1373 |
1374 | 1374 |
1375 MessageLocation Isolate::GetMessageLocation() { | 1375 MessageLocation Isolate::GetMessageLocation() { |
1376 ASSERT(has_pending_exception()); | 1376 ASSERT(has_pending_exception()); |
1377 | 1377 |
1378 if (thread_local_top_.pending_exception_ != Failure::OutOfMemoryException() && | 1378 if (!thread_local_top_.pending_exception_->IsOutOfMemory() && |
1379 thread_local_top_.pending_exception_ != heap()->termination_exception() && | 1379 thread_local_top_.pending_exception_ != heap()->termination_exception() && |
1380 thread_local_top_.has_pending_message_ && | 1380 thread_local_top_.has_pending_message_ && |
1381 !thread_local_top_.pending_message_obj_->IsTheHole() && | 1381 !thread_local_top_.pending_message_obj_->IsTheHole() && |
1382 thread_local_top_.pending_message_script_ != NULL) { | 1382 thread_local_top_.pending_message_script_ != NULL) { |
1383 Handle<Script> script(thread_local_top_.pending_message_script_); | 1383 Handle<Script> script(thread_local_top_.pending_message_script_); |
1384 int start_pos = thread_local_top_.pending_message_start_pos_; | 1384 int start_pos = thread_local_top_.pending_message_start_pos_; |
1385 int end_pos = thread_local_top_.pending_message_end_pos_; | 1385 int end_pos = thread_local_top_.pending_message_end_pos_; |
1386 return MessageLocation(script, start_pos, end_pos); | 1386 return MessageLocation(script, start_pos, end_pos); |
1387 } | 1387 } |
1388 | 1388 |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1882 | 1882 |
1883 | 1883 |
1884 void Isolate::PropagatePendingExceptionToExternalTryCatch() { | 1884 void Isolate::PropagatePendingExceptionToExternalTryCatch() { |
1885 ASSERT(has_pending_exception()); | 1885 ASSERT(has_pending_exception()); |
1886 | 1886 |
1887 bool external_caught = IsExternallyCaught(); | 1887 bool external_caught = IsExternallyCaught(); |
1888 thread_local_top_.external_caught_exception_ = external_caught; | 1888 thread_local_top_.external_caught_exception_ = external_caught; |
1889 | 1889 |
1890 if (!external_caught) return; | 1890 if (!external_caught) return; |
1891 | 1891 |
1892 if (thread_local_top_.pending_exception_ == Failure::OutOfMemoryException()) { | 1892 if (thread_local_top_.pending_exception_->IsOutOfMemory()) { |
1893 // Do not propagate OOM exception: we should kill VM asap. | 1893 // Do not propagate OOM exception: we should kill VM asap. |
1894 } else if (thread_local_top_.pending_exception_ == | 1894 } else if (thread_local_top_.pending_exception_ == |
1895 heap()->termination_exception()) { | 1895 heap()->termination_exception()) { |
1896 try_catch_handler()->can_continue_ = false; | 1896 try_catch_handler()->can_continue_ = false; |
1897 try_catch_handler()->exception_ = heap()->null_value(); | 1897 try_catch_handler()->exception_ = heap()->null_value(); |
1898 } else { | 1898 } else { |
1899 // At this point all non-object (failure) exceptions have | 1899 // At this point all non-object (failure) exceptions have |
1900 // been dealt with so this shouldn't fail. | 1900 // been dealt with so this shouldn't fail. |
1901 ASSERT(!pending_exception()->IsFailure()); | 1901 ASSERT(!pending_exception()->IsFailure()); |
1902 try_catch_handler()->can_continue_ = true; | 1902 try_catch_handler()->can_continue_ = true; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2210 | 2210 |
2211 #ifdef DEBUG | 2211 #ifdef DEBUG |
2212 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2212 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
2213 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2213 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
2214 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2214 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
2215 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2215 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
2216 #undef ISOLATE_FIELD_OFFSET | 2216 #undef ISOLATE_FIELD_OFFSET |
2217 #endif | 2217 #endif |
2218 | 2218 |
2219 } } // namespace v8::internal | 2219 } } // namespace v8::internal |
OLD | NEW |