Reviewers: Yang OOO until mid October,
Description:
Version 4.6.85.14 (cherry-pick)
Merged 70dc24c22ff61b4b4d5a9f43597bdbb067b35304
Postpone interrupts while dipatching debugger events to listeners
BUG=chromium:520702
LOG=N
[email protected]
Please review this at https://codereview.chromium.org/1324153005/
Base URL: https://chromium.googlesource.com/v8/[email protected]
Affected files (+31, -2 lines):
M include/v8-version.h
M src/debug/debug.cc
M test/cctest/test-debug.cc
Index: include/v8-version.h
diff --git a/include/v8-version.h b/include/v8-version.h
index
621866a5360e1a869c68b05747efa389e961ebd3..6f0a81a6238389aa8cf01f8b97d6b35eaa802b66
100644
--- a/include/v8-version.h
+++ b/include/v8-version.h
@@ -11,7 +11,7 @@
#define V8_MAJOR_VERSION 4
#define V8_MINOR_VERSION 6
#define V8_BUILD_NUMBER 85
-#define V8_PATCH_LEVEL 13
+#define V8_PATCH_LEVEL 14
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
Index: src/debug/debug.cc
diff --git a/src/debug/debug.cc b/src/debug/debug.cc
index
e789def917e371c1a43c540cfb92c1daa5553b70..3ab10132a8f17e2665aea181d9805da232ae8d4d
100644
--- a/src/debug/debug.cc
+++ b/src/debug/debug.cc
@@ -1875,6 +1875,7 @@ void Debug::OnException(Handle<Object> exception,
Handle<Object> promise) {
void Debug::OnCompileError(Handle<Script> script) {
if (ignore_events()) return;
+ SuppressDebug while_processing(this);
if (in_debug_scope()) {
ProcessCompileEventInDebugScope(v8::CompileError, script);
@@ -1917,6 +1918,7 @@ void Debug::OnDebugBreak(Handle<Object>
break_points_hit,
void Debug::OnBeforeCompile(Handle<Script> script) {
if (in_debug_scope() || ignore_events()) return;
+ SuppressDebug while_processing(this);
HandleScope scope(isolate_);
DebugScope debug_scope(this);
@@ -1941,6 +1943,7 @@ void Debug::OnAfterCompile(Handle<Script> script) {
if (script_cache_ != NULL) script_cache_->Add(script);
if (ignore_events()) return;
+ SuppressDebug while_processing(this);
if (in_debug_scope()) {
ProcessCompileEventInDebugScope(v8::AfterCompile, script);
@@ -2037,6 +2040,9 @@ void Debug::CallEventCallback(v8::DebugEvent event,
Handle<Object> exec_state,
Handle<Object> event_data,
v8::Debug::ClientData* client_data) {
+ // Prevent other interrupts from triggering, for example API callbacks,
+ // while dispatching event listners.
+ PostponeInterruptsScope postpone(isolate_);
bool previous = in_debug_event_listener_;
in_debug_event_listener_ = true;
if (event_listener_->IsForeign()) {
@@ -2070,7 +2076,6 @@ void
Debug::ProcessCompileEventInDebugScope(v8::DebugEvent event,
Handle<Script> script) {
if (event_listener_.is_null()) return;
- SuppressDebug while_processing(this);
DebugScope debug_scope(this);
if (debug_scope.failed()) return;
Index: test/cctest/test-debug.cc
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index
c6a889664f79451c73687fb49dfe5ebd5ed7d33f..8f569ae6feb662b64e6f60e4543d7d3e98cd6442
100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -7624,3 +7624,27 @@ TEST(DebugBreakInLexicalScopes) {
"x * y",
30);
}
+
+static int after_compile_handler_depth = 0;
+static void HandleInterrupt(v8::Isolate* isolate, void* data) {
+ CHECK_EQ(0, after_compile_handler_depth);
+}
+
+static void NoInterruptsOnDebugEvent(
+ const v8::Debug::EventDetails& event_details) {
+ if (event_details.GetEvent() != v8::AfterCompile) return;
+ ++after_compile_handler_depth;
+ // Do not allow nested AfterCompile events.
+ CHECK(after_compile_handler_depth <= 1);
+ v8::Isolate* isolate = event_details.GetEventContext()->GetIsolate();
+ isolate->RequestInterrupt(&HandleInterrupt, nullptr);
+ CompileRun("function foo() {}; foo();");
+ --after_compile_handler_depth;
+}
+
+
+TEST(NoInterruptsInDebugListener) {
+ DebugLocalContext env;
+ v8::Debug::SetDebugEventListener(NoInterruptsOnDebugEvent);
+ CompileRun("void(0);");
+}
--
--
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.