Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: src/mirror-debugger.js

Issue 307383002: Add option to disable MirrorCache. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/debug.cc ('k') | test/mjsunit/debug-toggle-mirror-cache.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mirror-debugger.js
diff --git a/src/mirror-debugger.js b/src/mirror-debugger.js
index b1f67ac7a872d416c22d7f01b69df1ce003b2404..f878f5abcd7e915372ba58e7c5e5655cbfd1b6f9 100644
--- a/src/mirror-debugger.js
+++ b/src/mirror-debugger.js
@@ -8,6 +8,14 @@ var next_transient_handle_ = -1;
// Mirror cache.
var mirror_cache_ = [];
+var mirror_cache_enabled_ = true;
+
+
+function ToggleMirrorCache(value) {
+ mirror_cache_enabled_ = value;
+ next_handle_ = 0;
+ mirror_cache_ = [];
+}
/**
@@ -44,7 +52,7 @@ function MakeMirror(value, opt_transient) {
var mirror;
// Look for non transient mirrors in the mirror cache.
- if (!opt_transient) {
+ if (!opt_transient && mirror_cache_enabled_) {
for (id in mirror_cache_) {
mirror = mirror_cache_[id];
if (mirror.value() === value) {
@@ -88,7 +96,7 @@ function MakeMirror(value, opt_transient) {
mirror = new ObjectMirror(value, OBJECT_TYPE, opt_transient);
}
- mirror_cache_[mirror.handle()] = mirror;
+ if (mirror_cache_enabled_) mirror_cache_[mirror.handle()] = mirror;
return mirror;
}
@@ -101,6 +109,7 @@ function MakeMirror(value, opt_transient) {
* undefined if no mirror with the requested handle was found
*/
function LookupMirror(handle) {
+ if (!mirror_cache_enabled_) throw new Error("Mirror cache is disabled");
return mirror_cache_[handle];
}
@@ -424,7 +433,7 @@ Mirror.prototype.isScope = function() {
* Allocate a handle id for this object.
*/
Mirror.prototype.allocateHandle_ = function() {
- this.handle_ = next_handle_++;
+ if (mirror_cache_enabled_) this.handle_ = next_handle_++;
};
« no previous file with comments | « src/debug.cc ('k') | test/mjsunit/debug-toggle-mirror-cache.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698