Chromium Code Reviews| 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_++; |
| }; |