Hi Guys,

Sometimes It can not  resume execution from TerminateExecution.
In most time, It can resume execution after TerminateExecution as the 
TerminateCancelTerminateFromThreadItself case do.

// Test that a single thread of JavaScript execution can terminate
// itself and then resume execution.
TEST(TerminateCancelTerminateFromThreadItself2) {
  v8::Isolate* isolate = CcTest::isolate();
  v8::HandleScope scope(isolate);

  *// TerminateExecution here*
  CcTest::isolate()->TerminateExecution();
  v8::Local<v8::ObjectTemplate> global = CreateGlobalTemplate(
      isolate, TerminateCurrentThread, DoLoopCancelTerminate);
  v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global);
  v8::Context::Scope context_scope(context);
  CHECK(!CcTest::isolate()->IsExecutionTerminating());
  // Check that execution completed with correct return value.
  v8::Local<v8::Value> result =
      CompileRun(isolate->GetCurrentContext(),
                 "try { doloop(); } catch(e) { fail(); } 'completed';")
          .ToLocalChecked();
  CHECK(result->Equals(isolate->GetCurrentContext(), v8_str("completed"))
            .FromJust());
}

If I call TerminateExecution before create a new context.  it cannot resume 
unless call CancelTerminateExecution.  It will failed to create context 
with "Error installing extension 'v8/gc'"

// Test that a single thread of JavaScript execution can terminate
// itself and then resume execution.
TEST(TerminateCancelTerminateFromThreadItself2) {
  v8::Isolate* isolate = CcTest::isolate();
  v8::HandleScope scope(isolate);


  v8::Local<v8::ObjectTemplate> global = CreateGlobalTemplate(
      isolate, TerminateCurrentThread, DoLoopCancelTerminate);
  v8::Local<v8::Context> context = v8::Context::New(isolate, NULL, global);
  CHECK(!context.IsEmpty());
  v8::Context::Scope context_scope(context);
  CHECK(!CcTest::isolate()->IsExecutionTerminating());
  // Check that execution completed with correct return value.
  v8::Local<v8::Value> result =
      CompileRun(isolate->GetCurrentContext(),
                 "try { doloop(); } catch(e) { fail(); } 'completed';")
          .ToLocalChecked();
  CHECK(result->Equals(isolate->GetCurrentContext(), v8_str("completed"))
            .FromJust());
   // TerminateExecution here
  CcTest::isolate()->TerminateExecution();
    
  v8::Local<v8::Context> context2 = v8::Context::New(isolate, NULL, global);
  result =
      CompileRun(context2,
                 "try { doloop(); } catch(e) { fail(); } 'completed';")
          .ToLocalChecked();
  CHECK(result->Equals(context2, v8_str("completed"))
            .FromJust());
            
}

The above code wil also have the same error unless I call 
CancelTerminateExecution 
after TerminateExecution.

So it won't resume execution if there is no javascript code. Is that right?
Is there any flag to know whether i need to call CancelTerminateExecution?

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to