Revision: 22063
Author:   [email protected]
Date:     Fri Jun 27 12:10:43 2014 UTC
Log:      Remove script collected debug event.

[email protected]

Review URL: https://codereview.chromium.org/358873005
http://code.google.com/p/v8/source/detail?r=22063

Deleted:
 /branches/bleeding_edge/test/mjsunit/regress/regress-2336.js
Modified:
 /branches/bleeding_edge/include/v8-debug.h
 /branches/bleeding_edge/src/compiler.cc
 /branches/bleeding_edge/src/d8.js
 /branches/bleeding_edge/src/debug-debugger.js
 /branches/bleeding_edge/src/debug.cc
 /branches/bleeding_edge/src/debug.h
 /branches/bleeding_edge/src/heap.cc
 /branches/bleeding_edge/test/cctest/test-debug.cc
 /branches/bleeding_edge/tools/generate-runtime-tests.py

=======================================
--- /branches/bleeding_edge/test/mjsunit/regress/regress-2336.js Mon Sep 17 11:38:24 2012 UTC
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2012 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//     * Redistributions of source code must retain the above copyright
-//       notice, this list of conditions and the following disclaimer.
-//     * Redistributions in binary form must reproduce the above
-//       copyright notice, this list of conditions and the following
-//       disclaimer in the documentation and/or other materials provided
-//       with the distribution.
-//     * Neither the name of Google Inc. nor the names of its
-//       contributors may be used to endorse or promote products derived
-//       from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Flags: --expose-debug-as debug --expose-gc
-
-// Check that we can cope with a debug listener that runs in the
-// GC epilogue and causes enough allocation to trigger a new GC during
-// the epilogue.
-
-var f = eval("(function f() { return 42; })");
-
-Debug = debug.Debug;
-
-var called = false;
-
-function listener(event, exec_state, event_data, data) {
-  if (event == Debug.DebugEvent.ScriptCollected) {
-    if (!called) {
-      called = true;
-      gc();
-    }
-  }
-};
-
-Debug.scripts();
-Debug.setListener(listener);
-f = void 0;
-gc();
-assertTrue(called);
=======================================
--- /branches/bleeding_edge/include/v8-debug.h  Thu Jun 26 16:03:52 2014 UTC
+++ /branches/bleeding_edge/include/v8-debug.h  Fri Jun 27 12:10:43 2014 UTC
@@ -19,9 +19,8 @@
   NewFunction = 3,
   BeforeCompile = 4,
   AfterCompile  = 5,
-  ScriptCollected = 6,
-  CompileError = 7,
-  BreakForCommand = 8
+  CompileError = 6,
+  BreakForCommand = 7
 };


=======================================
--- /branches/bleeding_edge/src/compiler.cc     Thu Jun 26 15:12:04 2014 UTC
+++ /branches/bleeding_edge/src/compiler.cc     Fri Jun 27 12:10:43 2014 UTC
@@ -454,6 +454,7 @@
   ASSERT(last_status() == SUCCEEDED);
   ASSERT(!info()->HasAbortedDueToDependencyChange());
   DisallowCodeDependencyChange no_dependency_change;
+  DisallowJavascriptExecution no_js(isolate());
   {  // Scope for timer.
     Timer timer(this, &time_taken_to_codegen_);
     ASSERT(chunk_ != NULL);
=======================================
--- /branches/bleeding_edge/src/d8.js   Thu May 15 09:19:02 2014 UTC
+++ /branches/bleeding_edge/src/d8.js   Fri Jun 27 12:10:43 2014 UTC
@@ -208,10 +208,6 @@
       details.text = result;
       break;

-    case 'scriptCollected':
-      details.text = result;
-      break;
-
     default:
       details.text = 'Unknown debug event ' + response.event();
   }
=======================================
--- /branches/bleeding_edge/src/debug-debugger.js Thu Jun 26 16:03:52 2014 UTC +++ /branches/bleeding_edge/src/debug-debugger.js Fri Jun 27 12:10:43 2014 UTC
@@ -19,8 +19,7 @@
                      NewFunction: 3,
                      BeforeCompile: 4,
                      AfterCompile: 5,
-                     ScriptCollected: 6,
-                     CompileError: 7 };
+                     CompileError: 6 };

 // Types of exceptions that can be broken upon.
 Debug.ExceptionBreak = { Caught : 0,
@@ -1179,31 +1178,6 @@
   o.body = {};
   o.body.script = this.script_;

-  return o.toJSONProtocol();
-};
-
-
-function MakeScriptCollectedEvent(id) {
-  return new ScriptCollectedEvent(id);
-}
-
-
-function ScriptCollectedEvent(id) {
-  this.id_ = id;
-}
-
-
-ScriptCollectedEvent.prototype.id = function() {
-  return this.id_;
-};
-
-
-ScriptCollectedEvent.prototype.toJSONProtocol = function() {
-  var o = new ProtocolMessage();
-  o.running = true;
-  o.event = "scriptCollected";
-  o.body = {};
-  o.body.script = { id: this.id() };
   return o.toJSONProtocol();
 };

=======================================
--- /branches/bleeding_edge/src/debug.cc        Thu Jun 26 16:03:52 2014 UTC
+++ /branches/bleeding_edge/src/debug.cc        Fri Jun 27 12:10:43 2014 UTC
@@ -592,8 +592,7 @@


ScriptCache::ScriptCache(Isolate* isolate) : HashMap(HashMap::PointersMatch),
-                                             isolate_(isolate),
-                                             collected_scripts_(10) {
+                                             isolate_(isolate) {
   Heap* heap = isolate_->heap();
   HandleScope scope(isolate_);

@@ -649,15 +648,6 @@
   }
   return instances;
 }
-
-
-void ScriptCache::ProcessCollectedScripts() {
-  Debug* debug = isolate_->debug();
-  for (int i = 0; i < collected_scripts_.length(); i++) {
-    debug->OnScriptCollected(collected_scripts_[i]);
-  }
-  collected_scripts_.Clear();
-}


 void ScriptCache::Clear() {
@@ -688,7 +678,6 @@
   HashMap::Entry* entry = script_cache->Lookup(key, hash, false);
   Object** location = reinterpret_cast<Object**>(entry->value);
   script_cache->Remove(key, hash);
-  script_cache->collected_scripts_.Add(id);

   // Clear the weak handle.
   GlobalHandles::Destroy(location);
@@ -2498,14 +2487,6 @@
     script->set_eval_from_instructions_offset(Smi::FromInt(offset));
   }
 }
-
-
-void Debug::AfterGarbageCollection() {
-  // Generate events for collected scripts.
-  if (script_cache_ != NULL) {
-    script_cache_->ProcessCollectedScripts();
-  }
-}


 MaybeHandle<Object> Debug::MakeJSObject(const char* constructor_name,
@@ -2561,14 +2542,6 @@
                             isolate_->factory()->NewNumberFromInt(type) };
   return MakeJSObject("MakeCompileEvent", ARRAY_SIZE(argv), argv);
 }
-
-
-MaybeHandle<Object> Debug::MakeScriptCollectedEvent(int id) {
-  // Create the script collected event object.
-  Handle<Object> id_object = Handle<Smi>(Smi::FromInt(id), isolate_);
-  Handle<Object> argv[] = { id_object };
-  return MakeJSObject("MakeScriptCollectedEvent", ARRAY_SIZE(argv), argv);
-}


 void Debug::OnException(Handle<Object> exception, bool uncaught) {
@@ -2714,25 +2687,6 @@
   // Process debug event.
ProcessDebugEvent(v8::AfterCompile, Handle<JSObject>::cast(event_data), true);
 }
-
-
-void Debug::OnScriptCollected(int id) {
-  if (in_debug_scope() || ignore_events()) return;
-
-  HandleScope scope(isolate_);
-  DebugScope debug_scope(this);
-  if (debug_scope.failed()) return;
-
-  // Create the script collected state object.
-  Handle<Object> event_data;
-  // Bail out and don't call debugger if exception.
-  if (!MakeScriptCollectedEvent(id).ToHandle(&event_data)) return;
-
-  // Process debug event.
-  ProcessDebugEvent(v8::ScriptCollected,
-                    Handle<JSObject>::cast(event_data),
-                    true);
-}


 void Debug::ProcessDebugEvent(v8::DebugEvent event,
@@ -2836,9 +2790,6 @@
     case v8::AfterCompile:
       sendEventMessage = true;
       break;
-    case v8::ScriptCollected:
-      sendEventMessage = true;
-      break;
     case v8::NewFunction:
       break;
     default:
@@ -2866,9 +2817,7 @@
   // in the queue if any. For script collected events don't even process
// messages in the queue as the execution state might not be what is expected
   // by the client.
-  if ((auto_continue && !has_commands()) || event == v8::ScriptCollected) {
-    return;
-  }
+  if (auto_continue && !has_commands()) return;

   // DebugCommandProcessor goes here.
   bool running = auto_continue;
@@ -3251,7 +3200,7 @@
   Isolate* isolate = event_data_->GetIsolate();
   v8::Handle<v8::Context> context = GetDebugEventContext(isolate);
   // Isolate::context() may be NULL when "script collected" event occures.
-  ASSERT(!context.IsEmpty() || event_ == v8::ScriptCollected);
+  ASSERT(!context.IsEmpty());
   return context;
 }

=======================================
--- /branches/bleeding_edge/src/debug.h Thu Jun 26 16:03:52 2014 UTC
+++ /branches/bleeding_edge/src/debug.h Fri Jun 27 12:10:43 2014 UTC
@@ -159,9 +159,6 @@
   // Return the scripts in the cache.
   Handle<FixedArray> GetScripts();

-  // Generate debugger events for collected scripts.
-  void ProcessCollectedScripts();
-
  private:
   // Calculate the hash value from the key (script id).
   static uint32_t Hash(int key) {
@@ -176,8 +173,6 @@
       const v8::WeakCallbackData<v8::Value, void>& data);

   Isolate* isolate_;
-  // List used during GC to temporarily store id's of collected scripts.
-  List<int> collected_scripts_;
 };


@@ -370,7 +365,6 @@
   void OnCompileError(Handle<Script> script);
   void OnBeforeCompile(Handle<Script> script);
   void OnAfterCompile(Handle<Script> script);
-  void OnScriptCollected(int id);

   // API facing.
   void SetEventListener(Handle<Object> callback, Handle<Object> data);
@@ -477,9 +471,6 @@
   // Record function from which eval was called.
   static void RecordEvalCaller(Handle<Script> script);

-  // Garbage collection notifications.
-  void AfterGarbageCollection();
-
   // Flags and states.
DebugScope* debugger_entry() { return thread_local_.current_debug_scope_; }
   inline Handle<Context> debug_context() { return debug_context_; }
@@ -544,7 +535,6 @@
       Handle<Object> promise);
   MUST_USE_RESULT MaybeHandle<Object> MakeCompileEvent(
       Handle<Script> script, v8::DebugEvent type);
-  MUST_USE_RESULT MaybeHandle<Object> MakeScriptCollectedEvent(int id);

   // Mirror cache handling.
   void ClearMirrorCache();
=======================================
--- /branches/bleeding_edge/src/heap.cc Thu Jun 26 12:56:14 2014 UTC
+++ /branches/bleeding_edge/src/heap.cc Fri Jun 27 12:10:43 2014 UTC
@@ -717,7 +717,6 @@
 #ifdef DEBUG
   ReportStatisticsAfterGC();
 #endif  // DEBUG
-  isolate_->debug()->AfterGarbageCollection();

   // Remember the last top pointer so that we can later find out
   // whether we allocated in new space since the last GC.
=======================================
--- /branches/bleeding_edge/test/cctest/test-debug.cc Thu Jun 26 16:03:52 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-debug.cc Fri Jun 27 12:10:43 2014 UTC
@@ -6219,120 +6219,6 @@
   CHECK_EQ(break_count, 2);
   CheckDebuggerUnloaded();
 }
-
-
-// Debug event listener which counts the script collected events.
-int script_collected_count = 0;
-static void DebugEventScriptCollectedEvent(
-    const v8::Debug::EventDetails& event_details) {
-  v8::DebugEvent event = event_details.GetEvent();
-  // Count the number of breaks.
-  if (event == v8::ScriptCollected) {
-    script_collected_count++;
-  }
-}
-
-
-// Test that scripts collected are reported through the debug event listener.
-TEST(ScriptCollectedEvent) {
-  v8::internal::Debug* debug = CcTest::i_isolate()->debug();
-  break_point_hit_count = 0;
-  script_collected_count = 0;
-  DebugLocalContext env;
-  v8::HandleScope scope(env->GetIsolate());
-
-  // Request the loaded scripts to initialize the debugger script cache.
-  debug->GetLoadedScripts();
-
- // Do garbage collection to ensure that only the script in this test will be
-  // collected afterwards.
-  CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
-
-  script_collected_count = 0;
-  v8::Debug::SetDebugEventListener(DebugEventScriptCollectedEvent);
-  {
-    v8::Script::Compile(
-        v8::String::NewFromUtf8(env->GetIsolate(), "eval('a=1')"))->Run();
-    v8::Script::Compile(
-        v8::String::NewFromUtf8(env->GetIsolate(), "eval('a=2')"))->Run();
-  }
-
-  // Do garbage collection to collect the script above which is no longer
-  // referenced.
-  CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
-
-  CHECK_EQ(2, script_collected_count);
-
-  v8::Debug::SetDebugEventListener(NULL);
-  CheckDebuggerUnloaded();
-}
-
-
-// Debug event listener which counts the script collected events.
-int script_collected_message_count = 0;
-static void ScriptCollectedMessageHandler(const v8::Debug::Message& message) {
-  // Count the number of scripts collected.
-  if (message.IsEvent() && message.GetEvent() == v8::ScriptCollected) {
-    script_collected_message_count++;
-    v8::Handle<v8::Context> context = message.GetEventContext();
-    CHECK(context.IsEmpty());
-  }
-}
-
-
-// Test that GetEventContext doesn't fail and return empty handle for
-// ScriptCollected events.
-TEST(ScriptCollectedEventContext) {
-  i::FLAG_stress_compaction = false;
-  v8::Isolate* isolate = CcTest::isolate();
-  v8::internal::Debug* debug =
-      reinterpret_cast<v8::internal::Isolate*>(isolate)->debug();
-  script_collected_message_count = 0;
-  v8::HandleScope scope(isolate);
-
-  v8::Persistent<v8::Context> context;
-  {
-    v8::HandleScope scope(isolate);
-    context.Reset(isolate, v8::Context::New(isolate));
-  }
-
-  // Enter context.  We can't have a handle to the context in the outer
-  // scope, so we have to do it the hard way.
-  {
-    v8::HandleScope scope(isolate);
-    v8::Local<v8::Context> local_context =
-        v8::Local<v8::Context>::New(isolate, context);
-    local_context->Enter();
-  }
-
-  // Request the loaded scripts to initialize the debugger script cache.
-  debug->GetLoadedScripts();
-
- // Do garbage collection to ensure that only the script in this test will be
-  // collected afterwards.
-  CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
-
-  v8::Debug::SetMessageHandler(ScriptCollectedMessageHandler);
- v8::Script::Compile(v8::String::NewFromUtf8(isolate, "eval('a=1')"))->Run(); - v8::Script::Compile(v8::String::NewFromUtf8(isolate, "eval('a=2')"))->Run();
-
-  // Leave context
-  {
-    v8::HandleScope scope(isolate);
-    v8::Local<v8::Context> local_context =
-        v8::Local<v8::Context>::New(isolate, context);
-    local_context->Exit();
-  }
-  context.Reset();
-
-  // Do garbage collection to collect the script above which is no longer
-  // referenced.
-  CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
-
-  CHECK_EQ(2, script_collected_message_count);
-
-  v8::Debug::SetMessageHandler(NULL);
-}


 // Debug event listener which counts the after compile events.
=======================================
--- /branches/bleeding_edge/tools/generate-runtime-tests.py Wed Jun 25 15:26:10 2014 UTC +++ /branches/bleeding_edge/tools/generate-runtime-tests.py Fri Jun 27 12:10:43 2014 UTC
@@ -51,7 +51,7 @@
 EXPECTED_FUZZABLE_COUNT = 330
 EXPECTED_CCTEST_COUNT = 6
 EXPECTED_UNKNOWN_COUNT = 4
-EXPECTED_BUILTINS_COUNT = 808
+EXPECTED_BUILTINS_COUNT = 806


 # Don't call these at all.

--
--
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