| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 entries_.Add(EntryInfo(id, addr, size)); | 458 entries_.Add(EntryInfo(id, addr, size)); |
| 459 ASSERT(static_cast<uint32_t>(entries_.length()) > entries_map_.occupancy()); | 459 ASSERT(static_cast<uint32_t>(entries_.length()) > entries_map_.occupancy()); |
| 460 return id; | 460 return id; |
| 461 } | 461 } |
| 462 | 462 |
| 463 | 463 |
| 464 void HeapObjectsMap::StopHeapObjectsTracking() { | 464 void HeapObjectsMap::StopHeapObjectsTracking() { |
| 465 time_intervals_.Clear(); | 465 time_intervals_.Clear(); |
| 466 } | 466 } |
| 467 | 467 |
| 468 |
| 468 void HeapObjectsMap::UpdateHeapObjectsMap() { | 469 void HeapObjectsMap::UpdateHeapObjectsMap() { |
| 469 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 470 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
| 470 "HeapSnapshotsCollection::UpdateHeapObjectsMap"); | 471 "HeapSnapshotsCollection::UpdateHeapObjectsMap"); |
| 471 HeapIterator iterator(heap_); | 472 HeapIterator iterator(heap_); |
| 472 for (HeapObject* obj = iterator.next(); | 473 for (HeapObject* obj = iterator.next(); |
| 473 obj != NULL; | 474 obj != NULL; |
| 474 obj = iterator.next()) { | 475 obj = iterator.next()) { |
| 475 FindOrAddEntry(obj->address(), obj->Size()); | 476 FindOrAddEntry(obj->address(), obj->Size()); |
| 476 } | 477 } |
| 477 RemoveDeadEntries(); | 478 RemoveDeadEntries(); |
| (...skipping 1506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1984 group->info = NULL; // Acquire info object ownership. | 1985 group->info = NULL; // Acquire info object ownership. |
| 1985 } | 1986 } |
| 1986 isolate->global_handles()->RemoveObjectGroups(); | 1987 isolate->global_handles()->RemoveObjectGroups(); |
| 1987 isolate->heap()->CallGCEpilogueCallbacks(major_gc_type); | 1988 isolate->heap()->CallGCEpilogueCallbacks(major_gc_type); |
| 1988 // Record objects that are not in ObjectGroups, but have class ID. | 1989 // Record objects that are not in ObjectGroups, but have class ID. |
| 1989 GlobalHandlesExtractor extractor(this); | 1990 GlobalHandlesExtractor extractor(this); |
| 1990 isolate->global_handles()->IterateAllRootsWithClassIds(&extractor); | 1991 isolate->global_handles()->IterateAllRootsWithClassIds(&extractor); |
| 1991 embedder_queried_ = true; | 1992 embedder_queried_ = true; |
| 1992 } | 1993 } |
| 1993 | 1994 |
| 1995 |
| 1994 void NativeObjectsExplorer::FillImplicitReferences() { | 1996 void NativeObjectsExplorer::FillImplicitReferences() { |
| 1995 Isolate* isolate = Isolate::Current(); | 1997 Isolate* isolate = Isolate::Current(); |
| 1996 List<ImplicitRefGroup*>* groups = | 1998 List<ImplicitRefGroup*>* groups = |
| 1997 isolate->global_handles()->implicit_ref_groups(); | 1999 isolate->global_handles()->implicit_ref_groups(); |
| 1998 for (int i = 0; i < groups->length(); ++i) { | 2000 for (int i = 0; i < groups->length(); ++i) { |
| 1999 ImplicitRefGroup* group = groups->at(i); | 2001 ImplicitRefGroup* group = groups->at(i); |
| 2000 HeapObject* parent = *group->parent; | 2002 HeapObject* parent = *group->parent; |
| 2001 int parent_entry = | 2003 int parent_entry = |
| 2002 filler_->FindOrAddEntry(parent, native_entries_allocator_)->index(); | 2004 filler_->FindOrAddEntry(parent, native_entries_allocator_)->index(); |
| 2003 ASSERT(parent_entry != HeapEntry::kNoEntry); | 2005 ASSERT(parent_entry != HeapEntry::kNoEntry); |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2609 | 2611 |
| 2610 static void WriteUChar(OutputStreamWriter* w, unibrow::uchar u) { | 2612 static void WriteUChar(OutputStreamWriter* w, unibrow::uchar u) { |
| 2611 static const char hex_chars[] = "0123456789ABCDEF"; | 2613 static const char hex_chars[] = "0123456789ABCDEF"; |
| 2612 w->AddString("\\u"); | 2614 w->AddString("\\u"); |
| 2613 w->AddCharacter(hex_chars[(u >> 12) & 0xf]); | 2615 w->AddCharacter(hex_chars[(u >> 12) & 0xf]); |
| 2614 w->AddCharacter(hex_chars[(u >> 8) & 0xf]); | 2616 w->AddCharacter(hex_chars[(u >> 8) & 0xf]); |
| 2615 w->AddCharacter(hex_chars[(u >> 4) & 0xf]); | 2617 w->AddCharacter(hex_chars[(u >> 4) & 0xf]); |
| 2616 w->AddCharacter(hex_chars[u & 0xf]); | 2618 w->AddCharacter(hex_chars[u & 0xf]); |
| 2617 } | 2619 } |
| 2618 | 2620 |
| 2621 |
| 2619 void HeapSnapshotJSONSerializer::SerializeString(const unsigned char* s) { | 2622 void HeapSnapshotJSONSerializer::SerializeString(const unsigned char* s) { |
| 2620 writer_->AddCharacter('\n'); | 2623 writer_->AddCharacter('\n'); |
| 2621 writer_->AddCharacter('\"'); | 2624 writer_->AddCharacter('\"'); |
| 2622 for ( ; *s != '\0'; ++s) { | 2625 for ( ; *s != '\0'; ++s) { |
| 2623 switch (*s) { | 2626 switch (*s) { |
| 2624 case '\b': | 2627 case '\b': |
| 2625 writer_->AddString("\\b"); | 2628 writer_->AddString("\\b"); |
| 2626 continue; | 2629 continue; |
| 2627 case '\f': | 2630 case '\f': |
| 2628 writer_->AddString("\\f"); | 2631 writer_->AddString("\\f"); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2694 | 2697 |
| 2695 | 2698 |
| 2696 void HeapSnapshotJSONSerializer::SortHashMap( | 2699 void HeapSnapshotJSONSerializer::SortHashMap( |
| 2697 HashMap* map, List<HashMap::Entry*>* sorted_entries) { | 2700 HashMap* map, List<HashMap::Entry*>* sorted_entries) { |
| 2698 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) | 2701 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) |
| 2699 sorted_entries->Add(p); | 2702 sorted_entries->Add(p); |
| 2700 sorted_entries->Sort(SortUsingEntryValue); | 2703 sorted_entries->Sort(SortUsingEntryValue); |
| 2701 } | 2704 } |
| 2702 | 2705 |
| 2703 } } // namespace v8::internal | 2706 } } // namespace v8::internal |
| OLD | NEW |