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 <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/ast.h" | 9 #include "src/ast.h" |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1022 bool should_report_exception = | 1022 bool should_report_exception = |
1023 ShouldReportException(&can_be_caught_externally, catchable_by_javascript); | 1023 ShouldReportException(&can_be_caught_externally, catchable_by_javascript); |
1024 bool report_exception = catchable_by_javascript && should_report_exception; | 1024 bool report_exception = catchable_by_javascript && should_report_exception; |
1025 bool try_catch_needs_message = | 1025 bool try_catch_needs_message = |
1026 can_be_caught_externally && try_catch_handler()->capture_message_ && | 1026 can_be_caught_externally && try_catch_handler()->capture_message_ && |
1027 !thread_local_top()->rethrowing_message_; | 1027 !thread_local_top()->rethrowing_message_; |
1028 bool bootstrapping = bootstrapper()->IsActive(); | 1028 bool bootstrapping = bootstrapper()->IsActive(); |
1029 | 1029 |
1030 thread_local_top()->rethrowing_message_ = false; | 1030 thread_local_top()->rethrowing_message_ = false; |
1031 | 1031 |
1032 // Notify debugger of exception. | 1032 // Notify debugger of exception. Temporarily clear any scheduled_exception |
1033 // to allow evaluating JavaScript from the debug event handler. | |
1033 if (catchable_by_javascript) { | 1034 if (catchable_by_javascript) { |
1035 Object* saved_scheduled_exception = scheduled_exception(); | |
1036 clear_scheduled_exception(); | |
Yang
2014/09/10 14:46:13
Can we put this into OnThrow?
aandrey
2014/09/11 05:48:29
Done.
| |
1034 debug()->OnThrow(exception_handle, report_exception); | 1037 debug()->OnThrow(exception_handle, report_exception); |
1038 thread_local_top()->scheduled_exception_ = saved_scheduled_exception; | |
1035 } | 1039 } |
1036 | 1040 |
1037 // Generate the message if required. | 1041 // Generate the message if required. |
1038 if (report_exception || try_catch_needs_message) { | 1042 if (report_exception || try_catch_needs_message) { |
1039 MessageLocation potential_computed_location; | 1043 MessageLocation potential_computed_location; |
1040 if (location == NULL) { | 1044 if (location == NULL) { |
1041 // If no location was specified we use a computed one instead. | 1045 // If no location was specified we use a computed one instead. |
1042 ComputeLocation(&potential_computed_location); | 1046 ComputeLocation(&potential_computed_location); |
1043 location = &potential_computed_location; | 1047 location = &potential_computed_location; |
1044 } | 1048 } |
(...skipping 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2381 if (prev_ && prev_->Intercept(flag)) return true; | 2385 if (prev_ && prev_->Intercept(flag)) return true; |
2382 // Then check whether this scope intercepts. | 2386 // Then check whether this scope intercepts. |
2383 if ((flag & intercept_mask_)) { | 2387 if ((flag & intercept_mask_)) { |
2384 intercepted_flags_ |= flag; | 2388 intercepted_flags_ |= flag; |
2385 return true; | 2389 return true; |
2386 } | 2390 } |
2387 return false; | 2391 return false; |
2388 } | 2392 } |
2389 | 2393 |
2390 } } // namespace v8::internal | 2394 } } // namespace v8::internal |
OLD | NEW |