OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/isolate.h" | 5 #include "src/isolate.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <fstream> // NOLINT(readability/streams) | 9 #include <fstream> // NOLINT(readability/streams) |
10 #include <sstream> | 10 #include <sstream> |
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1012 | 1012 |
1013 if (bootstrapper()->IsActive()) { | 1013 if (bootstrapper()->IsActive()) { |
1014 // It's not safe to try to make message objects or collect stack traces | 1014 // It's not safe to try to make message objects or collect stack traces |
1015 // while the bootstrapper is active since the infrastructure may not have | 1015 // while the bootstrapper is active since the infrastructure may not have |
1016 // been properly initialized. | 1016 // been properly initialized. |
1017 ReportBootstrappingException(exception_handle, location); | 1017 ReportBootstrappingException(exception_handle, location); |
1018 } else { | 1018 } else { |
1019 Handle<Object> message_obj = CreateMessage(exception_handle, location); | 1019 Handle<Object> message_obj = CreateMessage(exception_handle, location); |
1020 thread_local_top()->pending_message_obj_ = *message_obj; | 1020 thread_local_top()->pending_message_obj_ = *message_obj; |
1021 | 1021 |
1022 bool exception_is_uncaught = ( | |
1023 PredictExceptionCatcher() != CAUGHT_BY_JAVASCRIPT); | |
Michael Starzinger
2015/10/29 13:42:55
Notes about PredictExceptionCatcher:
1) Calling t
Michael Hablich
2015/10/29 15:23:34
I moved the whole counting into the factory which
| |
1024 | |
1025 if (exception_is_uncaught) context()->IncrementExceptionsThrown(); | |
jochen (gone - plz use gerrit)
2015/10/29 14:37:07
use native_context()
Michael Hablich
2015/10/29 15:23:34
Done.
| |
1026 | |
1022 // For any exception not caught by JavaScript, even when an external | 1027 // For any exception not caught by JavaScript, even when an external |
1023 // handler is present: | 1028 // handler is present: |
1024 // If the abort-on-uncaught-exception flag is specified, and if the | 1029 // If the abort-on-uncaught-exception flag is specified, and if the |
1025 // embedder didn't specify a custom uncaught exception callback, | 1030 // embedder didn't specify a custom uncaught exception callback, |
1026 // or if the custom callback determined that V8 should abort, then | 1031 // or if the custom callback determined that V8 should abort, then |
1027 // abort. | 1032 // abort. |
1028 if (FLAG_abort_on_uncaught_exception && | 1033 if (FLAG_abort_on_uncaught_exception && |
1029 PredictExceptionCatcher() != CAUGHT_BY_JAVASCRIPT && | 1034 exception_is_uncaught && |
1030 (!abort_on_uncaught_exception_callback_ || | 1035 (!abort_on_uncaught_exception_callback_ || |
1031 abort_on_uncaught_exception_callback_( | 1036 abort_on_uncaught_exception_callback_( |
1032 reinterpret_cast<v8::Isolate*>(this)))) { | 1037 reinterpret_cast<v8::Isolate*>(this)))) { |
1033 // Prevent endless recursion. | 1038 // Prevent endless recursion. |
1034 FLAG_abort_on_uncaught_exception = false; | 1039 FLAG_abort_on_uncaught_exception = false; |
1035 // This flag is intended for use by JavaScript developers, so | 1040 // This flag is intended for use by JavaScript developers, so |
1036 // print a user-friendly stack trace (not an internal one). | 1041 // print a user-friendly stack trace (not an internal one). |
1037 PrintF(stderr, "%s\n\nFROM\n", | 1042 PrintF(stderr, "%s\n\nFROM\n", |
1038 MessageHandler::GetLocalizedMessage(this, message_obj).get()); | 1043 MessageHandler::GetLocalizedMessage(this, message_obj).get()); |
1039 PrintCurrentStackTrace(stderr); | 1044 PrintCurrentStackTrace(stderr); |
(...skipping 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2848 // First check whether the previous scope intercepts. | 2853 // First check whether the previous scope intercepts. |
2849 if (prev_ && prev_->Intercept(flag)) return true; | 2854 if (prev_ && prev_->Intercept(flag)) return true; |
2850 // Then check whether this scope intercepts. | 2855 // Then check whether this scope intercepts. |
2851 if ((flag & intercept_mask_)) { | 2856 if ((flag & intercept_mask_)) { |
2852 intercepted_flags_ |= flag; | 2857 intercepted_flags_ |= flag; |
2853 return true; | 2858 return true; |
2854 } | 2859 } |
2855 return false; | 2860 return false; |
2856 } | 2861 } |
2857 | 2862 |
2863 | |
2858 } // namespace internal | 2864 } // namespace internal |
2859 } // namespace v8 | 2865 } // namespace v8 |
OLD | NEW |