Reland "Postpone termination exceptions in debug scope."

BUG=v8:3408
LOG=Y
R=yurys@chromium.org

Review URL: https://codereview.chromium.org/364813002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22262 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
yangguo@chromium.org 2014-07-08 06:57:17 +00:00
parent d837dd7eb4
commit 72441a1123
3 changed files with 9 additions and 6 deletions

View File

@ -3104,9 +3104,12 @@ void Debug::ProcessDebugMessages(bool debug_command_only) {
}
DebugScope::DebugScope(Debug* debug) : debug_(debug),
prev_(debug->debugger_entry()),
save_(debug_->isolate_) {
DebugScope::DebugScope(Debug* debug)
: debug_(debug),
prev_(debug->debugger_entry()),
save_(debug_->isolate_),
no_termination_exceptons_(debug_->isolate_,
StackGuard::TERMINATE_EXECUTION) {
// Link recursive debugger entry.
debug_->thread_local_.current_debug_scope_ = this;

View File

@ -705,6 +705,7 @@ class DebugScope BASE_EMBEDDED {
int break_id_; // Previous break id.
bool failed_; // Did the debug context fail to load?
SaveContext save_; // Saves previous context.
PostponeInterruptsScope no_termination_exceptons_;
};

View File

@ -7374,9 +7374,6 @@ static void DebugBreakTriggerTerminate(
// Wait for at most 2 seconds for the terminate request.
CHECK(terminate_fired_semaphore.WaitFor(v8::base::TimeDelta::FromSeconds(2)));
terminate_already_fired = true;
v8::internal::Isolate* isolate =
v8::Utils::OpenHandle(*event_details.GetEventContext())->GetIsolate();
CHECK(isolate->stack_guard()->CheckTerminateExecution());
}
@ -7403,6 +7400,8 @@ TEST(DebugBreakOffThreadTerminate) {
v8::Debug::SetDebugEventListener(DebugBreakTriggerTerminate);
TerminationThread terminator(isolate);
terminator.Start();
v8::TryCatch try_catch;
v8::Debug::DebugBreak(isolate);
CompileRun("while (true);");
CHECK(try_catch.HasTerminated());
}