Index: src/global-handles.cc |
diff --git a/src/global-handles.cc b/src/global-handles.cc |
index 3f4e3bea59d5fb8d96e9435d3dbb0f6932ffd532..1853be4ef836fcc06997b3eb73a4f32db2b8646b 100644 |
--- a/src/global-handles.cc |
+++ b/src/global-handles.cc |
@@ -106,12 +106,6 @@ class GlobalHandles::Node { |
void Release(GlobalHandles* global_handles) { |
ASSERT(state() != FREE); |
- if (IsWeakRetainer()) { |
- global_handles->number_of_weak_handles_--; |
- if (object_->IsJSGlobalObject()) { |
- global_handles->number_of_global_object_weak_handles_--; |
- } |
- } |
set_state(FREE); |
parameter_or_next_free_.next_free = global_handles->first_free_; |
global_handles->first_free_ = this; |
@@ -222,12 +216,6 @@ class GlobalHandles::Node { |
void* parameter, |
WeakReferenceCallback callback) { |
ASSERT(state() != FREE); |
- if (!IsWeakRetainer()) { |
- global_handles->number_of_weak_handles_++; |
- if (object_->IsJSGlobalObject()) { |
- global_handles->number_of_global_object_weak_handles_++; |
- } |
- } |
set_state(WEAK); |
set_parameter(parameter); |
callback_ = callback; |
@@ -235,12 +223,6 @@ class GlobalHandles::Node { |
void ClearWeakness(GlobalHandles* global_handles) { |
ASSERT(state() != FREE); |
- if (IsWeakRetainer()) { |
- global_handles->number_of_weak_handles_--; |
- if (object_->IsJSGlobalObject()) { |
- global_handles->number_of_global_object_weak_handles_--; |
- } |
- } |
set_state(NORMAL); |
set_parameter(NULL); |
} |
@@ -422,8 +404,6 @@ class GlobalHandles::NodeIterator { |
GlobalHandles::GlobalHandles(Isolate* isolate) |
: isolate_(isolate), |
- number_of_weak_handles_(0), |
- number_of_global_object_weak_handles_(0), |
number_of_global_handles_(0), |
first_block_(NULL), |
first_used_block_(NULL), |
@@ -721,6 +701,29 @@ void GlobalHandles::IterateAllRootsWithClassIds(ObjectVisitor* v) { |
} |
+int GlobalHandles::NumberOfWeakHandles() { |
+ int count = 0; |
+ for (NodeIterator it(this); !it.done(); it.Advance()) { |
+ if (it.node()->IsWeakRetainer()) { |
+ count++; |
+ } |
+ } |
+ return count; |
+} |
+ |
+ |
+int GlobalHandles::NumberOfGlobalObjectWeakHandles() { |
+ int count = 0; |
+ for (NodeIterator it(this); !it.done(); it.Advance()) { |
+ if (it.node()->IsWeakRetainer() && |
+ it.node()->object()->IsJSGlobalObject()) { |
+ count++; |
+ } |
+ } |
+ return count; |
+} |
+ |
+ |
void GlobalHandles::RecordStats(HeapStats* stats) { |
*stats->global_handle_count = 0; |
*stats->weak_global_handle_count = 0; |