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

Side by Side Diff: src/global-handles.cc

Issue 462019: Added recording of heap and global handle stats in a stack-allocated (Closed)
Patch Set: Created 11 years 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 unified diff | Download patch
« no previous file with comments | « src/global-handles.h ('k') | src/heap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 } 422 }
423 423
424 424
425 int GlobalHandles::number_of_weak_handles_ = 0; 425 int GlobalHandles::number_of_weak_handles_ = 0;
426 int GlobalHandles::number_of_global_object_weak_handles_ = 0; 426 int GlobalHandles::number_of_global_object_weak_handles_ = 0;
427 427
428 GlobalHandles::Node* GlobalHandles::head_ = NULL; 428 GlobalHandles::Node* GlobalHandles::head_ = NULL;
429 GlobalHandles::Node* GlobalHandles::first_free_ = NULL; 429 GlobalHandles::Node* GlobalHandles::first_free_ = NULL;
430 GlobalHandles::Node* GlobalHandles::first_deallocated_ = NULL; 430 GlobalHandles::Node* GlobalHandles::first_deallocated_ = NULL;
431 431
432 void GlobalHandles::RecordStats(HeapStats* stats) {
433 stats->global_handle_count = 0;
434 stats->weak_global_handle_count = 0;
435 stats->pending_global_handle_count = 0;
436 stats->near_death_global_handle_count = 0;
437 stats->destroyed_global_handle_count = 0;
438 for (Node* current = head_; current != NULL; current = current->next()) {
439 stats->global_handle_count++;
440 if (current->state_ == Node::WEAK) {
441 stats->weak_global_handle_count++;
442 } else if (current->state_ == Node::PENDING) {
443 stats->pending_global_handle_count++;
444 } else if (current->state_ == Node::NEAR_DEATH) {
445 stats->near_death_global_handle_count++;
446 } else if (current->state_ == Node::DESTROYED) {
447 stats->destroyed_global_handle_count++;
448 }
449 }
450 }
451
432 #ifdef DEBUG 452 #ifdef DEBUG
433 453
434 void GlobalHandles::PrintStats() { 454 void GlobalHandles::PrintStats() {
435 int total = 0; 455 int total = 0;
436 int weak = 0; 456 int weak = 0;
437 int pending = 0; 457 int pending = 0;
438 int near_death = 0; 458 int near_death = 0;
439 int destroyed = 0; 459 int destroyed = 0;
440 460
441 for (Node* current = head_; current != NULL; current = current->next()) { 461 for (Node* current = head_; current != NULL; current = current->next()) {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 void GlobalHandles::RemoveObjectGroups() { 502 void GlobalHandles::RemoveObjectGroups() {
483 List<ObjectGroup*>* object_groups = ObjectGroups(); 503 List<ObjectGroup*>* object_groups = ObjectGroups();
484 for (int i = 0; i< object_groups->length(); i++) { 504 for (int i = 0; i< object_groups->length(); i++) {
485 delete object_groups->at(i); 505 delete object_groups->at(i);
486 } 506 }
487 object_groups->Clear(); 507 object_groups->Clear();
488 } 508 }
489 509
490 510
491 } } // namespace v8::internal 511 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/global-handles.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698