| 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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 479 | 479 |
| 480 for (Node* current = head_; current != NULL; current = current->next()) { | 480 for (Node* current = head_; current != NULL; current = current->next()) { |
| 481 total++; | 481 total++; |
| 482 if (current->state_ == Node::WEAK) weak++; | 482 if (current->state_ == Node::WEAK) weak++; |
| 483 if (current->state_ == Node::PENDING) pending++; | 483 if (current->state_ == Node::PENDING) pending++; |
| 484 if (current->state_ == Node::NEAR_DEATH) near_death++; | 484 if (current->state_ == Node::NEAR_DEATH) near_death++; |
| 485 if (current->state_ == Node::DESTROYED) destroyed++; | 485 if (current->state_ == Node::DESTROYED) destroyed++; |
| 486 } | 486 } |
| 487 | 487 |
| 488 PrintF("Global Handle Statistics:\n"); | 488 PrintF("Global Handle Statistics:\n"); |
| 489 PrintF(" allocated memory = %dB\n", sizeof(Node) * total); | 489 PrintF(" allocated memory = %" V8_PTR_PREFIX "dB\n", sizeof(Node) * total); |
| 490 PrintF(" # weak = %d\n", weak); | 490 PrintF(" # weak = %d\n", weak); |
| 491 PrintF(" # pending = %d\n", pending); | 491 PrintF(" # pending = %d\n", pending); |
| 492 PrintF(" # near_death = %d\n", near_death); | 492 PrintF(" # near_death = %d\n", near_death); |
| 493 PrintF(" # destroyed = %d\n", destroyed); | 493 PrintF(" # destroyed = %d\n", destroyed); |
| 494 PrintF(" # total = %d\n", total); | 494 PrintF(" # total = %d\n", total); |
| 495 } | 495 } |
| 496 | 496 |
| 497 void GlobalHandles::Print() { | 497 void GlobalHandles::Print() { |
| 498 PrintF("Global handles:\n"); | 498 PrintF("Global handles:\n"); |
| 499 for (Node* current = head_; current != NULL; current = current->next()) { | 499 for (Node* current = head_; current != NULL; current = current->next()) { |
| 500 PrintF(" handle %p to %p (weak=%d)\n", current->handle().location(), | 500 PrintF(" handle %p to %p (weak=%d)\n", |
| 501 *current->handle(), current->state_ == Node::WEAK); | 501 reinterpret_cast<void*>(current->handle().location()), |
| 502 reinterpret_cast<void*>(*current->handle()), |
| 503 current->state_ == Node::WEAK); |
| 502 } | 504 } |
| 503 } | 505 } |
| 504 | 506 |
| 505 #endif | 507 #endif |
| 506 | 508 |
| 507 List<ObjectGroup*>* GlobalHandles::ObjectGroups() { | 509 List<ObjectGroup*>* GlobalHandles::ObjectGroups() { |
| 508 // Lazily initialize the list to avoid startup time static constructors. | 510 // Lazily initialize the list to avoid startup time static constructors. |
| 509 static List<ObjectGroup*> groups(4); | 511 static List<ObjectGroup*> groups(4); |
| 510 return &groups; | 512 return &groups; |
| 511 } | 513 } |
| 512 | 514 |
| 513 void GlobalHandles::AddGroup(Object*** handles, size_t length) { | 515 void GlobalHandles::AddGroup(Object*** handles, size_t length) { |
| 514 ObjectGroup* new_entry = new ObjectGroup(length); | 516 ObjectGroup* new_entry = new ObjectGroup(length); |
| 515 for (size_t i = 0; i < length; ++i) | 517 for (size_t i = 0; i < length; ++i) |
| 516 new_entry->objects_.Add(handles[i]); | 518 new_entry->objects_.Add(handles[i]); |
| 517 ObjectGroups()->Add(new_entry); | 519 ObjectGroups()->Add(new_entry); |
| 518 } | 520 } |
| 519 | 521 |
| 520 | 522 |
| 521 void GlobalHandles::RemoveObjectGroups() { | 523 void GlobalHandles::RemoveObjectGroups() { |
| 522 List<ObjectGroup*>* object_groups = ObjectGroups(); | 524 List<ObjectGroup*>* object_groups = ObjectGroups(); |
| 523 for (int i = 0; i< object_groups->length(); i++) { | 525 for (int i = 0; i< object_groups->length(); i++) { |
| 524 delete object_groups->at(i); | 526 delete object_groups->at(i); |
| 525 } | 527 } |
| 526 object_groups->Clear(); | 528 object_groups->Clear(); |
| 527 } | 529 } |
| 528 | 530 |
| 529 } } // namespace v8::internal | 531 } } // namespace v8::internal |
| OLD | NEW |