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

Side by Side Diff: src/isolate.cc

Issue 11142013: Add methods to allow resuming execution after calling TerminateExecution(). (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 9 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
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 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 return Failure::Exception(); 1049 return Failure::Exception();
1050 } 1050 }
1051 1051
1052 1052
1053 Failure* Isolate::TerminateExecution() { 1053 Failure* Isolate::TerminateExecution() {
1054 DoThrow(heap_.termination_exception(), NULL); 1054 DoThrow(heap_.termination_exception(), NULL);
1055 return Failure::Exception(); 1055 return Failure::Exception();
1056 } 1056 }
1057 1057
1058 1058
1059 void Isolate::CancelTerminateExecution() {
1060 if (try_catch_handler()) {
1061 try_catch_handler()->has_terminated_ = false;
1062 }
1063 if (has_pending_exception() &&
1064 pending_exception() == heap_.termination_exception()) {
1065 thread_local_top()->external_caught_exception_ = false;
1066 clear_pending_exception();
1067 }
1068 if (has_scheduled_exception() &&
1069 scheduled_exception() == heap_.termination_exception()) {
1070 thread_local_top()->external_caught_exception_ = false;
1071 clear_scheduled_exception();
1072 }
1073 }
1074
1075
1059 Failure* Isolate::Throw(Object* exception, MessageLocation* location) { 1076 Failure* Isolate::Throw(Object* exception, MessageLocation* location) {
1060 DoThrow(exception, location); 1077 DoThrow(exception, location);
1061 return Failure::Exception(); 1078 return Failure::Exception();
1062 } 1079 }
1063 1080
1064 1081
1065 Failure* Isolate::ReThrow(MaybeObject* exception) { 1082 Failure* Isolate::ReThrow(MaybeObject* exception) {
1066 bool can_be_caught_externally = false; 1083 bool can_be_caught_externally = false;
1067 bool catchable_by_javascript = is_catchable_by_javascript(exception); 1084 bool catchable_by_javascript = is_catchable_by_javascript(exception);
1068 ShouldReportException(&can_be_caught_externally, catchable_by_javascript); 1085 ShouldReportException(&can_be_caught_externally, catchable_by_javascript);
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
1948 bool external_caught = IsExternallyCaught(); 1965 bool external_caught = IsExternallyCaught();
1949 thread_local_top_.external_caught_exception_ = external_caught; 1966 thread_local_top_.external_caught_exception_ = external_caught;
1950 1967
1951 if (!external_caught) return; 1968 if (!external_caught) return;
1952 1969
1953 if (thread_local_top_.pending_exception_->IsOutOfMemory()) { 1970 if (thread_local_top_.pending_exception_->IsOutOfMemory()) {
1954 // Do not propagate OOM exception: we should kill VM asap. 1971 // Do not propagate OOM exception: we should kill VM asap.
1955 } else if (thread_local_top_.pending_exception_ == 1972 } else if (thread_local_top_.pending_exception_ ==
1956 heap()->termination_exception()) { 1973 heap()->termination_exception()) {
1957 try_catch_handler()->can_continue_ = false; 1974 try_catch_handler()->can_continue_ = false;
1975 try_catch_handler()->has_terminated_ = true;
1958 try_catch_handler()->exception_ = heap()->null_value(); 1976 try_catch_handler()->exception_ = heap()->null_value();
1959 } else { 1977 } else {
1960 // At this point all non-object (failure) exceptions have 1978 // At this point all non-object (failure) exceptions have
1961 // been dealt with so this shouldn't fail. 1979 // been dealt with so this shouldn't fail.
1962 ASSERT(!pending_exception()->IsFailure()); 1980 ASSERT(!pending_exception()->IsFailure());
1963 try_catch_handler()->can_continue_ = true; 1981 try_catch_handler()->can_continue_ = true;
1982 try_catch_handler()->has_terminated_ = false;
1964 try_catch_handler()->exception_ = pending_exception(); 1983 try_catch_handler()->exception_ = pending_exception();
1965 if (!thread_local_top_.pending_message_obj_->IsTheHole()) { 1984 if (!thread_local_top_.pending_message_obj_->IsTheHole()) {
1966 try_catch_handler()->message_ = thread_local_top_.pending_message_obj_; 1985 try_catch_handler()->message_ = thread_local_top_.pending_message_obj_;
1967 } 1986 }
1968 } 1987 }
1969 } 1988 }
1970 1989
1971 1990
1972 void Isolate::InitializeLoggingAndCounters() { 1991 void Isolate::InitializeLoggingAndCounters() {
1973 if (logger_ == NULL) { 1992 if (logger_ == NULL) {
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
2365 2384
2366 #ifdef DEBUG 2385 #ifdef DEBUG
2367 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ 2386 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \
2368 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); 2387 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_);
2369 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) 2388 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET)
2370 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) 2389 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET)
2371 #undef ISOLATE_FIELD_OFFSET 2390 #undef ISOLATE_FIELD_OFFSET
2372 #endif 2391 #endif
2373 2392
2374 } } // namespace v8::internal 2393 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698