| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 } | 412 } |
| 413 | 413 |
| 414 | 414 |
| 415 int GlobalHandles::number_of_weak_handles_ = 0; | 415 int GlobalHandles::number_of_weak_handles_ = 0; |
| 416 int GlobalHandles::number_of_global_object_weak_handles_ = 0; | 416 int GlobalHandles::number_of_global_object_weak_handles_ = 0; |
| 417 | 417 |
| 418 GlobalHandles::Node* GlobalHandles::head_ = NULL; | 418 GlobalHandles::Node* GlobalHandles::head_ = NULL; |
| 419 GlobalHandles::Node* GlobalHandles::first_free_ = NULL; | 419 GlobalHandles::Node* GlobalHandles::first_free_ = NULL; |
| 420 GlobalHandles::Node* GlobalHandles::first_deallocated_ = NULL; | 420 GlobalHandles::Node* GlobalHandles::first_deallocated_ = NULL; |
| 421 | 421 |
| 422 void GlobalHandles::RecordStats(HeapStats* stats) { |
| 423 stats->global_handle_count = 0; |
| 424 stats->weak_global_handle_count = 0; |
| 425 stats->pending_global_handle_count = 0; |
| 426 stats->near_death_global_handle_count = 0; |
| 427 stats->destroyed_global_handle_count = 0; |
| 428 for (Node* current = head_; current != NULL; current = current->next()) { |
| 429 stats->global_handle_count++; |
| 430 if (current->state_ == Node::WEAK) { |
| 431 stats->weak_global_handle_count++; |
| 432 } else if (current->state_ == Node::PENDING) { |
| 433 stats->pending_global_handle_count++; |
| 434 } else if (current->state_ == Node::NEAR_DEATH) { |
| 435 stats->near_death_global_handle_count++; |
| 436 } else if (current->state_ == Node::DESTROYED) { |
| 437 stats->destroyed_global_handle_count++; |
| 438 } |
| 439 } |
| 440 } |
| 441 |
| 422 #ifdef DEBUG | 442 #ifdef DEBUG |
| 423 | 443 |
| 424 void GlobalHandles::PrintStats() { | 444 void GlobalHandles::PrintStats() { |
| 425 int total = 0; | 445 int total = 0; |
| 426 int weak = 0; | 446 int weak = 0; |
| 427 int pending = 0; | 447 int pending = 0; |
| 428 int near_death = 0; | 448 int near_death = 0; |
| 429 int destroyed = 0; | 449 int destroyed = 0; |
| 430 | 450 |
| 431 for (Node* current = head_; current != NULL; current = current->next()) { | 451 for (Node* current = head_; current != NULL; current = current->next()) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 void GlobalHandles::RemoveObjectGroups() { | 492 void GlobalHandles::RemoveObjectGroups() { |
| 473 List<ObjectGroup*>* object_groups = ObjectGroups(); | 493 List<ObjectGroup*>* object_groups = ObjectGroups(); |
| 474 for (int i = 0; i< object_groups->length(); i++) { | 494 for (int i = 0; i< object_groups->length(); i++) { |
| 475 delete object_groups->at(i); | 495 delete object_groups->at(i); |
| 476 } | 496 } |
| 477 object_groups->Clear(); | 497 object_groups->Clear(); |
| 478 } | 498 } |
| 479 | 499 |
| 480 | 500 |
| 481 } } // namespace v8::internal | 501 } } // namespace v8::internal |
| OLD | NEW |