Reviewers: Søren Gjesse,

Message:
Hi Soren

I need to send AfterCompile event when patching a script. However, the new code works from inside the Debugger, so I need to change notification logic a bit.

Peter

Description:
Send AfterCompile event from in debugger

Please review this at http://codereview.chromium.org/650126

Affected files:
  M src/compiler.cc
  M src/debug.h
  M src/debug.cc


Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 557a91e4db434d2af30ee2170eded3f707f5caf5..066b9fecf36c7d8d2ef1d3fe5b10a16a9a38967f 100755
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -224,7 +224,7 @@ static Handle<JSFunction> MakeFunction(bool is_global,

 #ifdef ENABLE_DEBUGGER_SUPPORT
   // Notify debugger
-  Debugger::OnAfterCompile(script, fun);
+  Debugger::OnAfterCompile(script, fun, false);
 #endif

   return fun;
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index 8c4f51d95a2824c6c92abb2f505e0a76968e9e4c..39e98bf63ee7aadf5277047c51121d84f138a672 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -1959,7 +1959,9 @@ void Debugger::OnBeforeCompile(Handle<Script> script) {


 // Handle debugger actions when a new script is compiled.
-void Debugger::OnAfterCompile(Handle<Script> script, Handle<JSFunction> fun) {
+// TODO(peter.rybin): consider removing unused fun argument
+void Debugger::OnAfterCompile(Handle<Script> script, Handle<JSFunction> fun,
+                              bool send_from_debugger) {
   HandleScope scope;

   // Add the newly compiled script to the script cache.
@@ -2006,7 +2008,7 @@ void Debugger::OnAfterCompile(Handle<Script> script, Handle<JSFunction> fun) {
     return;
   }
   // Bail out based on state or if there is no listener for this event
-  if (in_debugger) return;
+  if (in_debugger && !send_from_debugger) return;
   if (!Debugger::EventActive(v8::AfterCompile)) return;

   // Create the compile state object.
Index: src/debug.h
diff --git a/src/debug.h b/src/debug.h
index cab9e8e447c951265ec3bdb44743abd4c9334484..e31d008ae9a66dc9170bfc21f0ddf3412e810812 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -605,7 +605,8 @@ class Debugger {
   static void OnException(Handle<Object> exception, bool uncaught);
   static void OnBeforeCompile(Handle<Script> script);
   static void OnAfterCompile(Handle<Script> script,
-                           Handle<JSFunction> fun);
+                           Handle<JSFunction> fun,
+                           bool send_from_debugger);
   static void OnNewFunction(Handle<JSFunction> fun);
   static void OnScriptCollected(int id);
   static void ProcessDebugEvent(v8::DebugEvent event,


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to