Do not clear mirror cache when fetching loaded scripts.
authoryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 10 Jun 2014 09:42:41 +0000 (09:42 +0000)
committeryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Tue, 10 Jun 2014 09:42:41 +0000 (09:42 +0000)
R=yurys@chromium.org
BUG=376534
LOG=N

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21737 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/debug-debugger.js
src/mirror-debugger.js
test/mjsunit/debug-mirror-cache.js
tools/generate-runtime-tests.py

index 5462b53..660ea79 100644 (file)
@@ -486,12 +486,6 @@ function GetScriptBreakPoints(script) {
 }
 
 
-function GetLoadedScripts() {
-  ClearMirrorCache();  // The mirror cache may be holding onto scripts.
-  return %DebugGetLoadedScripts();
-}
-
-
 Debug.setListener = function(listener, opt_data) {
   if (!IS_FUNCTION(listener) && !IS_UNDEFINED(listener) && !IS_NULL(listener)) {
     throw new Error('Parameters have wrong types.');
@@ -921,7 +915,7 @@ Debug.showBreakPoints = function(f, full, opt_position_alignment) {
 // scanning the heap.
 Debug.scripts = function() {
   // Collect all scripts in the heap.
-  return GetLoadedScripts();
+  return %DebugGetLoadedScripts();
 };
 
 
@@ -2250,7 +2244,7 @@ DebugCommandProcessor.prototype.scriptsRequest_ = function(request, response) {
   }
 
   // Collect all scripts in the heap.
-  var scripts = GetLoadedScripts();
+  var scripts = %DebugGetLoadedScripts();
 
   response.body = [];
 
@@ -2322,7 +2316,7 @@ DebugCommandProcessor.prototype.changeLiveRequest_ = function(
   var script_id = request.arguments.script_id;
   var preview_only = !!request.arguments.preview_only;
 
-  var scripts = GetLoadedScripts();
+  var scripts = %DebugGetLoadedScripts();
 
   var the_script = null;
   for (var i = 0; i < scripts.length; i++) {
index f878f5a..897413c 100644 (file)
@@ -18,15 +18,6 @@ function ToggleMirrorCache(value) {
 }
 
 
-/**
- * Clear the mirror handle cache.
- */
-function ClearMirrorCache() {
-  next_handle_ = 0;
-  mirror_cache_ = [];
-}
-
-
 // Wrapper to check whether an object is a Promise.  The call may not work
 // if promises are not enabled.
 // TODO(yangguo): remove try-catch once promises are enabled by default.
index 07aaf88..c690aa0 100644 (file)
@@ -62,6 +62,9 @@ function listener(event, exec_state, event_data, data) {
     json = '{"seq":0,"type":"request","command":"backtrace"}'
     dcp.processDebugJSONRequest(json);
 
+    // Make sure looking up loaded scripts does not clear the cache.
+    Debug.scripts();
+
     // Some mirrors where cached.
     assertFalse(debug.next_handle_ == 0, "Mirror cache not used");
     assertFalse(debug.mirror_cache_.length == 0, "Mirror cache not used");
index a4414be..71b46c6 100755 (executable)
@@ -51,7 +51,7 @@ EXPECTED_FUNCTION_COUNT = 358
 EXPECTED_FUZZABLE_COUNT = 325
 EXPECTED_CCTEST_COUNT = 6
 EXPECTED_UNKNOWN_COUNT = 5
-EXPECTED_BUILTINS_COUNT = 798
+EXPECTED_BUILTINS_COUNT = 796
 
 
 # Don't call these at all.