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

Side by Side Diff: src/isolate.cc

Issue 227163008: Change exception type to Object. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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') | src/liveedit.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 // 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 257
258 258
259 void Isolate::IterateThread(ThreadVisitor* v, char* t) { 259 void Isolate::IterateThread(ThreadVisitor* v, char* t) {
260 ThreadLocalTop* thread = reinterpret_cast<ThreadLocalTop*>(t); 260 ThreadLocalTop* thread = reinterpret_cast<ThreadLocalTop*>(t);
261 v->VisitThread(this, thread); 261 v->VisitThread(this, thread);
262 } 262 }
263 263
264 264
265 void Isolate::Iterate(ObjectVisitor* v, ThreadLocalTop* thread) { 265 void Isolate::Iterate(ObjectVisitor* v, ThreadLocalTop* thread) {
266 // Visit the roots from the top for a given thread. 266 // Visit the roots from the top for a given thread.
267 Object* pending; 267 v->VisitPointer(&thread->pending_exception_);
268 // The pending exception can sometimes be a failure. We can't show
269 // that to the GC, which only understands objects.
270 if (thread->pending_exception_->ToObject(&pending)) {
271 v->VisitPointer(&pending);
272 thread->pending_exception_ = pending; // In case GC updated it.
273 }
274 v->VisitPointer(&(thread->pending_message_obj_)); 268 v->VisitPointer(&(thread->pending_message_obj_));
275 v->VisitPointer(BitCast<Object**>(&(thread->pending_message_script_))); 269 v->VisitPointer(BitCast<Object**>(&(thread->pending_message_script_)));
276 v->VisitPointer(BitCast<Object**>(&(thread->context_))); 270 v->VisitPointer(BitCast<Object**>(&(thread->context_)));
277 Object* scheduled; 271 v->VisitPointer(&thread->scheduled_exception_);
278 if (thread->scheduled_exception_->ToObject(&scheduled)) {
279 v->VisitPointer(&scheduled);
280 thread->scheduled_exception_ = scheduled;
281 }
282 272
283 for (v8::TryCatch* block = thread->TryCatchHandler(); 273 for (v8::TryCatch* block = thread->TryCatchHandler();
284 block != NULL; 274 block != NULL;
285 block = TRY_CATCH_FROM_ADDRESS(block->next_)) { 275 block = TRY_CATCH_FROM_ADDRESS(block->next_)) {
286 v->VisitPointer(BitCast<Object**>(&(block->exception_))); 276 v->VisitPointer(BitCast<Object**>(&(block->exception_)));
287 v->VisitPointer(BitCast<Object**>(&(block->message_obj_))); 277 v->VisitPointer(BitCast<Object**>(&(block->message_obj_)));
288 v->VisitPointer(BitCast<Object**>(&(block->message_script_))); 278 v->VisitPointer(BitCast<Object**>(&(block->message_script_)));
289 } 279 }
290 280
291 // Iterate over pointers on native execution stack. 281 // Iterate over pointers on native execution stack.
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 } 895 }
906 } 896 }
907 897
908 898
909 Failure* Isolate::Throw(Object* exception, MessageLocation* location) { 899 Failure* Isolate::Throw(Object* exception, MessageLocation* location) {
910 DoThrow(exception, location); 900 DoThrow(exception, location);
911 return Failure::Exception(); 901 return Failure::Exception();
912 } 902 }
913 903
914 904
915 Failure* Isolate::ReThrow(MaybeObject* exception) { 905 Failure* Isolate::ReThrow(Object* exception) {
916 bool can_be_caught_externally = false; 906 bool can_be_caught_externally = false;
917 bool catchable_by_javascript = is_catchable_by_javascript(exception); 907 bool catchable_by_javascript = is_catchable_by_javascript(exception);
918 ShouldReportException(&can_be_caught_externally, catchable_by_javascript); 908 ShouldReportException(&can_be_caught_externally, catchable_by_javascript);
919 909
920 thread_local_top()->catcher_ = can_be_caught_externally ? 910 thread_local_top()->catcher_ = can_be_caught_externally ?
921 try_catch_handler() : NULL; 911 try_catch_handler() : NULL;
922 912
923 // Set the exception being re-thrown. 913 // Set the exception being re-thrown.
924 set_pending_exception(exception); 914 set_pending_exception(exception);
925 if (exception->IsFailure()) return exception->ToFailureUnchecked(); 915 if (exception->IsFailure()) return exception->ToFailureUnchecked();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
962 ASSERT(message->IsJSMessageObject() || message->IsTheHole()); 952 ASSERT(message->IsJSMessageObject() || message->IsTheHole());
963 ASSERT(script->IsScript() || script->IsTheHole()); 953 ASSERT(script->IsScript() || script->IsTheHole());
964 thread_local_top()->pending_message_obj_ = message; 954 thread_local_top()->pending_message_obj_ = message;
965 thread_local_top()->pending_message_script_ = script; 955 thread_local_top()->pending_message_script_ = script;
966 thread_local_top()->pending_message_start_pos_ = handler->message_start_pos_; 956 thread_local_top()->pending_message_start_pos_ = handler->message_start_pos_;
967 thread_local_top()->pending_message_end_pos_ = handler->message_end_pos_; 957 thread_local_top()->pending_message_end_pos_ = handler->message_end_pos_;
968 } 958 }
969 959
970 960
971 Failure* Isolate::PromoteScheduledException() { 961 Failure* Isolate::PromoteScheduledException() {
972 MaybeObject* thrown = scheduled_exception(); 962 Object* thrown = scheduled_exception();
973 clear_scheduled_exception(); 963 clear_scheduled_exception();
974 // Re-throw the exception to avoid getting repeated error reporting. 964 // Re-throw the exception to avoid getting repeated error reporting.
975 return ReThrow(thrown); 965 return ReThrow(thrown);
976 } 966 }
977 967
978 968
979 void Isolate::PrintCurrentStackTrace(FILE* out) { 969 void Isolate::PrintCurrentStackTrace(FILE* out) {
980 StackTraceFrameIterator it(this); 970 StackTraceFrameIterator it(this);
981 while (!it.done()) { 971 while (!it.done()) {
982 HandleScope scope(this); 972 HandleScope scope(this);
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after
1806 1796
1807 if (!external_caught) return; 1797 if (!external_caught) return;
1808 1798
1809 if (thread_local_top_.pending_exception_ == 1799 if (thread_local_top_.pending_exception_ ==
1810 heap()->termination_exception()) { 1800 heap()->termination_exception()) {
1811 try_catch_handler()->can_continue_ = false; 1801 try_catch_handler()->can_continue_ = false;
1812 try_catch_handler()->has_terminated_ = true; 1802 try_catch_handler()->has_terminated_ = true;
1813 try_catch_handler()->exception_ = heap()->null_value(); 1803 try_catch_handler()->exception_ = heap()->null_value();
1814 } else { 1804 } else {
1815 v8::TryCatch* handler = try_catch_handler(); 1805 v8::TryCatch* handler = try_catch_handler();
1816 // At this point all non-object (failure) exceptions have
1817 // been dealt with so this shouldn't fail.
1818 ASSERT(!pending_exception()->IsFailure());
1819 ASSERT(thread_local_top_.pending_message_obj_->IsJSMessageObject() || 1806 ASSERT(thread_local_top_.pending_message_obj_->IsJSMessageObject() ||
1820 thread_local_top_.pending_message_obj_->IsTheHole()); 1807 thread_local_top_.pending_message_obj_->IsTheHole());
1821 ASSERT(thread_local_top_.pending_message_script_->IsScript() || 1808 ASSERT(thread_local_top_.pending_message_script_->IsScript() ||
1822 thread_local_top_.pending_message_script_->IsTheHole()); 1809 thread_local_top_.pending_message_script_->IsTheHole());
1823 handler->can_continue_ = true; 1810 handler->can_continue_ = true;
1824 handler->has_terminated_ = false; 1811 handler->has_terminated_ = false;
1825 handler->exception_ = pending_exception(); 1812 handler->exception_ = pending_exception();
1826 // Propagate to the external try-catch only if we got an actual message. 1813 // Propagate to the external try-catch only if we got an actual message.
1827 if (thread_local_top_.pending_message_obj_->IsTheHole()) return; 1814 if (thread_local_top_.pending_message_obj_->IsTheHole()) return;
1828 1815
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
2297 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map); 2284 Handle<JSObject> obj = factory()->NewJSObjectFromMap(map);
2298 JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8); 2285 JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 8);
2299 JSObject::SetProperty(registry, name, obj, NONE, STRICT).Assert(); 2286 JSObject::SetProperty(registry, name, obj, NONE, STRICT).Assert();
2300 } 2287 }
2301 } 2288 }
2302 return Handle<JSObject>::cast(factory()->symbol_registry()); 2289 return Handle<JSObject>::cast(factory()->symbol_registry());
2303 } 2290 }
2304 2291
2305 2292
2306 } } // namespace v8::internal 2293 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | src/liveedit.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698