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

Side by Side Diff: src/isolate.cc

Issue 587703002: Preserve message when rethrowing exception (Closed) Base URL: https://chromium.googlesource.com/external/v8.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | 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 // 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 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 HandleScope scope(this); 1016 HandleScope scope(this);
1017 Handle<Object> exception_handle(exception, this); 1017 Handle<Object> exception_handle(exception, this);
1018 1018
1019 // Determine reporting and whether the exception is caught externally. 1019 // Determine reporting and whether the exception is caught externally.
1020 bool catchable_by_javascript = is_catchable_by_javascript(exception); 1020 bool catchable_by_javascript = is_catchable_by_javascript(exception);
1021 bool can_be_caught_externally = false; 1021 bool can_be_caught_externally = false;
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_;
1028 bool bootstrapping = bootstrapper()->IsActive(); 1027 bool bootstrapping = bootstrapper()->IsActive();
1028 bool rethrowing_message = thread_local_top()->rethrowing_message_;
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.
1033 if (catchable_by_javascript) { 1033 if (catchable_by_javascript) {
1034 debug()->OnThrow(exception_handle, report_exception); 1034 debug()->OnThrow(exception_handle, report_exception);
1035 } 1035 }
1036 1036
1037 // Generate the message if required. 1037 // Generate the message if required.
1038 if (report_exception || try_catch_needs_message) { 1038 if (!rethrowing_message && (report_exception || try_catch_needs_message)) {
1039 MessageLocation potential_computed_location; 1039 MessageLocation potential_computed_location;
1040 if (location == NULL) { 1040 if (location == NULL) {
1041 // If no location was specified we use a computed one instead. 1041 // If no location was specified we use a computed one instead.
1042 ComputeLocation(&potential_computed_location); 1042 ComputeLocation(&potential_computed_location);
1043 location = &potential_computed_location; 1043 location = &potential_computed_location;
1044 } 1044 }
1045 // It's not safe to try to make message objects or collect stack traces 1045 // It's not safe to try to make message objects or collect stack traces
1046 // while the bootstrapper is active since the infrastructure may not have 1046 // while the bootstrapper is active since the infrastructure may not have
1047 // been properly initialized. 1047 // been properly initialized.
1048 if (!bootstrapping) { 1048 if (!bootstrapping) {
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 if (prev_ && prev_->Intercept(flag)) return true; 2381 if (prev_ && prev_->Intercept(flag)) return true;
2382 // Then check whether this scope intercepts. 2382 // Then check whether this scope intercepts.
2383 if ((flag & intercept_mask_)) { 2383 if ((flag & intercept_mask_)) {
2384 intercepted_flags_ |= flag; 2384 intercepted_flags_ |= flag;
2385 return true; 2385 return true;
2386 } 2386 }
2387 return false; 2387 return false;
2388 } 2388 }
2389 2389
2390 } } // namespace v8::internal 2390 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698