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

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: test case 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
Index: src/mirror-debugger.js
diff --git a/src/mirror-debugger.js b/src/mirror-debugger.js
index b1f67ac7a872d416c22d7f01b69df1ce003b2404..9c58426bb1974a79c3aac5357802cf8976f91d0c 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,7 +109,7 @@ function MakeMirror(value, opt_transient) {
* undefined if no mirror with the requested handle was found
*/
function LookupMirror(handle) {
- return mirror_cache_[handle];
+ return mirror_cache_enabled_ ? mirror_cache_[handle] : UNDEFINED;
yurys 2014/06/03 13:27:18 I'd rather we threw an exception if mirror cache i
Yang 2014/06/03 14:22:05 Done.
}
@@ -424,7 +432,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_++;
};
« src/debug.cc ('K') | « 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