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

Side by Side Diff: src/isolate.cc

Issue 296133013: Revert "Make v8::TryCatch able to consume natively thrown exceptions (again)." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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/isolate.h ('k') | test/cctest/test-api.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 // 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 "v8.h" 7 #include "v8.h"
8 8
9 #include "ast.h" 9 #include "ast.h"
10 #include "bootstrapper.h" 10 #include "bootstrapper.h"
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 Object* script = reinterpret_cast<Object*>(handler->message_script_); 901 Object* script = reinterpret_cast<Object*>(handler->message_script_);
902 ASSERT(message->IsJSMessageObject() || message->IsTheHole()); 902 ASSERT(message->IsJSMessageObject() || message->IsTheHole());
903 ASSERT(script->IsScript() || script->IsTheHole()); 903 ASSERT(script->IsScript() || script->IsTheHole());
904 thread_local_top()->pending_message_obj_ = message; 904 thread_local_top()->pending_message_obj_ = message;
905 thread_local_top()->pending_message_script_ = script; 905 thread_local_top()->pending_message_script_ = script;
906 thread_local_top()->pending_message_start_pos_ = handler->message_start_pos_; 906 thread_local_top()->pending_message_start_pos_ = handler->message_start_pos_;
907 thread_local_top()->pending_message_end_pos_ = handler->message_end_pos_; 907 thread_local_top()->pending_message_end_pos_ = handler->message_end_pos_;
908 } 908 }
909 909
910 910
911 void Isolate::CancelScheduledExceptionFromTryCatch(v8::TryCatch* handler) {
912 ASSERT(has_scheduled_exception());
913 if (scheduled_exception() == handler->exception_) {
914 ASSERT(scheduled_exception() != heap()->termination_exception());
915 clear_scheduled_exception();
916 }
917 }
918
919
920 Object* Isolate::PromoteScheduledException() { 911 Object* Isolate::PromoteScheduledException() {
921 Object* thrown = scheduled_exception(); 912 Object* thrown = scheduled_exception();
922 clear_scheduled_exception(); 913 clear_scheduled_exception();
923 // Re-throw the exception to avoid getting repeated error reporting. 914 // Re-throw the exception to avoid getting repeated error reporting.
924 return ReThrow(thrown); 915 return ReThrow(thrown);
925 } 916 }
926 917
927 918
928 void Isolate::PrintCurrentStackTrace(FILE* out) { 919 void Isolate::PrintCurrentStackTrace(FILE* out) {
929 StackTraceFrameIterator it(this); 920 StackTraceFrameIterator it(this);
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 1206
1216 return true; 1207 return true;
1217 } 1208 }
1218 1209
1219 1210
1220 void Isolate::ReportPendingMessages() { 1211 void Isolate::ReportPendingMessages() {
1221 ASSERT(has_pending_exception()); 1212 ASSERT(has_pending_exception());
1222 PropagatePendingExceptionToExternalTryCatch(); 1213 PropagatePendingExceptionToExternalTryCatch();
1223 1214
1224 HandleScope scope(this); 1215 HandleScope scope(this);
1225 if (thread_local_top_.pending_exception_ == heap()->termination_exception()) { 1216 if (thread_local_top_.pending_exception_ ==
1217 heap()->termination_exception()) {
1226 // Do nothing: if needed, the exception has been already propagated to 1218 // Do nothing: if needed, the exception has been already propagated to
1227 // v8::TryCatch. 1219 // v8::TryCatch.
1228 } else { 1220 } else {
1229 if (thread_local_top_.has_pending_message_) { 1221 if (thread_local_top_.has_pending_message_) {
1230 thread_local_top_.has_pending_message_ = false; 1222 thread_local_top_.has_pending_message_ = false;
1231 if (!thread_local_top_.pending_message_obj_->IsTheHole()) { 1223 if (!thread_local_top_.pending_message_obj_->IsTheHole()) {
1232 HandleScope scope(this); 1224 HandleScope scope(this);
1233 Handle<Object> message_obj(thread_local_top_.pending_message_obj_, 1225 Handle<Object> message_obj(thread_local_top_.pending_message_obj_,
1234 this); 1226 this);
1235 if (!thread_local_top_.pending_message_script_->IsTheHole()) { 1227 if (!thread_local_top_.pending_message_script_->IsTheHole()) {
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 1744
1753 1745
1754 void Isolate::PropagatePendingExceptionToExternalTryCatch() { 1746 void Isolate::PropagatePendingExceptionToExternalTryCatch() {
1755 ASSERT(has_pending_exception()); 1747 ASSERT(has_pending_exception());
1756 1748
1757 bool external_caught = IsExternallyCaught(); 1749 bool external_caught = IsExternallyCaught();
1758 thread_local_top_.external_caught_exception_ = external_caught; 1750 thread_local_top_.external_caught_exception_ = external_caught;
1759 1751
1760 if (!external_caught) return; 1752 if (!external_caught) return;
1761 1753
1762 if (thread_local_top_.pending_exception_ == heap()->termination_exception()) { 1754 if (thread_local_top_.pending_exception_ ==
1755 heap()->termination_exception()) {
1763 try_catch_handler()->can_continue_ = false; 1756 try_catch_handler()->can_continue_ = false;
1764 try_catch_handler()->has_terminated_ = true; 1757 try_catch_handler()->has_terminated_ = true;
1765 try_catch_handler()->exception_ = heap()->null_value(); 1758 try_catch_handler()->exception_ = heap()->null_value();
1766 } else { 1759 } else {
1767 v8::TryCatch* handler = try_catch_handler(); 1760 v8::TryCatch* handler = try_catch_handler();
1768 ASSERT(thread_local_top_.pending_message_obj_->IsJSMessageObject() || 1761 ASSERT(thread_local_top_.pending_message_obj_->IsJSMessageObject() ||
1769 thread_local_top_.pending_message_obj_->IsTheHole()); 1762 thread_local_top_.pending_message_obj_->IsTheHole());
1770 ASSERT(thread_local_top_.pending_message_script_->IsScript() || 1763 ASSERT(thread_local_top_.pending_message_script_->IsScript() ||
1771 thread_local_top_.pending_message_script_->IsTheHole()); 1764 thread_local_top_.pending_message_script_->IsTheHole());
1772 handler->can_continue_ = true; 1765 handler->can_continue_ = true;
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
2313 Execution::Call(this, microtask, factory()->undefined_value(), 2306 Execution::Call(this, microtask, factory()->undefined_value(),
2314 0, NULL).Check(); 2307 0, NULL).Check();
2315 } 2308 }
2316 } 2309 }
2317 2310
2318 handle_scope_implementer()->DecrementCallDepth(); 2311 handle_scope_implementer()->DecrementCallDepth();
2319 } 2312 }
2320 2313
2321 2314
2322 } } // namespace v8::internal 2315 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698