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

Unified Diff: src/global-handles.cc

Issue 11958015: Remove GlobalHandles::number_of_weak_handles_ and number_of_global_object_weak_handles_ (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 7 years, 11 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/global-handles.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « src/global-handles.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698