Revision: 13219
Author: [email protected]
Date: Thu Dec 13 09:21:15 2012
Log: Revert r13218 due to windows test failures.
[email protected]
BUG=
Review URL: https://chromiumcodereview.appspot.com/11568014
http://code.google.com/p/v8/source/detail?r=13219
Modified:
/branches/bleeding_edge/AUTHORS
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/execution.cc
/branches/bleeding_edge/src/execution.h
/branches/bleeding_edge/src/isolate.cc
/branches/bleeding_edge/src/isolate.h
/branches/bleeding_edge/test/cctest/test-thread-termination.cc
=======================================
--- /branches/bleeding_edge/AUTHORS Thu Dec 13 08:38:49 2012
+++ /branches/bleeding_edge/AUTHORS Thu Dec 13 09:21:15 2012
@@ -9,7 +9,6 @@
Hewlett-Packard Development Company, LP
Igalia, S.L.
Joyent, Inc.
-Bloomberg Finance L.P.
Akinori MUSHA <[email protected]>
Alexander Botero-Lowry <[email protected]>
=======================================
--- /branches/bleeding_edge/include/v8.h Thu Dec 13 08:38:49 2012
+++ /branches/bleeding_edge/include/v8.h Thu Dec 13 09:21:15 2012
@@ -3478,24 +3478,6 @@
*/
static bool IsExecutionTerminating(Isolate* isolate = NULL);
- /**
- * Resume execution capability in the given isolate, whose execution
- * was previously forcefully terminated using TerminateExecution().
- *
- * When execution is forcefully terminated using TerminateExecution(),
- * the isolate can not resume execution until all JavaScript frames
- * have propagated the uncatchable exception which is generated. This
- * method allows the program embedding the engine to handle the
- * termination event and resume execution capability, even if
- * JavaScript frames remain on the stack.
- *
- * This method can be used by any thread even if that thread has not
- * acquired the V8 lock with a Locker object.
- *
- * \param isolate The isolate in which to resume execution capability.
- */
- static void ResumeExecution(Isolate* isolate);
-
/**
* Releases any resources used by v8 and stops any utility threads
* that may be running. Note that disposing v8 is permanent, it
@@ -3618,27 +3600,17 @@
* For certain types of exceptions, it makes no sense to continue
* execution.
*
+ * Currently, the only type of exception that can be caught by a
+ * TryCatch handler and for which it does not make sense to continue
+ * is termination exception. Such exceptions are thrown when the
+ * TerminateExecution methods are called to terminate a long-running
+ * script.
+ *
* If CanContinue returns false, the correct action is to perform
- * any C++ cleanup needed and then return. If CanContinue returns
- * false and HasTerminated returns true, it is possible to call
- * ResumeExecution in order to continue calling into the engine.
+ * any C++ cleanup needed and then return.
*/
bool CanContinue() const;
- /**
- * Returns true if an exception has been caught due to script execution
- * being terminated.
- *
- * There is no JavaScript representation of an execution termination
- * exception. Such exceptions are thrown when the TerminateExecution
- * methods are called to terminate a long-running script.
- *
- * If such an exception has been thrown, HasTerminated will return
- * true, indicating that it is possible to call ResumeExecution in
- * order to continue calling into the engine.
- */
- bool HasTerminated() const;
-
/**
* Throws the exception caught by this TryCatch in a way that avoids
* it being caught again by this same TryCatch. As with ThrowException
@@ -3714,7 +3686,6 @@
bool can_continue_ : 1;
bool capture_message_ : 1;
bool rethrow_ : 1;
- bool has_terminated_ : 1;
friend class v8::internal::Isolate;
};
=======================================
--- /branches/bleeding_edge/src/api.cc Thu Dec 13 08:38:49 2012
+++ /branches/bleeding_edge/src/api.cc Thu Dec 13 09:21:15 2012
@@ -1788,8 +1788,7 @@
is_verbose_(false),
can_continue_(true),
capture_message_(true),
- rethrow_(false),
- has_terminated_(false) {
+ rethrow_(false) {
isolate_->RegisterTryCatchHandler(this);
}
@@ -1817,11 +1816,6 @@
}
-bool v8::TryCatch::HasTerminated() const {
- return has_terminated_;
-}
-
-
v8::Handle<v8::Value> v8::TryCatch::ReThrow() {
if (!HasCaught()) return v8::Local<v8::Value>();
rethrow_ = true;
@@ -5587,11 +5581,6 @@
reinterpret_cast<i::Isolate*>(isolate) : i::Isolate::Current();
return IsExecutionTerminatingCheck(i_isolate);
}
-
-
-void V8::ResumeExecution(Isolate* isolate) {
- reinterpret_cast<i::Isolate*>(isolate)->stack_guard()->ResumeExecution();
-}
Isolate* Isolate::GetCurrent() {
=======================================
--- /branches/bleeding_edge/src/execution.cc Thu Dec 13 08:38:49 2012
+++ /branches/bleeding_edge/src/execution.cc Thu Dec 13 09:21:15 2012
@@ -421,14 +421,6 @@
ExecutionAccess access(isolate_);
return (thread_local_.interrupt_flags_ & TERMINATE) != 0;
}
-
-
-void StackGuard::ResumeExecution() {
- ASSERT(thread_local_.interrupt_flags_ & TERMINATE);
- ExecutionAccess access(isolate_);
- Continue(TERMINATE);
- isolate_->ResumeExecution();
-}
void StackGuard::TerminateExecution() {
=======================================
--- /branches/bleeding_edge/src/execution.h Thu Dec 13 08:38:49 2012
+++ /branches/bleeding_edge/src/execution.h Thu Dec 13 09:21:15 2012
@@ -193,7 +193,6 @@
void Interrupt();
bool IsTerminateExecution();
void TerminateExecution();
- void ResumeExecution();
bool IsCodeReadyEvent();
void RequestCodeReadyEvent();
#ifdef ENABLE_DEBUGGER_SUPPORT
=======================================
--- /branches/bleeding_edge/src/isolate.cc Thu Dec 13 08:38:49 2012
+++ /branches/bleeding_edge/src/isolate.cc Thu Dec 13 09:21:15 2012
@@ -1026,19 +1026,6 @@
DoThrow(heap_.termination_exception(), NULL);
return Failure::Exception();
}
-
-
-void Isolate::ResumeExecution() {
- if (has_pending_exception() &&
- pending_exception() == heap_.termination_exception()) {
- thread_local_top()->external_caught_exception_ = false;
- clear_pending_exception();
- }
- if (has_scheduled_exception() &&
- scheduled_exception() == heap_.termination_exception()) {
- clear_scheduled_exception();
- }
-}
Failure* Isolate::Throw(Object* exception, MessageLocation* location) {
@@ -1896,14 +1883,12 @@
} else if (thread_local_top_.pending_exception_ ==
heap()->termination_exception()) {
try_catch_handler()->can_continue_ = false;
- try_catch_handler()->has_terminated_ = true;
try_catch_handler()->exception_ = heap()->null_value();
} else {
// At this point all non-object (failure) exceptions have
// been dealt with so this shouldn't fail.
ASSERT(!pending_exception()->IsFailure());
try_catch_handler()->can_continue_ = true;
- try_catch_handler()->has_terminated_ = false;
try_catch_handler()->exception_ = pending_exception();
if (!thread_local_top_.pending_message_obj_->IsTheHole()) {
try_catch_handler()->message_ =
thread_local_top_.pending_message_obj_;
=======================================
--- /branches/bleeding_edge/src/isolate.h Thu Dec 13 08:38:49 2012
+++ /branches/bleeding_edge/src/isolate.h Thu Dec 13 09:21:15 2012
@@ -765,7 +765,6 @@
// Out of resource exception helpers.
Failure* StackOverflow();
Failure* TerminateExecution();
- void ResumeExecution();
// Administration
void Iterate(ObjectVisitor* v);
=======================================
--- /branches/bleeding_edge/test/cctest/test-thread-termination.cc Thu Dec
13 08:38:49 2012
+++ /branches/bleeding_edge/test/cctest/test-thread-termination.cc Thu Dec
13 09:21:15 2012
@@ -373,41 +373,3 @@
context.Dispose();
}
-
-v8::Handle<v8::Value> DoLoopResume(const v8::Arguments& args) {
- v8::TryCatch try_catch;
- CHECK(!v8::V8::IsExecutionTerminating());
- v8::Script::Compile(v8::String::New("var term = true;"
- "while(true) {"
- " if (term) terminate();"
- " term = false;"
- "}"))->Run();
- CHECK(try_catch.HasCaught());
- CHECK(try_catch.Exception()->IsNull());
- CHECK(try_catch.Message().IsEmpty());
- CHECK(!try_catch.CanContinue());
- CHECK(v8::V8::IsExecutionTerminating());
- CHECK(try_catch.HasTerminated());
- v8::V8::ResumeExecution(v8::Isolate::GetCurrent());
- CHECK(!v8::V8::IsExecutionTerminating());
- return v8::Undefined();
-}
-
-// Test that a single thread of JavaScript execution can terminate+
-// itself and then resume execution.
-TEST(TerminateResumeFromThreadItself) {
- v8::HandleScope scope;
- v8::Handle<v8::ObjectTemplate> global =
- CreateGlobalTemplate(TerminateCurrentThread, DoLoopResume);
- v8::Persistent<v8::Context> context = v8::Context::New(NULL, global);
- v8::Context::Scope context_scope(context);
- CHECK(!v8::V8::IsExecutionTerminating());
- // Run a loop that will be infinite if thread termination does not work.
- v8::Handle<v8::String> source =
- v8::String::New("try { doloop(); } catch(e) { fail(); }");
- v8::Script::Compile(source)->Run();
- // Test that we can run the code again after thread termination.
- CHECK(!v8::V8::IsExecutionTerminating());
- v8::Script::Compile(source)->Run();
- context.Dispose();
-}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev